-
Notifications
You must be signed in to change notification settings - Fork 583
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
Posting data with chunked transfer encoding causes request to be abruptly closed #669
Comments
This is all on local testing the request goes straight from node-fetch to the uWS/HyperExpress webserver so no proxies involved. I don't think the |
Ah there is open issue uNetworking/uWebSockets#881 |
I see, that makes sense. Seems like it's low priority at the moment. I guess I'll wait on Alex's response to see whether I should push out the file uploading without support for chunked transfer or wait if he plans on adding this functionality soon. |
More info on transfer-encoding chunked:
|
Ohh I didn't even know that, in that case I can see why this is low priority. |
Yeah it doesn't implement the full HTTP1.1, for instance it does not support (async?) pipelining and chunked uploads. Only WebSockets are fully standards compliant. HTTP1.1 is a crappy standard but most companies have a nice proxy for HTTP2 or even HTTP3 so it doesn't matter as long as the basics of HTTP1.1 is there. uws is getting HTTP3 soonish so at that point things will be better for those not using a proxy because HTTP1.1 is really terrible. |
I see, I implemented file uploads with multipart forms using busboy parser and it seems browsers provide a content-length header so should be no problem there. |
I tested |
On Safari, a POST request would result in two chunks (the first being empty), and threw the following error: > node:buffer:254 > TypedArrayPrototypeSet(target, source, targetStart); > ^ > > TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer > at Buffer.set (<anonymous>) > at _copyActual (node:buffer:254:3) > at Function.concat (node:buffer:562:12) > at onEnd (xxx/node_modules/engine.io/build/transports-uws/polling.js:126:32) > at xxx/node_modules/engine.io/build/transports-uws/polling.js:143:17 Which is a bit weird, because it seems µWebSockets.js does not support chunked content: uNetworking/uWebSockets.js#669
This is fixed in main repo. Will be released here as well. |
Hello, I was in the process of implementing file uploading/body streaming into https://github.com/kartikk221/hyper-express and ran into an issue when attempting to stream file data using chunked encoding transfer. From messing with various different scenarios it seems uWebsockets.js instantly closes a request connection if it detects some body data is being sent with a request that has no content-length header. I have provided some context below for the implementation/test case in which bug occurs:
Implementation (/src/components/http/Request.js):
Test Case:
In the test case above, the
buffer_upload_response
fetch tests the streaming by sending aBuffer
of the test file which works as expected since acontent-length
header is sent along with the fetch request. But thechunked_upload_response
fetch request throws anFetchError: request to http://127.0.0.1:8080/tests/request/stream-pipe failed, reason: write ECONNRESET
error signifying that the server abruptly closed the connection even though the server does not crash. I have provided the console logs below so you can get more context for request headers and body chunks being received on the server side in both fetch requests.Logs:
The text was updated successfully, but these errors were encountered: