Skip to content

Commit

Permalink
Align HTTP/2 with AJP and HTTP/1.1 and commit the response before any…
Browse files Browse the repository at this point in the history
… body data is written to OutputBuffer

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1750776 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Jun 30, 2016
1 parent df3d6f3 commit 8dfd057
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions java/org/apache/coyote/http2/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@ public synchronized int doWrite(ByteChunk chunk) throws IOException {
throw new IllegalStateException(
sm.getString("stream.closed", getConnectionId(), getIdentifier()));
}
if (!coyoteResponse.isCommitted()) {
coyoteResponse.sendHeaders();
}
int len = chunk.getLength();
int offset = 0;
while (len > 0) {
Expand Down Expand Up @@ -497,9 +500,6 @@ private synchronized boolean flush(boolean writeInProgress, boolean block)
getIdentifier(), Integer.toString(buffer.position()),
Boolean.toString(writeInProgress), Boolean.toString(closed)));
}
if (!coyoteResponse.isCommitted()) {
coyoteResponse.sendHeaders();
}
if (buffer.position() == 0) {
if (closed && !endOfStreamSent) {
// Handling this special case here is simpler than trying
Expand Down

0 comments on commit 8dfd057

Please sign in to comment.