Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Empty (invalid) response reported as `HTTP/9 200` #170

Closed
pda opened this Issue · 2 comments

2 participants

@pda
pda commented

If the TCP connection is successful, but receives a non-HTTP-response, e.g. a single newline character, the response is reported as HTTP/9 200. The program exits with a successful zero-status, too.

e.g:

# send a newline when something connects:
> echo -ne '\n' | nc -l 1234

> http get localhost:1234
HTTP/9 200

> echo $?
0
@jakubroztocil

This only concerns Python 2 where HTTP 0.9 is assumed by default in such cases. In Python 3 this will result in an error as expected. If you can, please update to Python 3.

To make it fail loudly in Python 2 as well, a change would be required in the upstream python-requests library (see kennethreitz/requests#1869).

The reported version has now been fixed though (0.9 vs 9).

@pda

No worries, thanks.
I use Python 3 when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.