Skip to content

Add timeout for time waiting for the first HTTP tracker request#866

Merged
josecelano merged 1 commit intotorrust:developfrom
josecelano:613-http-tracker-add-a-timeout-to-the-tls-handshake-waiting-for-headers-and-waiting-for-receiving-headers
May 15, 2024
Merged

Add timeout for time waiting for the first HTTP tracker request#866
josecelano merged 1 commit intotorrust:developfrom
josecelano:613-http-tracker-add-a-timeout-to-the-tls-handshake-waiting-for-headers-and-waiting-for-receiving-headers

Conversation

@josecelano
Copy link
Copy Markdown
Member

@josecelano josecelano commented May 15, 2024

This adds a timeout to the HTTP tracker for the time the server waits for the first request from the client after opening a new HTTP connection.

It also adds a tower middleware for timeouts in requests.

To test the first case, you can open a connection to the API without sending any request with:

telnet 127.0.0.1 7070
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

After 5 seconds you will see:

Connection closed by foreign host.

The current implementation for the first timeout does not send a 408 Request Timeout message. It seems it is also a common practice.

For advanced manual testing, you can use https://github.com/josecelano/axum-server-timeout

…acker

request

Adds a timeout to the HTTP tracker for the time the server waits for the
first request from the client after openning a new HTTP connection.

It also adds a tower middleware for timeouts in requests.
@josecelano josecelano self-assigned this May 15, 2024
@josecelano josecelano added Bug Incorrect Behavior Security Publicly Connected to Security labels May 15, 2024
@josecelano josecelano added this to the v3.0.0 milestone May 15, 2024
@josecelano
Copy link
Copy Markdown
Member Author

ACK 23d5e5e

@codecov
Copy link
Copy Markdown

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 78.88%. Comparing base (d0e66b7) to head (23d5e5e).

Files Patch % Lines
src/servers/http/server.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #866      +/-   ##
===========================================
+ Coverage    78.82%   78.88%   +0.05%     
===========================================
  Files          170      170              
  Lines         9398     9395       -3     
===========================================
+ Hits          7408     7411       +3     
+ Misses        1990     1984       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano josecelano merged commit 67e6cf1 into torrust:develop May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Incorrect Behavior Security Publicly Connected to Security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP Tracker: Add a timeout to the TLS handshake, waiting for headers, and waiting for receiving headers

1 participant