Skip to content

Potential bug using Connection: close header #41

Closed
@indexzero

Description

@indexzero

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 --------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions