Closed zdm closed 11 months ago
Upload large files impossible when content-length is present, With chunked encoding works file.
content-length
chunked
import uws from "uWebSockets.js"; uws.App() .post( "/*", post ) .listen( 80, () => {} ); async function post ( res, req ) { res.onAborted( () => { console.log( "--- ABORTED" ); } ); res.onData( ( arrayBuffer, isLast ) => { console.log( "---", isLast, arrayBuffer.byteLength ); } ); }
Tested on Windows and Linux, nodejs 18.
test.mkv shpuld be really large, 18 Gb in my case.
test.mkv
18 Gb
curl -X post -T test.mkv http://127.0.0.1/ -v * Trying 127.0.0.1:80... * Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) > post /test.mkv HTTP/1.1 > Host: 127.0.0.1 > User-Agent: curl/7.83.1 > Accept: */* > Content-Length: 20036037246 > Expect: 100-continue > * Mark bundle as not supporting multiuse < HTTP/1.1 100 Continue * Recv failure: Connection was reset * Closing connection 0 curl: (56) Recv failure: Connection was reset
Upload failed, socket dropped.
curl -X post -T test.mkv -H "Transfer-Encoding: chunked" http://127.0.0.1/ -v * Trying 127.0.0.1:80... * Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) > post /test.mkv HTTP/1.1 > Host: 127.0.0.1 > User-Agent: curl/7.83.1 > Accept: */* > Transfer-Encoding: chunked > Expect: 100-continue > * Mark bundle as not supporting multiuse < HTTP/1.1 100 Continue * Signaling end of chunked upload via terminating chunk. ^C
Upload done.
Maximum content length is 1gb. Might need to bump it a bit
not actual
Upload large files impossible when
content-length
is present, Withchunked
encoding works file.Test
Tested on Windows and Linux, nodejs 18.
test.mkv
shpuld be really large,18 Gb
in my case.Non-chunked:
Upload failed, socket dropped.
Chunked:
Upload done.