Files
quiche/.semgrepignore
Evan Rittenhouse b5333de362 tokio-quiche: add an example asynchronous HTTP/3 server
This adds a basic, asynchronous version of an HTTP/3 server powered by
tokio-quiche. This is **strictly for example purposes**, and should not
be used for production traffic. Among other things, it doesn't even
support POST requests at the moment.

The server will return a simple 200 response code for the majority of
requests. However, if the request's path is `/stream-bytes/<XX>`, it
will return a response with `XX` `W`s in the body. By default, it works
with the certs at `tokio-quiche/examples` which cover `test.com` (copied
from `quiche/src/bin/examples`)[1].

The server can be ran with:

```shell
cargo run --example async_http3_server -- -a <address>
```

So, as an example, we can test it like so:

1. Run the server in Terminal 1:

```shell
cargo run --example async_http3_server -- -a 127.0.0.1:5757
```

2. Hit the server in Terminal 2:

```shell
❮ curl https://test.com --http3 -vk --connect-to ::127.0.0.1:5757
* Connecting to hostname: 127.0.0.1
* Connecting to port: 5757
*   Trying 127.0.0.1:5757...
* Server certificate:
*  subject: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd; CN=quic.tech
*  start date: Sep 30 22:11:48 2018 GMT
*  expire date: Sep 30 22:11:48 2019 GMT
*  issuer: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd; CN=quic.tech
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
* Connected to 127.0.0.1 (127.0.0.1) port 5757
* using HTTP/3
* [HTTP/3] [0] OPENED stream for https://test.com/
* [HTTP/3] [0] [:method: GET]
* [HTTP/3] [0] [:scheme: https]
* [HTTP/3] [0] [:authority: test.com]
* [HTTP/3] [0] [:path: /]
* [HTTP/3] [0] [user-agent: curl/8.10.2-DEV]
* [HTTP/3] [0] [accept: */*]
> GET / HTTP/3
> Host: test.com
> User-Agent: curl/8.10.2-DEV
> Accept: */*
>
* Request completely sent off
< HTTP/3 200
```

3. Hit the `/stream-bytes` endpoint:

```shell
❯ curl https://test.com/stream-bytes/57 --http3 -vk --connect-to ::127.0.0.1:5757
* Connecting to hostname: 127.0.0.1
* Connecting to port: 5757
*   Trying 127.0.0.1:5757...
* Server certificate:
*  subject: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd; CN=quic.tech
*  start date: Sep 30 22:11:48 2018 GMT
*  expire date: Sep 30 22:11:48 2019 GMT
*  issuer: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd; CN=quic.tech
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
* Connected to 127.0.0.1 (127.0.0.1) port 5757
* using HTTP/3
* [HTTP/3] [0] OPENED stream for https://test.com/stream-bytes/57
* [HTTP/3] [0] [:method: GET]
* [HTTP/3] [0] [:scheme: https]
* [HTTP/3] [0] [:authority: test.com]
* [HTTP/3] [0] [:path: /stream-bytes/57]
* [HTTP/3] [0] [user-agent: curl/8.10.2-DEV]
* [HTTP/3] [0] [accept: */*]
> GET /stream-bytes/57 HTTP/3
> Host: test.com
> User-Agent: curl/8.10.2-DEV
> Accept: */*
>
* Request completely sent off
< HTTP/3 200
<
* Connection #0 to host 127.0.0.1 left intact
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW⏎
```

[1]:
```shell
quiche on  evanrittenhouse/async-server [ *1 ]
❯ openssl x509 -in ./tokio-quiche/examples/cert.crt -text -noout > tq.cert

…che on  evanrittenhouse/async-server [ ?1 *1 ]
❮ openssl x509 -in ./apps/src/bin/cert.crt -text -noout > apps.cert

…che on  evanrittenhouse/async-server [ ?2 *1 ]
❯ diff tq.cert apps.cert
```
2025-07-08 10:40:45 -05:00

5 lines
56 B
Plaintext

/apps/
/fuzz/
/quiche/examples/
/tokio-quiche/examples/