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

HttpRequest.BodyPublishers.ofInputStream treats IOException as EOF

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • generic
    • generic

      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.

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

              Created:
              Updated:
              Resolved: