Potential bug using `Connection: close` header #41

Closed
indexzero opened this Issue Apr 27, 2011 · 9 comments

Comments

Projects
None yet
5 participants
@indexzero
Owner

indexzero commented Apr 27, 2011

Remark: Extrapolated from the nodejs-dev mailing list (thanks fidian)

I have updated the proxy code. Here's the newer invocation:

require('http-proxy').createServer(8002, 'localhost').listen(8001);

I have tried the following scenarios:

  • GET without Connection: close = success
  • GET with Connection: close = success
  • POST without Connection: close = success
  • POST with Connection: close = FAIL

I have a logging TCP proxy both on the incoming and outgoing sides of
this proxy to see what's sent and received. It is identical to what I
saw when my older code was using sys.puts(). I see that the server is
indeed sending a response and that the JS proxy is not relaying that
information to the client. The time stamps indicate that the
connection is actually closed before the connection to the destination
server is made. Incoming:

-------- CLIENT TO PROXY START --------
[00:00.000 - client 127.0.0.1:35062 forwarded to :8001]
POST /test.php?postclosed HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: 47
Connection: close
Host: censored.com

AUTHTOKEN=FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

[00:00.001 - server connected]
[00:00.002 - server closed]
-------- CLIENT TO PROXY END --------

And here's what's logged on the other side:

-------- PROXY TO SERVER START --------
[00:00.000 - client 127.0.0.1:33945 forwarded to devweb1:81]
POST /test.php?postclosed HTTP/1.1
content-type: application/x-www-form-urlencoded; charset=utf-8
content-length: 47
connection: close
host: censored.com
x-forwarded-for: 127.0.0.1

AUTHTOKEN=FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
[00:00.036 - server connected]
HTTP/1.1 200 OK
Date: Tue, 26 Apr 2011 16:35:00 GMT
Server: Apache/2.2.14 (Fedora)
X-Powered-By: PHP/5.3.3
Content-Length: 503
Connection: close
Content-Type: text/html; charset=UTF-8

{ ... hundreds of bytes of JSON data removed ... }
[00:00.079 - server closed]
-------- PROXY TO SERVER END --------

@Marak

This comment has been minimized.

Show comment Hide comment
@Marak

Marak Jun 8, 2011

Contributor

@indexzero is this ticket still relevant? If so, should we get @olauzon to investigate?

Contributor

Marak commented Jun 8, 2011

@indexzero is this ticket still relevant? If so, should we get @olauzon to investigate?

@indexzero

This comment has been minimized.

Show comment Hide comment
@indexzero

indexzero Jun 8, 2011

Owner

@Marak I have not investigated it at all, so it would be good to at least confirm it is no longer an issue.

Owner

indexzero commented Jun 8, 2011

@Marak I have not investigated it at all, so it would be good to at least confirm it is no longer an issue.

@fidian

This comment has been minimized.

Show comment Hide comment
@fidian

fidian Jun 9, 2011

It is still an issue, but not related to the proxy. See joyent/node#1165

fidian commented Jun 9, 2011

It is still an issue, but not related to the proxy. See joyent/node#1165

@indexzero

This comment has been minimized.

Show comment Hide comment
@indexzero

indexzero Jun 11, 2011

Owner

@fidian Do you know if there is a workaround for the node core issue that we could use in node-http-proxy?

Owner

indexzero commented Jun 11, 2011

@fidian Do you know if there is a workaround for the node core issue that we could use in node-http-proxy?

@fidian

This comment has been minimized.

Show comment Hide comment
@fidian

fidian Jun 13, 2011

Please see the bug report for node for all that I have figured out. joyent/node#1165

fidian commented Jun 13, 2011

Please see the bug report for node for all that I have figured out. joyent/node#1165

@coderarity

This comment has been minimized.

Show comment Hide comment
@coderarity

coderarity Apr 7, 2012

Contributor

It looks like this has been fixed. See joyent/http-parser#83.

Contributor

coderarity commented Apr 7, 2012

It looks like this has been fixed. See joyent/http-parser#83.

@fidian

This comment has been minimized.

Show comment Hide comment
@fidian

fidian Apr 14, 2012

I wrote an entirely node-based sample script to illustrate the problem and posted it on the node-http issue that was already opened. Unfortunately, that issue has already been marked as closed and I can't reopen it.

joyent/http-parser#47

fidian commented Apr 14, 2012

I wrote an entirely node-based sample script to illustrate the problem and posted it on the node-http issue that was already opened. Unfortunately, that issue has already been marked as closed and I can't reopen it.

joyent/http-parser#47

@bnoordhuis

This comment has been minimized.

Show comment Hide comment
@bnoordhuis

bnoordhuis Apr 14, 2012

This will be fixed in v0.6.16. Node v0.7.4 and newer already contain the fix from joyent/http-parser#83.

This will be fixed in v0.6.16. Node v0.7.4 and newer already contain the fix from joyent/http-parser#83.

@indexzero

This comment has been minimized.

Show comment Hide comment
@indexzero

indexzero Mar 9, 2013

Owner

This is fixed in node core.

Owner

indexzero commented Mar 9, 2013

This is fixed in node core.

@indexzero indexzero closed this Mar 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment