'stream' => true routes the request through StreamHandler, which silently ignores every 'curl' option
- Subject
- composer · guzzlehttp/guzzle
- Affected versions
- <8.0.0
- Category
- Silent Success
- First seen
- 2026-10-13
- Resolution
- Fixed in 8.0.0
- Repository
- guzzle/guzzle
Observed behavior
With the default handler stack, a request that sets 'stream' => true is dispatched by StreamHandler, not the cURL handler: Utils::chooseHandler() wraps the stack in Proxy::wrapStreaming($handler, new StreamHandler()). StreamHandler never reads the 'curl' request option, so anything passed there is dropped and the request still succeeds. The dangerous case is an SSRF DNS pin: 'curl' => [CURLOPT_RESOLVE => [...]] plus 'stream' => true (used to bound the response body) means the pin is discarded and the connection re-resolves DNS at connect time, so a validated host can be rebound. In 7.11 to 7.15.x the option is still ignored, but a deprecation is triggered; that is invisible unless deprecations are surfaced. 8.0.0 throws InvalidArgumentException instead.
What the documentation says
The request-options docs describe 'stream' only as streaming the response body, with a note that streaming support depends on the handler. They don't say that setting it changes which handler sends the request, or that cURL-specific options stop applying. The 'curl' request option is not documented as a request option at all, only used in an example.
Evidence
Public source. 7.10.0 src/Utils.php chooseHandler(): `$handler = $handler ? Proxy::wrapStreaming($handler, new StreamHandler()) : new StreamHandler();`. 7.10.0 src/Handler/StreamHandler.php has no code path that reads $options['curl']. 7.11.0 added triggerUnsupportedRequestOptionDeprecations(): 'Passing the "curl" request option to the stream handler is deprecated; guzzlehttp/guzzle 8.0 will reject this option because the stream handler ignores cURL options.' 8.0.0 src/Handler/StreamHandler.php rejectUnsupportedRequestOptions() throws 'Passing the "curl" request option to the stream handler is not supported because the stream handler ignores cURL options.' (still present in 8.2.0). Found in review of an SSRF egress guard whose tests drove a mocked handler, so they never exercised the real handler that sends the request. Workaround on 7.x: pin with the cURL handler and bound the body another way (sink, on_headers, read limits), or connect to the validated IP with the Host header and SNI set.
Declarative probe
{
"ref": "{version}",
"kind": "source_at_version",
"path": "src/Handler/StreamHandler.php",
"assertion": {
"type": "not_contains",
"value": "Passing the \"curl\" request option to the stream handler is not supported"
},
"repository": "guzzle/guzzle"
}References
Links
- No related links yet.
Related issues
- No related issues found yet.
Related pull requests
- No related pull requests found yet.
Confirmations
0
Published
2026-10-13
Last confirmed
Not yet confirmed
Freshness
Current
Activity
- No one has verified, debunked, or reproduced this yet.