-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Version
0.14 (and master-branch 2021-11-30)
Platform
Darwin C02Y72T1JGH5 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Description
I have a service built with Hyper that I'm now trying to communicate with from a client written in Java. I noticed when doing this that Java's standard HttpClient sends 100-continue expectations as Expect: 100-Continue
(https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java#L408), whereas Hyper compares the expectation header value against 100-continue
(case-sensitive) (
Line 274 in 5f938ff
expect_continue = value.as_bytes() == b"100-continue"; |
100 Continue
from the Rust service, which makes it seemingly unable to handle the response correctly. https://datatracker.ietf.org/doc/html/rfc2616#section-14.20 seems to state that the capitalisation of the 100-continue
token should not matter from the server's perspective:
Comparison of expectation values is case-insensitive for unquoted
tokens (including the 100-continue token), and is case-sensitive for
quoted-string expectation-extensions.
Trying this:
changing the expect_continue_sends_100
test to send the request expectation with an upper-case C
.
diff --git a/tests/server.rs b/tests/server.rs
index 13530a36..0b991337 100644
--- a/tests/server.rs
+++ b/tests/server.rs
@@ -808,7 +808,7 @@ fn expect_continue_sends_100() {
b"\
POST /foo HTTP/1.1\r\n\
Host: example.domain\r\n\
- Expect: 100-continue\r\n\
+ Expect: 100-Continue\r\n\
Content-Length: 5\r\n\
Connection: Close\r\n\
\r\n\
and running cargo test --features full expect_continue_sends_100
I expect to see this happen:
test passes
Instead, this happens:
The test fails with:
---- expect_continue_sends_100 stdout ----
thread 'expect_continue_sends_100' panicked at 'read 1: Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" }', tests/server.rs:821:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace