Repository navigation
Conversation
The cURL transport upper-cased the method for the request line but set CURLOPT_NOBODY only for exactly "HEAD". A lower-case "head", which can come from a PSR-7 request or a direct transport call, was sent as a custom HEAD request with NOBODY disabled, so cURL waited for the body announced by Content-Length until the connection was closed or the request timed out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Approved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
The cURL transport upper-cases the method for the request (
CURLOPT_CUSTOMREQUEST) but setCURLOPT_NOBODYonly for$method === 'HEAD'. A lower-casehead, which can come from a PSR-7 request passed tosendRequest()or from a direct transport call, was therefore sent as a customHEADrequest withNOBODYdisabled. cURL then waits for the body that the response'sContent-Lengthannounces but a HEAD response never carries: on a keep-alive connection until the timeout ("Operation timed out … with 0 out of 100 bytes received"), on a closing one it fails with "transfer closed with 100 bytes remaining to read".CURLOPT_NOBODYis now set for the method name in any case. The stream and socket transports were not affected.Testing Instructions
Tests/Transport/HeadRequestTest.php(new) sendsHEADandheadwith each transport to the new stubTests/stubs/content_length.php, which announces a 100-byte body; the web server omits it for HEAD. Before the change cURL withheadfails with "transfer closed with 100 bytes remaining to read"; after it all six cases return 200 with an empty body.Documentation Changes Required
docs/overview.md, "Making a HEAD request": the response has no body, whatever the case of the method name.🤖 Generated with Claude Code