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] Fix processing a NativeResponse after its client has been reset#59631

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

Merged

Conversation

Jean-Beru
Copy link
Contributor

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

An exception is thrown in dev when a response is processed before streaming it.

It is due to the HttpClientDataCollectorwhich resets the client between the first access to the response and the next ones. This operation resets theNativeClientState and itshosts property which is used in theNativeReponse when the stream is cancelled or completed.

Reproducer

/** @var NativeHttpClient $appClient **/$response =$appClient->request('GET','https://google.com');returnnewStreamedResponse(function ()use ($appClient,$response):void {foreach ($appClient->stream($response)as$chunk) {echo$chunk->getContent();// it fails because this code is executed AFTER collecting data and so, the client resetflush();        }    },$response->getStatusCode(),// the status code is retrieved BEFORE the reset done by the HttpClientDataCollector);

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.

LGTM but we don't need these extra comments. The issue can happen in other contexts. The name of the test case LGTM.

@nicolas-grekasnicolas-grekas changed the title[HttpClient] Fix "Undefined array key" when processing a NativeResponse[HttpClient] Fix processing a NativeResponse after its client has been resetJan 28, 2025
@nicolas-grekas
Copy link
Member

Thank you@Jean-Beru.

@nicolas-grekasnicolas-grekas merged commit7e396bb intosymfony:6.4Jan 28, 2025
11 checks passed
@Jean-BeruJean-Beru deleted the fix-native-http-client branchJanuary 28, 2025 16:26
This was referencedJan 29, 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
6.4
Development

Successfully merging this pull request may close these issues.

3 participants
@Jean-Beru@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp