-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception while parsing header of batch request #2230
Comments
I've done a bit of further digging on this (since it's broken our app entirely). I think this is actually related to a recent change in guzzlehttp/psr7 (https://github.com/guzzle/psr7/blob/2.2.1/CHANGELOG.md). Temporarily forcing guzzle/psr7 to v2.1.0 in composer.json seems to do the job of fixing this (because it removes the newly added header validation). Unfortunately this is not a safe thing to do, thanks to this: GHSA-q7rv-6hp3-vh96 Making the change suggested by @brainformatik would solve the issue properly. |
Headers should not be concatenated, but passed as an array. See my response in this issue for guzzlehttp/psr7: |
Isnt the bug not in the SDK but the API itself? If i look at the definition it seems that the Vary header needs to be comma seperated? For now we just receive multiple Vary headers. I have to admit that this is not my overall expertise area on how the spec works on this. Maybe @TimWolla knows something about this? Fixing this by pushing them in an array is not possible since the use the header value as key. So it will cause sidefx all over. |
The API is fine, this is defined in RFC 7230#3.2.2:
and further
The If an array doesn't work, then concatenating them with a comma is fine according to the spec, but |
I am also facing issues with the Google API client. The following error is received by Guzzle when I perform batch requests.
It seems that problem is that Guzzle doesn't allow headers with break lines. |
Hi, I just stumbled upon this issue too. Is there any way we can work around this? |
Wait till a maintainer resolves the open pr i guess |
fixed in v2.12.2 |
Lately we have an issue with a batch request to GMail API that worked before. We get a list of all labels a user has in gmail with the first request, then we create a batch to get details for all labels.
Environment details
Steps to reproduce
users_labels->listUsersLabels('me')
users_labels->get()
after callingsetUseBatch
before.execute()
methodFurther details
In my opinion, there is an issue with the resulting header of the batch requests, and the parsing inside the PHP client.
Here is a snipped of a single batch result
There are multiple
Vary
header in the response compared to official docs where these headers are missing:https://developers.google.com/gmail/api/guides/batch#batch-example-response
Inside
src/Http/Batch.php
inparseRawHeaders
method these headers are combined using\n
.When debugging further, we get to
src/MessageTrait.php
and thetrimAndValidateHeaderValues
method.There is a line with
$this->assertValue($trimmed);
where inside there is a check for allowed characters and\n
seems not to be allowed.If we change the concat from
\n
to,
it would run.The text was updated successfully, but these errors were encountered: