HTTP reason phrase is optional in RFC 7230 #23893
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (*)
When we use a HTTP server that uses a version of Tomcat 8.5+ with the HTTP client of Magento, we have this error: Invalid response line returned from server in Magento logs.
It's because since Tomcat 8.5, they have removed the reason phrase, as you can read in the Tomcat changelog: RFC 7230 states that clients should ignore reason phrases in HTTP/1.1 response messages. Since the reason phrase is optional, Tomcat no longer sends it.
In RFC 7230, you can read this:
Reason-Phrase = *<TEXT, excluding CR, LF>
The * means zero or more.
Concretely, instead to have this HTTP response from Tomcat:
HTTP/1.1 404 Not Found
You have:
HTTP/1.1 404
Another bug report from Spring boot project where you can find more explanations: spring-projects/spring-boot#6548
In the Magento source code, I don't see an usage of
$line[2]
.To my actual understanding, it might be enough to not check if the third element in the array is present.
Manual testing scenarios (*)
Contribution checklist (*)