Issue #6642 - never shutdown output after generating a request.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-08-26 13:09:36 +10:00
parent cb9a8d4060
commit fa316fc20d
1 changed files with 7 additions and 10 deletions

View File

@ -346,17 +346,14 @@ public class HttpGenerator
}
_state = State.END;
// If this is an upgrade then we don't want to close the connection.
if (_info.isResponse() && ((MetaData.Response)_info).getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101)
{
// If this is a request, don't close the connection until the server responds.
if (_info.isRequest())
return Result.DONE;
}
else if (_info.isRequest())
{
HttpField connectionHeader = _info.getFields().getField(HttpHeader.CONNECTION);
if (connectionHeader != null && connectionHeader.contains(HttpHeaderValue.UPGRADE.asString()))
return Result.DONE;
}
// If successfully upgraded it is responsibility of the next protocol to close the connection.
if (_info.isResponse() && ((MetaData.Response)_info).getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101)
return Result.DONE;
return Boolean.TRUE.equals(_persistent) ? Result.DONE : Result.SHUTDOWN_OUT;
}