-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
11
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When the HttpServer class is dealing with a POST request, even when a responseLength of -1 is passed to the sendResponseHeaders method (in HttpExchange) the output stream of the response body must still be accessed and closed (even though it is not being written to). If this is not done then there is an assertion error when the client tries to access the response and a response code of 400 is returned. Getting the output stream of the repsonse body should not be required because a responseLength of -1 indicates that no response body is being returned. When dealing with GET requests HttpServer, appropriately, does not requrie the output stream of the response body to be obtained.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set up HttpServer and HttpClient
Send a POST request from the client to the server and have the server send -1 as the response length and not obtain the output stream of the response body. Also send 200 as response code.
Access the response on the client side (noting the assertion error) and examine the response code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A response code of 200 and no assertion error
ACTUAL -
A response code of 400 and assertion error
CUSTOMER SUBMITTED WORKAROUND :
Get the output stream of the response body and close it
When the HttpServer class is dealing with a POST request, even when a responseLength of -1 is passed to the sendResponseHeaders method (in HttpExchange) the output stream of the response body must still be accessed and closed (even though it is not being written to). If this is not done then there is an assertion error when the client tries to access the response and a response code of 400 is returned. Getting the output stream of the repsonse body should not be required because a responseLength of -1 indicates that no response body is being returned. When dealing with GET requests HttpServer, appropriately, does not requrie the output stream of the response body to be obtained.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set up HttpServer and HttpClient
Send a POST request from the client to the server and have the server send -1 as the response length and not obtain the output stream of the response body. Also send 200 as response code.
Access the response on the client side (noting the assertion error) and examine the response code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A response code of 200 and no assertion error
ACTUAL -
A response code of 400 and assertion error
CUSTOMER SUBMITTED WORKAROUND :
Get the output stream of the response body and close it
- duplicates
-
JDK-8205684 HttpClient PUT request fails with EOF after several successful attempts
-
- Closed
-
- relates to
-
JDK-8205684 HttpClient PUT request fails with EOF after several successful attempts
-
- Closed
-