Skip to content

Commit df735ec

Browse files
bug #78 Fix populating default port and headers in HttpFoundationFactory (mleczakm)
This PR was merged into the 2.0-dev branch. Discussion ---------- Fix populating default port and headers in HttpFoundationFactory 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 symfony/psr-http-message-bridge#77 - setting default server port fixes error with interpreting no port defined in url as `0` Commits ------- 4f30401 Fix populating default port and headers in HttpFoundationFactory
2 parents 1309b64 + 4f30401 commit df735ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Factory/HttpFoundationFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed
4949

5050
if ($uri instanceof UriInterface) {
5151
$server['SERVER_NAME'] = $uri->getHost();
52-
$server['SERVER_PORT'] = $uri->getPort();
52+
$server['SERVER_PORT'] = $uri->getPort() ?: ('https' === $uri->getScheme() ? 443 : 80);
5353
$server['REQUEST_URI'] = $uri->getPath();
5454
$server['QUERY_STRING'] = $uri->getQuery();
5555

@@ -74,7 +74,7 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed
7474
$server,
7575
$streamed ? $psrRequest->getBody()->detach() : $psrRequest->getBody()->__toString()
7676
);
77-
$request->headers->replace($psrRequest->getHeaders());
77+
$request->headers->add($psrRequest->getHeaders());
7878

7979
return $request;
8080
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy