Skip to content

Conversation

R4R3D1FF
Copy link

@R4R3D1FF R4R3D1FF commented Sep 30, 2025

Adds an option for read and write timeout in the handler options, that is passed to the handler config and then to the spec. Finally, ServeHTTP function of the handler reads the timeout values from the spec and enforces them using ResponseController.

This prevents slow or malicious clients from using up resources as that specific stream for the HTTP2 connection can be closed.

Deals with the following issue
#879

@R4R3D1FF R4R3D1FF force-pushed the service-handler-timeout branch from decd22f to b865468 Compare October 3, 2025 19:03
@R4R3D1FF R4R3D1FF marked this pull request as ready for review October 3, 2025 19:05
Copy link
Contributor

@emcfarlane emcfarlane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I will bring up with the other maintainers to discuss the usability side. For the PR we need to complete testing and documentation.

return &interceptorsOption{interceptors}
}

func WithReadTimeout(value time.Duration) HandlerOption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation comment is required for exported methods.

return &readTimeoutOption{value: value}
}

func WithWriteTimeout(value time.Duration) HandlerOption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Co-authored-by: Edward McFarlane <[email protected]>
Signed-off-by: R4R3D1FF <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants