File uploads streaming method, chunk issue #1525
-
Hello, I am trying the example: https://mongoose.ws/tutorials/file-uploads/#streaming-method I am using Mongoose v. 7.6 first of all, I noticed that it doesn't seem to be true that the last chunk is the one with len 0, so if I try the example as it is, the mg_http_reply(c, 200, "", "ok (chunked)\n") is never sent. But the big problem I encountered is that the first time I upload a file I receive all the chunks correctly. If I try a second time, the first chunk seems to be not correct and it contains extra data (data of the POST request or http header, I don't know exactly) respect the file data. Here below the image of the content of mg_http_message hm structure in the OK case: and in the NOK case: Any explanation about this behaviour ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
@steteb Can you elaborate on "If I try second time", please? What second time means? Can you share an example, please? |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm actually incurring in the same issue as the poster steteb said. I managed to handle the "transfer complete" counting the number of bytes received against Content-Length header, so that is fine, but the issue is that I cannot gracefully close connection because the receiving buffer would still contain last POST. I would like to know if this bug's been handled and/or if there is some solution to handling the end of transfer. |
Beta Was this translation helpful? Give feedback.
-
This has already been fixed for 7.8 (see #1656 and https://mongoose.ws/tutorials/file-uploads/#binary-upload) |
Beta Was this translation helpful? Give feedback.
This has already been fixed for 7.8 (see #1656 and https://mongoose.ws/tutorials/file-uploads/#binary-upload)