Skip to content
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

Issue with large responses (perhaps chunked encoding) #26

Open
RobertLarsen opened this issue Jun 4, 2014 · 6 comments
Open

Issue with large responses (perhaps chunked encoding) #26

RobertLarsen opened this issue Jun 4, 2014 · 6 comments

Comments

@RobertLarsen
Copy link

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.

@greim
Copy link
Owner

greim commented Jun 5, 2014

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.

@RobertLarsen
Copy link
Author

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.

@greim
Copy link
Owner

greim commented Jun 6, 2014

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)

@RobertLarsen
Copy link
Author

$ node --version
v0.10.26

Do you want me to test with a specific version?

@RobertLarsen
Copy link
Author

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.

@greim
Copy link
Owner

greim commented Jun 12, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants