Skip to content

HTTP reason phrase is optional in RFC 7230 #23893

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

Closed
wants to merge 1 commit into from
Closed

HTTP reason phrase is optional in RFC 7230 #23893

wants to merge 1 commit into from

Conversation

ludovic-gasc
Copy link

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 (*)

  1. Setup a Spring Boot hello world project or any Java framework that uses Tomcat.
  2. Use Magento HTTP client to connect

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jul 25, 2019

Hi @GMLudo. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jul 25, 2019

CLA assistant check
All committers have signed the CLA.

@hostep
Copy link
Contributor

hostep commented Jul 25, 2019

@GMLudo: correct me if I'm wrong, but I think this was already fixed by #19143 & #19239

If we count the parts of HTTP/1.1 404 we have 2 parts, so this doesn't match with < 2, so you shouldn't see the error you are seeing right now.

What version of Magento are you targetting? According to what I'm seeing this issue was fixed in Magento 2.2.8 for the 2.2 release line & Magento 2.3.1 for the 2.3 release line.

@ludovic-gasc
Copy link
Author

Hi @hostep,

You have fully understand the situation, the HTTP client in Magento is already fixed, an upgrade is enough to fix the problem.

Thanks again for your time to give me the right pieces of information.

Kind regards

@m2-assistant
Copy link

m2-assistant bot commented Jul 26, 2019

Hi @GMLudo, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants