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

HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 21
    • None
    • core-libs
    • b23
    • Verified

    Description

      When using HTTP/1.1, if a BodyPublisher reports an unknown length (-1), the HttpClient will send the request body in Chunked mode. If the publisher publishes an empty byte buffer, the client will generate an empty chunk, which the server will interpret as the end of the request body. Sending an empty chunk can never be valid, unless it's the last body chunk and marks the end of the body.

      A new subclass of AbstractNoBody.java could be created to check this scenario. While at it, the tests java/net/httpclient/NoBodyPartOne.java and java/net/httpclient/NoBodyPartTwo.java create a lot of clients and could also make use of HttpClient::close.

      Attachments

        Issue Links

          Activity

            People

              dfuchs Daniel Fuchs
              dfuchs Daniel Fuchs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: