hoxy icon indicating copy to clipboard operation
hoxy copied to clipboard

Issue with large responses (perhaps chunked encoding)

Open RobertLarsen opened this issue 10 years ago • 6 comments

The following script:

var hoxy = require('hoxy'),
    proxy = new hoxy.Proxy();

proxy.intercept({
        phase : 'response',
        fullUrl : 'http://:host/game.js',
        as : 'string'
    }, function(req, rsp) {
        console.log('Intercepting');
    });

proxy.listen(8080);

...fails when I generate a 500.000 byte game.js file on my webserver and download it through the proxy:

$ python -c 'open("../WWW/game.js", "w").write("A" * 500000)'
$ http_proxy=localhost:8080 wget  http://192.168.192.249/game.js
--2014-06-04 15:43:39--  http://192.168.192.249/game.js
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [application/javascript]
Saving to: ‘game.js’

    [<=>

wget never finishes, it just stands there. I do receive some of the file thou, trying multiple times I get this:

$ ls -l game.js*
-rw-r--r-- 1 robert robert 43488 Jun  4 15:43 game.js
-rw-r--r-- 1 robert robert 43488 Jun  4 15:45 game.js.1
-rw-r--r-- 1 robert robert 43488 Jun  4 15:45 game.js.2
-rw-r--r-- 1 robert robert 43488 Jun  4 15:45 game.js.3

However, if I change the 'fullUrl' in the intercept so that the response isn't interceptet, the file is downloaded fine.

RobertLarsen avatar Jun 04 '14 13:06 RobertLarsen

Does hoxy print any errors? Can you add

proxy.log('error warn');

...to your script and paste here any errors it generates? That should just print all errors to stderr.

greim avatar Jun 05 '14 04:06 greim

No logs are printed

I have put a pcap for download here: http://home.the-playground.dk/hoxy.pcap In that you can see two streams, the first is traffic between wget and hoxy, the second is traffic between hoxy and my web server. You can see, that hoxy received the full file in stream two, but in stream one only part of the file was delivered. The FIN packet (packet nr. 50) is when I kill wget and happens some 13 seconds after the last receive.

RobertLarsen avatar Jun 06 '14 07:06 RobertLarsen

By the way which version of node are you using? I see several test failures in v0.11.13 caused by timeouts. (0.11.x is the latest bleeding-edge version)

greim avatar Jun 06 '14 18:06 greim

$ node --version
v0.10.26

Do you want me to test with a specific version?

RobertLarsen avatar Jun 06 '14 19:06 RobertLarsen

Hmm...after 'npm update'ing for a fix on another issue this has gone away too...probably it's still there but not triggered by my particular test case.

RobertLarsen avatar Jun 11 '14 11:06 RobertLarsen

Thanks for the update. I'll leave this issue open for now, let me know if it comes back.

greim avatar Jun 12 '14 01:06 greim