Skip to content

Fix populating default port and headers in HttpFoundationFactory #78

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

Merged
merged 1 commit into from
Jun 25, 2020
Merged

Conversation

mleczakm
Copy link

These are few dirty hacks which are required to get symfony up and running as Roadrunner psr7 worker:

  • overriding headers need to be removed to be able to send basic auth headers.
  • setting $_SERVER['https'] to true is required for properly handling non-proxied requests, handled with encryption directly from Roadrunner - same as fix conversion for https requests #77
  • setting default server port fixes error with interpreting no port defined in url as 0

@nicolas-grekas
Copy link
Member

Hi, thanks for the PR. Can you please squash your commits and fix CI reports?

@@ -70,7 +74,6 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed
$server,
$streamed ? $psrRequest->getBody()->detach() : $psrRequest->getBody()->__toString()
);
$request->headers->replace($psrRequest->getHeaders());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can the created request know about the headers of the psr one if we remove this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are already parsed few lines above. Without this line removed there is no way to use basic auth with Symfony - header is parsed during request object creation few lines above and then parsed user/password values are being overriden here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the line and replaced "replace()" by "add()". This should provide better compat.

@nicolas-grekas nicolas-grekas changed the title Fix https, default port and headers (for example with basic auth) override Fix default port and headers (for example with basic auth) override Jun 25, 2020
@nicolas-grekas nicolas-grekas changed the title Fix default port and headers (for example with basic auth) override Fix populating default port and headers in HttpFoundationFactory Jun 25, 2020
@nicolas-grekas
Copy link
Member

Thank you @mleczakm.

@nicolas-grekas nicolas-grekas merged commit df735ec into symfony:master Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants