Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httplib: false BadStatusLine() raised #52697

Closed
mschu mannequin opened this issue Apr 18, 2010 · 9 comments
Closed

httplib: false BadStatusLine() raised #52697

mschu mannequin opened this issue Apr 18, 2010 · 9 comments
Assignees
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mschu
Copy link
Mannequin

mschu mannequin commented Apr 18, 2010

BPO 8450
Nosy @orsenthil, @jwilk, @djc, @karlcow, @vadmium, @demianbrecht, @miss-islington
PRs
  • [2.7] bpo-8450: BadStatusLine('') better message #1453
  • [2.7] bpo-8450: BadStatusLine('') better message #1654
  • [2.7] closes bpo-8450: a better error message when http status line isn't received #2825
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/orsenthil'
    closed_at = <Date 2018-09-14.23:28:10.994>
    created_at = <Date 2010-04-18.22:45:28.700>
    labels = ['type-bug', 'library', 'docs']
    title = 'httplib: false BadStatusLine() raised'
    updated_at = <Date 2018-09-14.23:28:10.992>
    user = 'https://bugs.python.org/mschu'

    bugs.python.org fields:

    activity = <Date 2018-09-14.23:28:10.992>
    actor = 'miss-islington'
    assignee = 'orsenthil'
    closed = True
    closed_date = <Date 2018-09-14.23:28:10.994>
    closer = 'miss-islington'
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2010-04-18.22:45:28.700>
    creator = 'mschu'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 8450
    keywords = []
    message_count = 9.0
    messages = ['103545', '183575', '231410', '231411', '234105', '246926', '289498', '289513', '325414']
    nosy_count = 9.0
    nosy_names = ['orsenthil', 'jwilk', 'djc', 'karlcow', 'mschu', 'martin.panter', 'demian.brecht', 'Shoham Peller', 'miss-islington']
    pr_nums = ['1453', '1654', '2825']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue8450'
    versions = ['Python 2.7']

    @mschu
    Copy link
    Mannequin Author

    mschu mannequin commented Apr 18, 2010

    Independent from HTTP strict, an invalid BadStatusLine() exception is raised when a keep-alive connection exceeds its timeout:

    client->server <request>
    s->c <answer>
    <connection timeout passing>
    s->c: FIN/ACK
    c->s: ACK
    c->s: <get request>/FIN
    s->c: RST (without data)

    which raises the exception.

    An easy workaround is to either poll information often enough for the server to not close the connection or close and reopen the connection. However, the exception is misleading.

    @mschu mschu mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 18, 2010
    @orsenthil orsenthil self-assigned this Mar 18, 2011
    @karlcow
    Copy link
    Mannequin

    karlcow mannequin commented Mar 6, 2013

    Hmm no code.
    I wonder if it's about this part.
    http://hg.python.org/cpython/file/3.3/Lib/http/client.py#l321

    @vadmium
    Copy link
    Member

    vadmium commented Nov 20, 2014

    See also bpo-3566, which also brings up the false BadStatusLine exception, and suggests some kind of retry logic.

    Whatever exception it is, it could be documented better. In bpo-66621, the poster thought it should be an IncompleteRead exception.

    @vadmium
    Copy link
    Member

    vadmium commented Nov 20, 2014

    Sorry the IncompleteRead reference was meant to be bpo-666219

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jan 16, 2015

    This should likely be closed as a duplicate of bpo-3566, which has additional detail.

    @vadmium
    Copy link
    Member

    vadmium commented Jul 19, 2015

    bpo-3566 has added a new exception subclass, RemoteDisconnected, in 3.5. People are still complaining about the old BadStatusLine exception in Python 2 though. See bpo-23054.

    Python 2 could still get better documentation of the BadStatusLine exception. Currently it gives the impression that it only happens when the “strict” parameter is True, and a status line was received that was not understood.

    The exception message could also be improved. Due to bpo-7427, there is a special case to make the message literally two quote signs (''), representing an empty string. Perhaps messages like “End of stream signalled”, “No status line”, or “Empty status line” would be clearer.

    @vadmium vadmium added the docs Documentation in the Doc dir label Jul 19, 2015
    @ShohamPeller
    Copy link
    Mannequin

    ShohamPeller mannequin commented Mar 12, 2017

    How about back-porting the v3.5 fix, and the new "RemoteDisconnected" exception? Is that reasonable?

    @vadmium
    Copy link
    Member

    vadmium commented Mar 12, 2017

    I don’t think so. It is best to avoid a new exception type (even a subclass) in a bug fix. That would break code which checks “type(exc) == BadStatusLine” or similar.

    Specific exception messages are supposed to be implementation details, and the current message is already quirky due to the change from bpo-7427 (released in 2.7a4). That is why I thought it might be reasonable to just change the exception message in a bug fix.

    @miss-islington
    Copy link
    Contributor

    New changeset ee78ba2 by Miss Islington (bot) (Shoham Peller) in branch '2.7':
    [2.7] closes bpo-8450: a better error message when http status line isn't received (GH-2825)
    ee78ba2

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants