Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-372

ChunkedInputStream and ChunkDecoder allows closing chunk absence

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.4-alpha1
    • HttpCore, HttpCore NIO
    • None

    Description

      I've found that both these classes treats chunked streams without closing chunk as complete streams without any errors. This contradicts RFC2616 ยง3.6.1

      Consider the following scenario:

      1. HttpClient sends request to Server
      2. Server accepts request and send response headers with Transfer-Encoding: chunked
      3. Server sends first chunk completely and dies with segfault before sending the next chunk
      4. HttpClient receives response headers and creates ChunkedInputStream
      5. ChunkedInputStream reads this first chunk and encounters eof

      Expected result:
      IOException thrown indicating incomplete response

      Actual result:
      No exception is thrown, -1 is returned on the next read and nobody knows that response is incomplete.

      Attachments

        1. expect-closing-chunk-v2.patch
          5 kB
          Dmitry Potapov
        2. expect-closing-chunk.patch
          5 kB
          Dmitry Potapov

        Activity

          People

            Unassigned Unassigned
            hirthwork Dmitry Potapov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: