-
-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
It's possible that proper ending of request headers (\r\n\r\n) will be not send immediately together with headers chunk due to:
👉🏻 https://github.com/nodejs/undici/blob/main/lib/client.js#L1677
socket.write(`${header}transfer-encoding: chunked\r\n`, 'ascii')Potential fix:
if (bytesWritten === 0) {
if (!expectsPayload) {
socket[kReset] = true
}
if (contentLength === null) {
socket.write(`${header}transfer-encoding: chunked\r\n\r\n`, 'ascii')
socket.write(`${len.toString(16)}\r\n`, 'ascii')
} else {
socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'ascii')
}
} else if (contentLength === null) {
socket.write(`\r\n${len.toString(16)}\r\n`, 'ascii')
}Reproducible By
It's quite random and depends on Socket/system behaviours - "Sometimes" 😉
👀 👉🏻 Additional context
Expected Behavior
Chunk containing request headers always contains proper headers ending - \r\n\r\n.
Additional context
Related issue: uNetworking/uWebSockets.js#879
In this issue I have tried to emulate behaviour of undici - especially: uNetworking/uWebSockets.js#879 (comment)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working