Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpClient] Add optionauto_upgrade_http_version to control how the request HTTP version is handled inHttplugClient andPsr18Client#62059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@ajgarlag
Copy link
Contributor

@ajgarlagajgarlag commentedOct 14, 2025
edited by nicolas-grekas
Loading

QA
Branch?7.4
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

When a PSR-7 request is sent usingPsr18Client, the PSR-7 request protocol version is only converted to the underlyinghttp_version option when is set to1.0, so we cannot control that option for1.1 or2.0.

I have a project where I need to dynamically force the use of protocol version1.1 but the final request is always sent using version2.0.

This PR add optionauto_upgrade_http_version to control how the request HTTP version is handled inHttplugClient andPsr18Client.

$psr18Client =$psr18Client->withOptions(['auto_upgrade_http_version' =>false]);$request =$psr18Client->createRequest()->withProtocolVersion('1.1');// [...]// The request will use HTTP/1.1, whereas the defaults would upgrade to 2.0$response =$psr18Client->sendRequest($request);

@carsonbotcarsonbot added this to the7.4 milestoneOct 14, 2025
@carsonbotcarsonbot changed the titleHonor psr7 protocol version Honor psr7 protocol versionOct 14, 2025
@ajgarlag
Copy link
ContributorAuthor

I have a few questions about the initial implementation:

  • should the property$honorRequestHttpVersion be exposed as a constructor argument?
  • should the type of the property$honorRequestHttpVersion be restricted to bool values? If so, should a deprecation be triggered when it is set to false and the protocol version is set to1.0?

Any proposal for a better option name is welcome too.

@ajgarlagajgarlagforce-pushed thehonor-psr7-protocol-version-feature branch 3 times, most recently from6b92b39 toc9a4bbdCompareOctober 14, 2025 08:07
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks, here are some suggestions

@carsonbotcarsonbot changed the title Honor psr7 protocol version[HttpClient] Honor psr7 protocol versionOct 14, 2025
@nicolas-grekasnicolas-grekas changed the title[HttpClient] Honor psr7 protocol version[HttpClient] Add optionauto_upgrade_http_version to control how the request HTTP version is handled inHttplugClient andPsr18ClientOct 14, 2025

if ('1.0' ===$request->getProtocolVersion()) {
$options['http_version'] ='1.0';
if (!$this->autoUpgradeHttpVersion ||'1.0' ===$request->getProtocolVersion()) {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should we deprecate the exceptional behavior for version1.0?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I wouldn't: all PSR-7 implementations default to 1.1, so if we see 1.0 here, it's on purpose.
Also no need to change something that ain't bokrne :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So if we see2.0 or3.0 here is on purpose too.

Copy link
Member

@nicolas-grekasnicolas-grekasOct 14, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well, I'd consider explicit HTTP version selection something of the past - TLS negotiation makes it mostly useless.
I wouldn't change. The option you added is fine to reclaim control for use cases that care.

ajgarlag reacted with thumbs up emoji
…e request HTTP version is handled in `HttplugClient` and `Psr18Client`
@nicolas-grekasnicolas-grekasforce-pushed thehonor-psr7-protocol-version-feature branch froma4c62dd tob6ac394CompareOctober 14, 2025 08:41
@nicolas-grekas
Copy link
Member

Thank you@ajgarlag.

@nicolas-grekasnicolas-grekas merged commitad0a07c intosymfony:7.4Oct 14, 2025
11 checks passed
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

3 participants

@ajgarlag@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp