hasHeader('host')) { // Though servers are supposed to be able to handle standard port names on the end of the // Host header some fail to do this correctly. Thankfully PSR-7 recommends to strip the port // if it is the standard port for the given scheme. $request->setHeader('host', $request->getUri()->withUserInfo('')->getAuthority()); } self::normalizeRequestBodyHeaders($request); // Always normalize this as last item, because we need to strip sensitive headers self::normalizeTraceRequest($request); return $request; } /** * @throws HttpException */ private static function normalizeRequestBodyHeaders(Request $request): void { $body = $request->getBody(); $contentType = $body->getContentType(); if ($contentType !== null) { $previousContentType = $request->getHeaderArray('content-type'); if ($previousContentType !== [] && $previousContentType !== [$contentType]) { throw new HttpException('Conflicting content type headers in request and request body: ' . \implode(', ', $previousContentType) . ' / ' . $contentType); } $request->setHeader('content-type', $contentType); } if ($request->hasHeader("transfer-encoding")) { $request->removeHeader("content-length"); return; } $contentLength = $body->getContentLength(); if ($contentLength === 0 && \in_array($request->getMethod(), ["CONNECT", "GET", "HEAD", "OPTIONS", "CONNECT", "TRACE"], true)) { $request->removeHeader('content-length'); $request->removeHeader('transfer-encoding'); } elseif ($contentLength !== null) { $request->setHeader('content-length', (string) $contentLength); $request->removeHeader('transfer-encoding'); } else { $request->removeHeader('content-length'); $request->setHeader("transfer-encoding", "chunked"); } } private static function normalizeTraceRequest(Request $request): void { if ($request->getMethod() !== 'TRACE') { return; } // https://tools.ietf.org/html/rfc7231#section-4.3.8 $request->setBody(''); // Remove all body and sensitive headers $request->replaceHeaders([ "transfer-encoding" => [], "content-length" => [], "authorization" => [], "proxy-authorization" => [], "cookie" => [], ]); } } __halt_compiler();----SIGNATURE:----dY+63DaO4HS1/lhya/nuv5FLdj6VaCqE5ROqkm5eOzg9gBiOp3hFGfvFiKgQhAj27CswPfwKxin8T8atmIV2DU2MqExGWSyyJflBmqBeKFqmfsTmAX50pkPcB5T2IfJer2eHPxT2TM3rPsVfaudElrPW8D6f9GOLLFvimBz7dRHOnKD6SYJ9ZzSyBv7qg0J4JPtIjouIsPLKfBjkEmQ3AgbQoLl7s5B0b9jEsWeTiIP0B6TTi01rjYod6T1e/3TVlUVCg1uvUW1zwvpj64t7rN2dhO/5nweGjEGpSvbny+GAnYGbbRqB5pwKVb1vLI+ne2rjaWQwp4p0MTyDAY2d1mAP1aXCJmKBgl9LuQQUXoQIcd/UFIg/UsxOWJYykTBkbhTFL5vkIMFQ/nkSZAB4e06Swj0Ku1LOXpthBqiKA54gFyg7SQM+LSJb/YIdF735nDs7gskA07Mp+SFKe00g/6M3TBCvpXacCbYilyZJmvmP73geFXkBy8f9qrk+qWFlN8zcjf7+e9mVkLrej63balC2+u/xRxOsY9fxvTOjPXn6jyCI+mffVgvjQbWcqRFEBPep3DKQz6ttXVlOywLEUFXq8Us74oiMUPgE6zgcCoJPEXkLQic0thI3Vw2XG5e/haJvrIlZYcaNOXBhJps1S6PCqmTB29+JNk/d0gwR8U0=----ATTACHMENT:----Mjk3Njk2MTkwNTMxMjgyOCA2MDI5MjM1MTA4MDgxNjA1IDg0MTgwOTQyMDY4OTc3MTA=