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

do not ignore data received immediately after switching to raw #340

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chilikk
Copy link

@chilikk chilikk commented Jul 9, 2024

When an HTTP connection is upgraded to raw it may happen that the body/the data belonging to the raw connection arrives in the same message as HTTP response and headers from the TCP socket. This change fixes the bug where such data has been dropped. With this fix the data following the HTTP response is forwarded to the gun_raw handler.

@essen
Copy link
Member

essen commented Jul 9, 2024

Hello!

Probably better to change the switch_protocol tuple to have the data? All other switch_protocol can be updated to have <<>> by default and do nothing.

@chilikk chilikk force-pushed the denys/fix-raw-data branch from bf87ff6 to 764fb10 Compare July 10, 2024 13:37
@chilikk
Copy link
Author

chilikk commented Jul 10, 2024

Changed according to your suggestion. I'm not exactly sure how to handle all switch_protocol: the same handling could possibly apply to gun_http:handle_connect case, but I'm unsure what would be the scenario and how to test it, so I didn't change. Also, in gun_tunnel I don't handle any other case than <<>>, because my understanding is that gun_tunnel is only used from HTTP/2 and this situation would not be possible there due to the framing mechanism.

@essen essen added this to the 2.2.0 milestone Jan 15, 2025
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