Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

josecelano
Copy link
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
Member Author

ACK 23d5e5e

Copy link

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
17 checks passed
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