equal
deleted
inserted
replaced
45 import jdk.internal.net.http.common.MinimalFuture; |
45 import jdk.internal.net.http.common.MinimalFuture; |
46 import jdk.internal.net.http.common.Utils; |
46 import jdk.internal.net.http.common.Utils; |
47 |
47 |
48 import static java.net.http.HttpClient.Version.HTTP_1_1; |
48 import static java.net.http.HttpClient.Version.HTTP_1_1; |
49 import static java.net.http.HttpResponse.BodySubscribers.discarding; |
49 import static java.net.http.HttpResponse.BodySubscribers.discarding; |
|
50 import static java.net.HttpURLConnection.HTTP_NOT_MODIFIED; |
50 |
51 |
51 /** |
52 /** |
52 * Handles a HTTP/1.1 response (headers + body). |
53 * Handles a HTTP/1.1 response (headers + body). |
53 * There can be more than one of these per Http exchange. |
54 * There can be more than one of these per Http exchange. |
54 */ |
55 */ |
205 synchronized boolean finished() { |
206 synchronized boolean finished() { |
206 return finished; |
207 return finished; |
207 } |
208 } |
208 |
209 |
209 int fixupContentLen(int clen) { |
210 int fixupContentLen(int clen) { |
210 if (request.method().equalsIgnoreCase("HEAD")) { |
211 if (request.method().equalsIgnoreCase("HEAD") || responseCode == HTTP_NOT_MODIFIED) { |
211 return 0; |
212 return 0; |
212 } |
213 } |
213 if (clen == -1) { |
214 if (clen == -1) { |
214 if (headers.firstValue("Transfer-encoding").orElse("") |
215 if (headers.firstValue("Transfer-encoding").orElse("") |
215 .equalsIgnoreCase("chunked")) { |
216 .equalsIgnoreCase("chunked")) { |