-
Notifications
You must be signed in to change notification settings - Fork 2k
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
HTTP/1.0 proxied as HTTP/1.1 #59
Comments
@fidian Can you provide a complete repro including the PHP script that I should use to reproduce the issue? |
PHP code to make the request:
PHP code to handle the request
You need to not write out gzipped data and write a large enough amount of data so that PHP will automatically chunk the reply. The above should do it. |
@fidian here is the simplest repro for this issue: $ cd /path/to/node-http-proxy
$ forever start examples/standalone-proxy-server.js
$ curl -0 -v http://localhost:8004/
* About to connect() to localhost port 8004 (#0)
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8004 (#0)
> GET / HTTP/1.0
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: localhost:8004
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/plain
< connection: close
< transfer-encoding: chunked
<
request successfully proxied to: /
{
"user-agent": "curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3",
"host": "localhost:8004",
"accept": "*/*",
"x-forwarded-for": "127.0.0.1",
"x-forwarded-port": "53575",
"x-forwarded-proto": "http",
"connection": "close"
* Closing connection #0
} Unfortunately, it seems that this is by design in node.js core. This is the status line written to every Maybe @ry or @felixge can comment on if outgoing |
As far as I know node only supports http 1.1, not sure if that is going to change. |
@felixge Thank you for clarifying. I am going to close this as |
You shouldn't send chunked responses to http 1.0 clients - Node should know this. HTTP 1.1 servers are backwards compatible. It certainly is a bug.... |
That would mean we have to buffer the whole response data for http 1.0 clients, right? |
@ry Thanks. I'll reopen this. I've opened an associated bug on node here: nodejs/node-v0.x-archive#1234 |
@felixge the response can be terminated by closing the connection |
I'm sure you're aware of the severity of this bug, but let me emphasize it again. Sending 'Transfer-encoding: chunked' response to clients that are speaking http1.0 effectively means that Squid website says: |
Sample code:
Sample request:
Request that goes to the server:
The server's response for this page looks like this:
The response to the client looks identical. This, unfortunately, breaks the HTTP/1.0 response since now we are both sending an HTTP/1.1 status and we are doing chunked encoding. The HTTP/1.0 client can't understand this.
The fix: Make the request to the server an HTTP/1.0 request to mirror the client's desires perfectly.
The text was updated successfully, but these errors were encountered: