-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
None
-
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.
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.
- duplicates
-
JDK-8257736 InputStream from BodyPublishers.ofInputStream() leaks when IOE happens
-
- Resolved
-