-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Client Chunked encoding does not receive MG_EV_HTTP_REPLY #1083
Comments
Hello Sergey, The error is that chunks are not reassembled correctly - chunk lengths appear in the result buffer. Also, the terminating chunk is not recognized, so the connection is not closed, and MG_EV_HTTP_REPLY is not called. |
Related to above comment on chunked transfer encoding: |
Same ISSUE here. Sometimes chunks contains data that shouldn't be part of the body data. I encountered that the first attempt to download larger file by chunks succseeded but second attempt failed. Reconstructed data contained data from previous call. Strange. Voting for reproduce and fix. |
Please use updated API, see https://github.com/cesanta/mongoose/tree/master/examples/http-streaming-client |
Had the same problem in 6.18. |
@psykokwak-com which exactly broken API are you talking about? |
I tried to update my code to 7.xx and I got lot of errors "symbol undefined" and others. I have no time to check carrefully. |
Sergey, I too patched an old version of mongoose to get myself rolling. If you'd like, I can send you my patched version and the tests I used to verify. |
Not really interested in the patched 6.x version. |
@jimellert , I am interested in your patch in version 6.xx |
@psykokwak-com , sorry for the late response. |
hello, the problem is in mg_http_handler, MG_EV_RECV condition. If we have any chunks... The condition mg_http_create_proto_data reset the pointer to the information needed for concat all chunks to body. this is a small example of how it is solved before: if (req_len > 0) {
after:
|
I am using mongoose 6.16 as a web client.
If I perform a GET and consume the data in MG_EV_HTTP_REPLY, I will get the appropriate amount of MG_EV_HTTP_CHUNK callbacks followed by a MG_EV_HTTP_REPLY as expected in a timely manor (a few milliseconds) . This works fine and as expected.
If I instead try to consume the data in the MG_EV_HTTP_CHUNK and set nc->flags |= MG_F_DELETE_CHUNK, I still receive all the data but I don't get a MG_EV_HTTP_REPLY callback until much much later. All of the MG_EV_HTTP_CHUNK come within a few milliseconds but the MG_EV_HTTP_REPLY doesnt come for another 5 seconds after.
Additionally, there seem to be no examples using MG_F_DELETE_CHUNK.
I need to consume the data in chunks because the data I am receiving is too large to be stored in a single buffer.
This may be related to #971
The text was updated successfully, but these errors were encountered: