-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
- Version: v14.17.0
- Platform: OS X
- Subsystem: http
What steps will reproduce the bug?
Run the snippet below (from How do I create a HTTP server):
const http = require('http'); const requestListener = function (req, res) { res.writeHead(200); res.end('Hello, World!'); } const server = http.createServer(requestListener); server.listen(8080);And call the server with the following command:
curl -i localhost:8080 -X HEAD Running the server on v14.16.1, the curl command will return 0 with the following output:
$ curl -i localhost:8080 -X HEAD Warning: Setting custom HTTP method to HEAD with -X/--request may not work the Warning: way you want. Consider using -I/--head instead. HTTP/1.1 200 OK Date: Fri, 04 Jun 2021 04:15:27 GMT Connection: keep-alive Keep-Alive: timeout=5Running the server on v14.17.0, the curl command will exit with code 18 and the following error:
$ curl -i localhost:8080 -X HEAD Warning: Setting custom HTTP method to HEAD with -X/--request may not work the Warning: way you want. Consider using -I/--head instead. HTTP/1.1 200 OK Date: Fri, 04 Jun 2021 04:16:58 GMT Connection: keep-alive Keep-Alive: timeout=5 Transfer-Encoding: chunked curl: (18) transfer closed with outstanding read data remainingHow often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Within a major, no header that could potentially destructively affects HTTP clients behavior should be introduced.
What do you see instead?
Transfer-Encoding: chunked is introduced, causing curl to exit with an error code.
Additional information
I noticed this error on this Restify test recently. I'm not entirely sure if this should be considered a breaking change, but it seems like one. I couldn't determine which commit introduced it yet though.
cc @nodejs/http (and @nodejs/tsc @nodejs/lts for visibility)