-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix proto header for the case when the header is the last part of the… #294
Conversation
} else { | ||
headerEnd = valueStart + lineEnd | ||
if payload[headerEnd-1] == '\r' { | ||
headerEnd -= 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should replace headerEnd -= 1 with headerEnd--
Thank you! Can you add a test for this case? |
HTTP protocol says that requests without body should end with \r\n anyway. If you experience such bug, can you tell the http server / tool generating such HTTP requests? |
The issue I hit is when I first use gor to collect traffic into a file, then repay the file toward a box: 1 e1efa3e43e16d9c20bda986baef9b40f23c47e7b 1463501171780734926 But the same request was not like this in another log file. So it looks like the tool got some partial data when collecting... |
test case added! Sorry for the late reply! I was bound to something else! Will try to be more responsive! |
I have the feeling that you are trying to fix the wrong issue. Instead, it's better to understand why it happens. Is there any chance you can give me file recorded by Gor? Does it happens for all your requests, or it is the rare issue? Is there any correlation? For example, if we find out that for some requests Gor captures only partial request, it's better to not replay it at all, and add some checks that ensure request integrity. Thanks! |
Yeah, I agree that the right fix would be check the integrity of the request while replying. |
HI Buger, I updated the code and test case. It will skip the invalid head. It's similar as the header is not found. Could you please approve the pull request or tell me what to improve? The tool panics more often as we move to replay human traffic. The first day we replay human traffic it panicked due to this issue.. |
Sorry for the long delay! I implemented proper request validation #317 Here are binaries: |
fix proto header for the case when the header is the last part of the payload