-
Notifications
You must be signed in to change notification settings - Fork 83
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
Encoding problem with proxied binary data #80
Comments
Thanks for the report, I'll take a look. |
This make take a bit of time (I'm a bit busy ATM). I need to be able to reproduce the error (preferably in a failing unit test). Are you able to assist? Perhaps you can provide a sample file and use debug to find the browser's I don't suppose replacing InputStream with UnicodeBOMInputStream.java fixes your issue?
I agree. The problem is the InputStream is converted to a BufferedReader to interpret the request - I don't think the underlying InputStream is useable after that - I'll have to look into the options... |
Hello! Note: to your question (using UnicodeBOMInputStream) ... no, I don't think that would help me, because same problems may occur with real binary data which can't be encoded as unicode and read as string (the content length won't match) I hope this helps reproducing and fixing the bug. |
Thanks, I've reproduced the error, and will compare with your test. It's a bit tricky, because the BOM can appear anywhere in the POST data (my test is on a multi-part file upload). I'll look at reading the lines from the InputStream instead of the BufferedReader, so that I can copy the streams as you suggested above. |
I've committed a failing test |
There's a fix in trunk - can you rebuild and re-test? Thanks to https://github.com/0mc and Apache Commons IO. |
Thank you for the fix - it did solve the issue of POST-requests with some special XML-files (BOM handling). BUT the JSCover proxy still can't handle POST-requests with binary data! Temporarily I've worked around the problem with a Apache proxy in between only sending JS-file requests to JSCover and forwarding the POST-requests directly to my webserver. |
K - will have to start with a failing test for this scenario. |
I think I've fixed this. Can you try this patch. |
cool, looks good. some first tests worked without any troubles. |
Great. Let me know if the rest pass and I'll check in. I need to write a few more tests and look at handling other encodings. |
also my nightly integration tests worked with the new patched version without any problems. |
Thanks, but I'm looking at a more elegant solution. I'll let you know when I check in so you can re-test before I release (I should have enough scenarios to cover this though). |
OK - I think it's all fixed in trunk. Can you rebuild and let me know how it goes? |
Sorry for the late response. Last night I've started a new test run with the latest version from trunk (yesterday afternoon), but the test run does not look very good - the test got stuck several times on some POST-requests. After restarting the proxy it worked for a while until it got into the same problem (I've extended the code with some log messages logging every served request - and when the proxy run into such problems no request logs are written any more ... ) |
Thanks for taking the time to look at this. I've re-implemented the stream handling using PushbackInputStream, so I can read the HTTP header data, push the header data back onto the stream and forward to the proxy if necessary while avoiding any low-level encoding issues. In theory it's a better implementation if I can get it working. All my local tests pass, so I'd like to write a test that exposes the error you're getting.
Maybe you can add your changes to a fork, and I'll look at incorporating it with something like a
That'd be great - thanks. I'll see if I can find the issue in the meantime. |
I haven't had any luck trying to reproduce...Can you reproduce this manually with a browser? If you describe the steps I can probably solve this a bit quicker. |
Excellent. Once confirmed, if you want to fork, commit and create a pull request, you'll get the commit to your name. Otherwise I'll credit you in the commit comments and contributions page. I'll try to write a test that proves it in the mean time. |
Did it work for you? I've noticed if I do a huge upload, only the first ~500 bytes come through - that's the header fields and no POST data. Try a break point on line 383 of |
My nightly tests worked without any problems. I didn't see any problems concerning big post-requests (also a 25MB zip-file upload worked as expected). To the other logging improvements I've made ... I didn't have time to create a fork yet and don't think that will be very soon (on holiday next week, ...) but shortly explained what I've done:
last but not least ... thank's for your effort on fixing this bug. |
I've committed the fix - can you review? Thanks for your help. I've credited you in the commit message and added you to the contributor list (will upload to web-site with 1.0.2 release in a few days). |
I've just updated from jscoverage to JSCover (using as proxy instrumentation server) and now have some troubles with POST-requests containing binary data ... the requests get stuck at the proxy and run into a socket timeout of 1 minute.
Here are some details:
Here is a screenshot of some debug output logs for more details ...
It would be much better to forward (especially not instrumented requests) exactly with the same content as they are received (copy stream data as binary data - not as encoded characters). POST-data requests could also contain real binary data - maybe they should be by-passed even at a higher level.
Kind regards,
Klaus.
The text was updated successfully, but these errors were encountered: