@@ 107-115 (lines=9) @@ | ||
104 | $uri = $request->getUri(); |
|
105 | ||
106 | if ($this->addHttps) { |
|
107 | if (strtolower($uri->getScheme()) !== 'https') { |
|
108 | $uri = $uri->withScheme('https')->withPort(443); |
|
109 | ||
110 | if ($this->redirectStatus !== false && (!$this->checkHttpsForward || ($request->getHeaderLine('X-Forwarded-Proto') !== 'https' && $request->getHeaderLine('X-Forwarded-Port') !== '443'))) { |
|
111 | return $this->getRedirectResponse($request, $uri, $response); |
|
112 | } |
|
113 | ||
114 | $request = $request->withUri($uri); |
|
115 | } |
|
116 | ||
117 | if (!empty($this->maxAge)) { |
|
118 | $response = $response->withHeader(self::HEADER, sprintf('max-age=%d%s', $this->maxAge, $this->includeSubdomains ? ';includeSubDomains' : '')); |
|
@@ 120-130 (lines=11) @@ | ||
117 | if (!empty($this->maxAge)) { |
|
118 | $response = $response->withHeader(self::HEADER, sprintf('max-age=%d%s', $this->maxAge, $this->includeSubdomains ? ';includeSubDomains' : '')); |
|
119 | } |
|
120 | } else { |
|
121 | if (strtolower($uri->getScheme()) !== 'http') { |
|
122 | $uri = $uri->withScheme('http')->withPort(80); |
|
123 | ||
124 | if ($this->redirectStatus !== false && (!$this->checkHttpsForward || ($request->getHeaderLine('X-Forwarded-Proto') !== 'http' && $request->getHeaderLine('X-Forwarded-Port') !== '80'))) { |
|
125 | return $this->getRedirectResponse($request, $uri, $response); |
|
126 | } |
|
127 | ||
128 | $request = $request->withUri($uri); |
|
129 | } |
|
130 | } |
|
131 | ||
132 | $response = $next($request, $response); |
|
133 |