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

HttpRequest.BodyPublishers.ofInputStream treats IOException as EOF

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The implementation of `HttpRequest.BodyPublishers.ofInputStream` treats IOException as EOF.

      This is questionable as any exception thrown by InputStream::read is swallowed and the request body gets potentially truncated.

      Of course by the time the exception is thrown the request headers have already been sent and part of the message body may have already been sent too, so there's no real means to cancel the request (except maybe in HTTP/2 by resetting the stream?), but not returning any error to the caller (via the completable future) seems wrong.
      Completing the subscriber with `onError` would probably be the right thing to do at this point.

        Attachments

          Activity

            People

            • Assignee:
              dfuchs Daniel Fuchs
              Reporter:
              dfuchs Daniel Fuchs
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: