-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
http inspector:inline the recv in the onAccept #8111
Conversation
Signed-off-by: Yuchen Dai <[email protected]>
CC initial author @yxue |
To reviewer: the wrong spelling is intended |
@yxue would be great if you could take a first pass on this review, thanks. |
Sure! I was reviewing and should finish the first pass earlier tomorrow. |
source/extensions/filters/listener/http_inspector/http_inspector.h
Outdated
Show resolved
Hide resolved
socket.ioHandle().fd(), | ||
[this](uint32_t events) { | ||
if (events & Event::FileReadyType::Closed) { | ||
config_->stats().read_error_.inc(); |
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.
Do we need to increase the read_error_
here?
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.
That's a great point! I found out Closed
actually means the client send FIN. It is probably not an error.
According to the above observation the latest commit allow http inspector to finalize the parse. Please review!
source/extensions/filters/listener/http_inspector/http_inspector.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Yuchen Dai <[email protected]>
Update the description |
@lambdai fix format? |
@lizan double checked the format is the spelling in string literal and it is intended. Do you known any annotation so that we can skip the check in certain line? |
@jmarantz any idea above? |
Gentle ping @jmarantz |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
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.
The blocker on this is this error from the pedantic checker:
check_spelling_pedantic...
./test/extensions/filters/listener/http_inspector/http_inspector_test.cc:457: const absl::string_view data = "GET /index HTT\r";
Checked 2284 file(s) and 59998 comment(s), found 1 error(s).
ERROR: spell check failed. Run 'tools/check_spelling_pedantic.py fix and/or add new words to tools/spelling_dictionary.txt'
for the record I did not create the pedantic spell checker (even though I am pedantic in other things) and find it annoying though I also see the value.
Suggestions for solutions:
- Find a way in the pedantic checker to allow for a
// NOPEDANTIC
escape on the line in question, or similar. This is IMO the best option as it saves a ton of annoyance for others later. - This test on line 457 looking for
"GET /index HTT\r
looks kind of broken. Is it meant to be that way? Fix it by changingHTT
toHTTP/1.1
or similar? - If you really need to send that string you could maybe octal-escape the "HTT" part?
I realize also you didn't even change that part of the code but are being dinged because you are editing a file that probably predated the pedantic spell checker. Not sure what to say..
typos and fix spelling Signed-off-by: Yuchen Dai <[email protected]>
/retest ci/circleci: asan |
🔨 rebuilding |
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.
this last change to side-step the pedantic check LGTM.
Please try to avoid force-pushing in the future though as it removes comment history from the PR review process. Just do normal pushes.
const absl::string_view data = "GET /index HTT\r"; | ||
const std::string valid_header = "GET /index HTTP/1.1\r"; | ||
// offset: 0 10 | ||
const std::string truncate_header = valid_header.substr(0, 14).append("\r"); |
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.
🤦♂
I won't if the commits attached with comment. @jmarantz What if I modify the last commits that no one comment? |
idk; why would you need to? why not just do normal commits always? I guess there can be a race where you think no one has commented, but someone is commenting while you are doing the force-push. |
Description: There is one behavior change. This PR watch Closed type event. `Closed` indicates a FIN is received on the OS supporting this event. Upon `Closed` event http inspector would parse the last round. If the parser cannot determine the protocol is http this listener would give up since there is no more data from client. Previous behavior: watch only READ event and hoping peek would return errno. With this PR: 1. A poll cycle is saved. 2. A client stream "ping"+FIN flag could pass the listener filter. Not sure this is very useful in production but it helps me debug with ping-pong client server. And this behavior is less surprising. Risk Level: MID Testing: UT Docs Changes: Release Notes: Signed-off-by: Yuchen Dai <[email protected]>
Description: There is one behavior change. This PR watch Closed type event. `Closed` indicates a FIN is received on the OS supporting this event. Upon `Closed` event http inspector would parse the last round. If the parser cannot determine the protocol is http this listener would give up since there is no more data from client. Previous behavior: watch only READ event and hoping peek would return errno. With this PR: 1. A poll cycle is saved. 2. A client stream "ping"+FIN flag could pass the listener filter. Not sure this is very useful in production but it helps me debug with ping-pong client server. And this behavior is less surprising. Risk Level: MID Testing: UT Docs Changes: Release Notes: Signed-off-by: Yuchen Dai <[email protected]>
Description: There is one behavior change. This PR watch Closed type event. `Closed` indicates a FIN is received on the OS supporting this event. Upon `Closed` event http inspector would parse the last round. If the parser cannot determine the protocol is http this listener would give up since there is no more data from client. Previous behavior: watch only READ event and hoping peek would return errno. With this PR: 1. A poll cycle is saved. 2. A client stream "ping"+FIN flag could pass the listener filter. Not sure this is very useful in production but it helps me debug with ping-pong client server. And this behavior is less surprising. Risk Level: MID Testing: UT Docs Changes: Release Notes: Signed-off-by: Yuchen Dai <[email protected]>
Signed-off-by: Yuchen Dai [email protected]
Similar to #7951
Description:
There is one behavior change.
This PR watch Closed type event.
On closed event http_inspector close the connection and http_inspector doesn't pass to follow up listener filtersClosed
indicates a FIN is received on the OS supporting this event.Upon
Closed
event http inspector would parse the last round. If the parser cannot determine the protocol is http this listener would give up since there is no more data from client.Previous behavior: watch only READ event and hoping peek would return errno.
With this PR:
I am not sure what event libevent would pass on when socket buffer is not empty and if peek would return -1 under this condition.
Risk Level: MID
Testing: UT
Docs Changes:
Release Notes:
[Optional Fixes #Issue]
[Optional Deprecated:]