Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/org/apache/coyote/http2/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ public final void emitHeader(String name, String value) throws HpackException {
break;
}
default: {
if ("expect".equals(name) && "100-continue".equals(value)) {
if ("expect".equals(name) && "100-continue".equalsIgnoreCase(value)) {
coyoteRequest.setExpectation(true);
}
if (pseudoHeader) {
Expand Down
11 changes: 9 additions & 2 deletions test/org/apache/coyote/http2/Http2TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPay
protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload, boolean useExpectation,
String contentType, long contentLength, String path, byte[] dataFrameHeader, ByteBuffer dataPayload,
byte[] padding, boolean withTrailers, int streamId) {
buildPostRequest(headersFrameHeader, headersPayload, useExpectation ? "100-continue" : null, contentType,
contentLength, path, dataFrameHeader, dataPayload, padding, withTrailers, streamId);
}

protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPayload, String expectation,
String contentType, long contentLength, String path, byte[] dataFrameHeader, ByteBuffer dataPayload,
byte[] padding, boolean withTrailers, int streamId) {

MimeHeaders headers = new MimeHeaders();
headers.addValue(":method").setString(Method.POST);
Expand All @@ -393,8 +400,8 @@ protected void buildPostRequest(byte[] headersFrameHeader, ByteBuffer headersPay
}
headers.addValue(":path").setString(path);
headers.addValue(":authority").setString("localhost:" + getPort());
if (useExpectation) {
headers.addValue("expect").setString("100-continue");
if (expectation != null) {
headers.addValue("expect").setString(expectation);
}
if (contentType != null) {
headers.addValue("content-type").setString(contentType);
Expand Down
16 changes: 14 additions & 2 deletions test/org/apache/coyote/http2/TestHttp2Section_8_1.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ public void setContinueHandlingResponsePolicy(ContinueResponseTiming policy) thr

@Test
public void testSendAck() throws Exception {
doTestSendAck("100-continue");
}


@Test
public void testSendAckMixedCase() throws Exception {
// RFC 9110, section 10.1.1: the Expect field value is case-insensitive
doTestSendAck("100-Continue");
}


private void doTestSendAck(String expectation) throws Exception {
// makes a request that expects a 100 Continue response and verifies
// that the 100 Continue response is received. This does not check
// that the correct ContinueHandlingResponsePolicy was followed, just
Expand All @@ -167,8 +179,8 @@ public void testSendAck() throws Exception {
byte[] dataFrameHeader = new byte[9];
ByteBuffer dataPayload = ByteBuffer.allocate(256);

buildPostRequest(headersFrameHeader, headersPayload, true, null, -1, "/simple", dataFrameHeader, dataPayload,
null, false, 3);
buildPostRequest(headersFrameHeader, headersPayload, expectation, null, -1, "/simple", dataFrameHeader,
dataPayload, null, false, 3);

// Write the headers
writeFrame(headersFrameHeader, headersPayload);
Expand Down
7 changes: 7 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@
that is in asynchronous mode are released if the connection thread
raises a stream error for that stream. (markt)
</fix>
<fix>
Treat the value of the <code>Expect</code> header as case insensitive
for HTTP/2 requests, as required by RFC 9110, section 10.1.1, so that a
<code>100 (Continue)</code> response is sent for
<code>Expect: 100-Continue</code>. Pull request <pr>1263</pr> provided
by Arturo Bernal.
</fix>
</changelog>
</subsection>
<subsection name="Jasper">
Expand Down
Loading