Bug #84171
closed\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl() Request-Header format changed from array of strings to associative array in GuzzleHttp conversion
100%
Description
In TYPO3 8 the cURL based implementation \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl()
was replaced with GuzzleHttp in #70056.
This introduced a breaking change in how http headers are passed.
In the old implementation HTTP request headers where passed as an array of strings:
$url = 'https://typo3.org';
$requestHeaders = ['Accept: application/json', 'X-Foo: Bar', 'X-Foo: Baz'];
GeneralUtility::getUrl($url, 0, $requestHeaders);
In the new implementation the $requestHeaders
are passed through to guzzle as part of the headers
option, which wants the following format:
$url = 'https://typo3.org';
$requestHeaders = ['Accept' => 'application/json', 'X-Foo' => ['Bar', 'Baz']];
GeneralUtility::getUrl($url, 0, $requestHeaders);
Due to the different format code that uses GeneralUtility::getUrl()
and requires request headers breaks when upgrading from TYPO3 7 to 8 or 9.
I think this is a bug and not an intentional change, since all the changes made as part of #70056 try to emulate the old cURL behavior of getUrl()
.
Updated by Felix Buenemann over 6 years ago
- Related to Feature #70056: Use guzzle added
Updated by Wouter Wolters over 6 years ago
This breaking change is IMO intentional because that is the new format the Guzzle RequestFactory uses. The new implementation is described in the RST file in the patch how to use the new headers.
Updated by Gerrit Code Review over 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Felix Buenemann over 6 years ago
I proposed a change in Gerrit that restores compatibility with the old style without breaking the new style.
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Felix Buenemann over 6 years ago
Wouter Wolters: The bad thing is that this currently breaks code silently, no exception is thrown for code that uses the old list of headers format, but the headers will not be sent.
For example I was using it to do conditional GET requests with an If-None-Match
Header and after upgrading to 8.7 ist startet always fetching the full response, because the header was not correctly added.
So it would be great if someone could take a look at my Gerrit change that adds backwards compatibility.
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Gerrit Code Review over 6 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Gerrit Code Review over 6 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Gerrit Code Review over 6 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046
Updated by Gerrit Code Review over 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56149
Updated by Felix Buenemann over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 662fb9ae46a094b84d735aaebd0a3fef66b54f89.
Updated by Gerrit Code Review over 6 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56149
Updated by Felix Buenemann over 6 years ago
- Status changed from Under Review to Resolved
Applied in changeset 284411c14271eead0fb7a172bebcad83d713478f.