@@ 62-72 (lines=11) @@ | ||
59 | $headers['x-encoded-content-encoding'] |
|
60 | = $headers[$normalizedKeys['content-encoding']]; |
|
61 | unset($headers[$normalizedKeys['content-encoding']]); |
|
62 | if (isset($normalizedKeys['content-length'])) { |
|
63 | $headers['x-encoded-content-length'] |
|
64 | = $headers[$normalizedKeys['content-length']]; |
|
65 | ||
66 | $bodyLength = (int) $this->sink->getSize(); |
|
67 | if ($bodyLength) { |
|
68 | $headers[$normalizedKeys['content-length']] = $bodyLength; |
|
69 | } else { |
|
70 | unset($headers[$normalizedKeys['content-length']]); |
|
71 | } |
|
72 | } |
|
73 | } |
|
74 | ||
75 | // Attach a response to the easy handle with the parsed headers. |
@@ 172-182 (lines=11) @@ | ||
169 | // Remove content-encoding header |
|
170 | unset($headers[$normalizedKeys['content-encoding']]); |
|
171 | // Fix content-length header |
|
172 | if (isset($normalizedKeys['content-length'])) { |
|
173 | $headers['x-encoded-content-length'] |
|
174 | = $headers[$normalizedKeys['content-length']]; |
|
175 | ||
176 | $length = (int) $stream->getSize(); |
|
177 | if ($length === 0) { |
|
178 | unset($headers[$normalizedKeys['content-length']]); |
|
179 | } else { |
|
180 | $headers[$normalizedKeys['content-length']] = [$length]; |
|
181 | } |
|
182 | } |
|
183 | } |
|
184 | } |
|
185 | } |