Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8203433

(httpclient) Add tests for HEAD and 304 responses.

XMLWordPrintable

      From RFC 7230:

      ```A server MAY send a Content-Length header field in a response to a
         HEAD request (Section 4.3.2 of [RFC7231]); a server MUST NOT send
         Content-Length in such a response unless its field-value equals the
         decimal number of octets that would have been sent in the payload
         body of a response if the same request had used the GET method.```

      ```A server MAY send a Content-Length header field in a 304 (Not
         Modified) response to a conditional GET request (Section 4.1 of
         [RFC7232]); a server MUST NOT send Content-Length in such a response
         unless its field-value equals the decimal number of octets that would
         have been sent in the payload body of a 200 (OK) response to the same
         request.```

      ```Transfer-Encoding MAY be sent in a response to a HEAD request or in a
         304 (Not Modified) response (Section 4.1 of [RFC7232]) to a GET
         request, neither of which includes a message body, to indicate that
         the origin server would have applied a transfer coding to the message
         body if the request had been an unconditional GET. This indication
         is not required, however, because any recipient on the response chain
         (including the origin server) can remove transfer codings when they
         are not needed.```

            michaelm Michael McMahon
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: