quiche: Unexpected http0.9 protocol when using cURL
👋 Hey There (Thanks for the great library!),
I seem to be running into something unexpected while testing quiche (through the C FFI), and using a locally built cURL. When using cURL I must specify the: --http0.9 option, but only when using my version (not the rust example).
In my C++ Code I run:
// _config has been initialized with: quiche_config_new(QUICHE_PROTOCOL_VERSION);
quiche_config_set_application_protos(
_config.get(),
const_cast<uint8_t *>(
reinterpret_cast<const uint8_t *>(QUICHE_H3_APPLICATION_PROTOCOL)),
sizeof(QUICHE_H3_APPLICATION_PROTOCOL) - 1);
The definition of: QUICHE_H3_APPLICATION_PROTOCOL comes from quiche.h, and seems to be properly set to: #define QUICHE_H3_APPLICATION_PROTOCOL "\x05h3-23", which is what I expect.
When I try to use cURL though I get:
* Trying ::1:8080...
* Sent QUIC client Initial, ALPN: h3-23
* quiche: recv() unexpectedly returned -1 (errno: 111, socket 3)
* connect to ::1 port 8080 failed: Connection refused
* Trying 127.0.0.1:8080...
* Sent QUIC client Initial, ALPN: h3-23
* h3 [:method: GET]
* h3 [:path: /]
* h3 [:scheme: https]
* h3 [:authority: localhost:8080]
* h3 [user-agent: curl/7.67.0-DEV]
* h3 [accept: */*]
* Using HTTP/3 Stream ID: 0 (easy handle 0x55e202f95280)
> GET / HTTP/3
> Host: localhost:8080
> user-agent: curl/7.67.0-DEV
> accept: */*
>
* Received HTTP/0.9 when not allowed
* Connection #0 to host localhost left intact
curl: (1) quiche: recv() unexpectedly returned -1 (errno: 111, socket 3)
This error goes away if I provide the: --http0.9 flag to cURL, and the request completes successfully.
When running the example http-server written in rust: ./target/debug/examples/http3-server --listen 0.0.0.0:8080 with cURL I am able to successfully query without providing the http0.9 flag:
./src/curl -k --tlsv1.3 --http3 https://localhost:8080/ && echo ""
Not Found!
(It should be noted while running the C example with: ./examples/http3-server 0.0.0.0 8080, I get a straight up failure).
I’m curious if this is the only place I call: quiche_config_set_application_protos, and it doesn’t (to the best of my knowledge) include http0.9, how is curl seeing this 0.9 data? Is there a config option I need to set when using the C API?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (9 by maintainers)
Thanks @SecurityInsanity, hopefully we can track down the root cause. Feel free to reopen this ticket if there is something in quiche that needs fixing up.
It completes successfully: https://gist.github.com/SecurityInsanity/aef83a89294b9bde509a78ca8556fd43