src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java
branchhttp-client-branch
changeset 56631 30b27fe75b0a
parent 56507 2294c51eae30
child 56682 9822bbe48b9b
equal deleted inserted replaced
56623:1d020b5d73f1 56631:30b27fe75b0a
    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")) {