[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-23 Thread sicarius noidea
sicarius noidea added the comment: Alright, that was a bad idea. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-23 Thread Christian Heimes
Christian Heimes added the comment: urllib is a high level API on top of http.client. It wraps and uses http.client internally. urllib does not accept invalid protocol identifiers either: >>> urllib.request.urlopen('http://localhost:8080') Traceback (most recent call last): File "", line 1,

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-23 Thread sicarius noidea
sicarius noidea added the comment: Hi @christian.heimes, Thank you for your research too. We've also discovered that this check is correct, but this check is very strict and blocking (error raised, stopping the connection), we should maybe be more "laxist" and allow the lowercase version ?

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread Christian Heimes
Christian Heimes added the comment: https://tools.ietf.org/html/rfc2616#section-3.1 defines HTTP version indicator as HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT so the check version.startswith("HTTP/") is correct. -- nosy: +christian.heimes

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks for the reproducer and the research! https://tools.ietf.org/html/rfc2616#section-3.1 says the result header is "HTTP", and doesn't say anything else is acceptable. I'd be interested in what other frameworks (probably in other languages) support. I'll d

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread sicarius noidea
sicarius noidea added the comment: Here is the poc for this error with http.client only (for the server: use the same nc command as my first message): ```python import http.client >>> h1 = http.client.HTTPConnection("127.0.0.1:80") >>> h1.request("GET", "/") >>> r1 = h1.getresponse() Traceback

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread sicarius noidea
sicarius noidea added the comment: Hi, Here I'm using requests to show the behavior because it relies on python's http lib, and it is faster/simplier to use. The Exception "BadStatusLine" is a part or the http/client.py library. As per the RFC2616 section 6.1 https://tools.ietf.org/html/rfc

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread Eric V. Smith
Eric V. Smith added the comment: requests is a third-party library, and this isn't the right place to report issues with it. It looks like the requests issue tracker is at https://github.com/psf/requests/issues If you can duplicate this problem with only using the python standard library, t

[issue42432] Http client, Bad Status Line triggered for no reason

2020-11-22 Thread sicarius noidea
New submission from sicarius noidea : Hey, BadStatusLine triggered when protocol version is in lowercase. I've encountered a server that answers "Http/1.0 404 Not Found\r\n" instead of "HTTP/1.0 404 Not Found\r\n" ## Expected Result Requests understanding the status line. ## Actual Result