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

Set a timeout on the HTTP Protocol sniffer #11

Open
RoganDawes opened this issue May 25, 2020 · 0 comments
Open

Set a timeout on the HTTP Protocol sniffer #11

RoganDawes opened this issue May 25, 2020 · 0 comments

Comments

@RoganDawes
Copy link
Collaborator

If the protocol does not involve the client speaking first, the HTTP protocol sniffer will prevent progress, as it waits for enough characters to detect whether the protocol is in fact HTTP.
If there is a timeout on the handler, set when the handler is added to the channel, when the timeout fires it can be assumed that the protocol is not actually HTTP.
Note: This will fail to detect manually typed HTTP requests, unless the timeout is made large enough to allow the request to be typed out before the timeout fires. Making it too large, however, can negatively affect performance of the non-HTTP protocol. It would appear to be reasonable to use a short timeout (e.g. 1 second), because most browsers will send the request as soon as the connection is opened. It can be worked around for the manual case by using e.g. printf, etc.

See handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java for an example.

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

No branches or pull requests

1 participant