-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #865: Add timeouts for Axum server in the Tracker API
9e42a1a feat: [#612] tower middleware to apply timeouts to requests (Jose Celano) 112b76d fix: [#612] add timeout for time waiting for the first API requests (Jose Celano) dadc216 chore(deps): add cargo dependencies needed for axum timeouts (Jose Celano) Pull request description: Add timeouts for Axum server in the Tracker API: 1. Timeout for the first request after opening the HTTP connection. [408 Request Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408). 2. HTTP1 header read timeout. Set a timeout for reading client request headers. If a client does not transmit the entire header within this time, the connection is closed. 3. HTTP2 keep alive timeout: Sets a timeout for receiving an acknowledgement of the keep-alive ping. If the ping is not acknowledged within the timeout, the connection will be closed. Does nothing if `http2_keep_alive_interval` is disabled. 4. HTTP2 keep alive interval: Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive. 5. [Tower middleware which applies a timeout to requests](https://docs.rs/tower-http/latest/tower_http/timeout/index.html). The current implementation for the first timeout does not send any message ([408 Request Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408)). [It seems is also common practice](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408). To test the first case, you can open a connection to the API without sending any request with: ```output telnet 127.0.0.1 1212 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. ``` After 5 seconds you will see: ```output Connection closed by foreign host. ``` For advance manual testing you can use: https://github.com/josecelano/axum-server-timeout ACKs for top commit: josecelano: ACK 9e42a1a Tree-SHA512: 08923b1f1d314a87c5c5fb3651219470fd48f6c6d9ce00f7dd802536b3eb9d44290f319ac8ef44a2f1a005bfab5d75abaf554c5b2241b1a86c6e2008b61894ab
- Loading branch information
Showing
7 changed files
with
310 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.