Automatically sending Transfer-Encoding: chunked but I want to send Content-Length #1835
Unanswered
MacroMelon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm trying to send a large file back to the client, and want to have a download progress bar so I need to send the Content-Length header. I know the file size before initiating the transfer, so that's fine. However, I read and send the file in chunks (while checking for backpressure) and this causes uWebsockets to automatically send the Transfer-Encoding: chunked header, with which it is forbidden to send the Content-Length header according to HTTP specification.
I know I could send a custom header such as X-Content-Length, but for sake of general compatibilty reasons I would like to avoid that.
Here is my code to send the file, am I missing something / is there another way to do this?
Beta Was this translation helpful? Give feedback.
All reactions