Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Curl hangs on 204: No-Content with Transfer-Encoding: chunked #3968
I did this
from http.server import HTTPServer, BaseHTTPRequestHandler class HTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(204) self.send_header('Connection', 'keep-alive') self.send_header('Transfer-Encoding', 'chunked') # self.send_header('Content-Length', '0') self.end_headers() httpd = HTTPServer(('localhost', 8080), HTTPRequestHandler) httpd.serve_forever()
I expected the following
Expected curl to terminate, instead hangs permanently or until exited.
Similar issue described in https://serverfault.com/q/870072 from 2017, although doesn't appear to have been reported.
As an important note testing with #3702 the above works as expected. Since the mentioned PR appears to be fixing a different issue I think it's still important to mention here, but please let me know if this should be closed in favor of #3702.
Responses with status codes 1xx, 204 or 304 don't have a response body. For these, don't parse these headers: - Content-Encoding - Content-Length - Content-Range - Last-Modified - Transfer-Encoding This change ensures that HTTP/2 upgrades work even if a "Content-Length: 0" or a "Transfer-Encoding: chunked" header is present. Co-authored-by: Daniel Stenberg Closes #3702 Fixes #3968