HTTP/1 stream should synchronise when updating the connection stream - see #3196

This commit is contained in:
Julien Viet
2019-11-15 11:46:47 +01:00
parent 8374efd9e9
commit c4fec42922

View File

@@ -301,18 +301,20 @@ class Http1xClientConnection extends Http1xConnectionBase<WebSocketImpl> impleme
@Override
public void writeHead(HttpMethod method, String rawMethod, String uri, MultiMap headers, String hostHeader, boolean chunked, ByteBuf buf, boolean end, StreamPriority priority, Handler<Void> contHandler, Handler<AsyncResult<Void>> handler) {
synchronized (conn) {
if (buf != null) {
bytesWritten += buf.readableBytes();
}
continueHandler = contHandler;
if (conn.responseInProgress == null) {
conn.responseInProgress = this;
} else {
conn.responseInProgress.append(this);
}
next = null;
}
HttpRequest request = conn.createRequest(method, rawMethod, uri, headers, hostHeader, chunked);
conn.sendRequest(request, buf, end, handler);
if (buf != null) {
bytesWritten += buf.readableBytes();
}
continueHandler = contHandler;
if (conn.responseInProgress == null) {
conn.responseInProgress = this;
} else {
conn.responseInProgress.append(this);
}
next = null;
}
private boolean handleChunk(Buffer buff) {