You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixing issue with content-length and compression where the length was being sent back but was incorrect. This now chunks when compression is handled inline and not by the HTTPHandler.
// +++++++++++ Step 1: Determine the extra headers first and add them +++++++++++
182
+
// +++++++++++ Step 1: Determine if there is content and set up the compression, encoding, chunking, and length headers +++++++++++
183
183
booleantwoOhFour = response.getStatus() == 204;
184
+
booleangzip = false;
185
+
booleandeflate = false;
184
186
booleanchunked = false;
185
-
if (response.getContentLength() == null && !twoOhFour) { // 204 status is specifically "No Content" so we shouldn't write the transfer-encoding header if the status is 204
// If the output stream is closing, but nothing has been written yet, we can safely set the Content-Length header to 0 to let the client
191
189
// know nothing more is coming beyond the preamble
192
190
if (closing && !twoOhFour) { // 204 status is specifically "No Content" so we shouldn't write the content-length header if the status is 204
193
191
response.setContentLength(0L);
194
-
}
195
-
196
-
booleangzip = false;
197
-
booleandeflate = false;
198
-
if (compress && !twoOhFour) { // 204 status is specifically "No Content" so we shouldn't write the content-encoding and vary headers if the status is 204
199
-
for (Stringencoding : acceptEncodings) {
200
-
if (encoding.equalsIgnoreCase(ContentEncodings.Gzip)) {
response.removeHeader(Headers.ContentLength); // Compression will change the length, so we'll chunk instead
206
+
deflate = true;
207
+
break;
208
+
}
210
209
}
211
210
}
211
+
212
+
if (response.getContentLength() == null && !twoOhFour) { // 204 status is specifically "No Content" so we shouldn't write the transfer-encoding header if the status is 204
0 commit comments