If a custom HttpHandler calls HttpExchange.sendResponseHeaders() followed by HttpExchange.close() without first calling HttpExchange.getRequestBody().readAllBytes(), an assertion error may occur:
java.lang.AssertionError
at jdk.httpserver/sun.net.httpserver.ServerImpl.responseCompleted(ServerImpl.java:805)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.handleEvent(ServerImpl.java:293)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:352)
at java.base/java.lang.Thread.run(Thread.java:844)
If assertions are not enabled, the server may close the channel even though keep-alive was requested, which may cause performance drops (or authentication failures for authentication scheme like NTLM/Negotiate where the server needs two trips authentication and expects the second message to come from the same channel).
java.lang.AssertionError
at jdk.httpserver/sun.net.httpserver.ServerImpl.responseCompleted(ServerImpl.java:805)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.handleEvent(ServerImpl.java:293)
at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:352)
at java.base/java.lang.Thread.run(Thread.java:844)
If assertions are not enabled, the server may close the channel even though keep-alive was requested, which may cause performance drops (or authentication failures for authentication scheme like NTLM/Negotiate where the server needs two trips authentication and expects the second message to come from the same channel).
- duplicates
-
JDK-7026262 HttpServer: improve handling of finished HTTP exchanges
- Closed