-
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: using CONNECT_ERROR for HTTP/2 #13519
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,17 @@ class Http2ResponseCodeDetailValues { | |
} | ||
}; | ||
|
||
int reasonToReset(StreamResetReason reason) { | ||
switch (reason) { | ||
case StreamResetReason::LocalRefusedStreamReset: | ||
return NGHTTP2_REFUSED_STREAM; | ||
case StreamResetReason::ConnectError: | ||
return NGHTTP2_CONNECT_ERROR; | ||
default: | ||
return NGHTTP2_NO_ERROR; | ||
} | ||
} | ||
|
||
using Http2ResponseCodeDetails = ConstSingleton<Http2ResponseCodeDetailValues>; | ||
|
||
bool Utility::reconstituteCrumbledCookies(const HeaderString& key, const HeaderString& value, | ||
|
@@ -525,9 +536,7 @@ void ConnectionImpl::StreamImpl::resetStream(StreamResetReason reason) { | |
|
||
void ConnectionImpl::StreamImpl::resetStreamWorker(StreamResetReason reason) { | ||
int rc = nghttp2_submit_rst_stream(parent_.session_, NGHTTP2_FLAG_NONE, stream_id_, | ||
reason == StreamResetReason::LocalRefusedStreamReset | ||
? NGHTTP2_REFUSED_STREAM | ||
: NGHTTP2_NO_ERROR); | ||
reasonToReset(reason)); | ||
ASSERT(rc == 0); | ||
} | ||
|
||
|
@@ -984,6 +993,9 @@ int ConnectionImpl::onStreamClose(int32_t stream_id, uint32_t error_code) { | |
if (error_code == NGHTTP2_REFUSED_STREAM) { | ||
reason = StreamResetReason::RemoteRefusedStreamReset; | ||
stream->setDetails(Http2ResponseCodeDetails::get().remote_refused); | ||
} else if (error_code == NGHTTP2_CONNECT_ERROR) { | ||
reason = StreamResetReason::ConnectError; | ||
stream->setDetails(Http2ResponseCodeDetails::get().remote_reset); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use a different details string here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eh, I think it's not worth the detail here (I only split out the reason because otherwise it was impossible to unit test) but I will restructure the code so we only setDetails with it once as a matter of principle :-) |
||
} else { | ||
reason = StreamResetReason::RemoteReset; | ||
stream->setDetails(Http2ResponseCodeDetails::get().remote_reset); | ||
|
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 have a vague sense that we do many header type checks to see if something is a connect request. Would it be better for perf if did this check once and stored this somewhere? Not a big deal but maybe something to think about in a follow up.
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.
We do, but this case is quite special as most are looking at HTTP/1 style CONNECT requests (HTTP/1 connect and HTTP/2 CONNECTs-excluding-upgrades) and this particular one is doing all CONNECT methods (including HTTP/2 upgrades)