Skip to content

http3: fixing rst codes#17830

Merged
alyssawilk merged 3 commits intoenvoyproxy:mainfrom
alyssawilk:details_from_17520
Sep 1, 2021
Merged

http3: fixing rst codes#17830
alyssawilk merged 3 commits intoenvoyproxy:mainfrom
alyssawilk:details_from_17520

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

Follow up from #17520 to make the rst codes more accurate

Risk Level: low
Testing: new unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
quicHeadersToEnvoyHeaders(const quic::QuicHeaderList& header_list, HeaderValidator& validator,
uint32_t max_headers_allowed, absl::string_view& details) {
uint32_t max_headers_allowed, absl::string_view& details,
quic::QuicRstStreamErrorCode& rst) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing in one more argument, can we tell which reset error to use based on the output argument details? If the return value is null, details_ must have been populated already by these two utility functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but details can arguably be pretty wide and I'd prefer to pass the argument over doing string compares

Copy link
Copy Markdown
Contributor

@danzh2010 danzh2010 Aug 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the other way around, passing in rst error code and infer details according to the error code later if the returned header is nullptr?
quic::QUIC_STREAM_EXCESSIVE_LOAD => Http3ResponseCodeDetailValues::too_many_headers or Http3ResponseCodeDetailValues::too_many_trailers
quic::QUIC_BAD_APPLICATION_PAYLOAD => Http3ResponseCodeDetailValues::invalid_underscore, which should have already been populated.

Copy link
Copy Markdown
Contributor Author

@alyssawilk alyssawilk Aug 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'd rather set both, than return QUIC_STREAM_EXCESSIVE_LOAD, and have to infer details in 2 different places - we can't use the same utility function for the two functions since one will be too_many_headers and the other too_many_trailers so they'd both need their own switch which would need to be kept up to date. I agree it's unfortunate to have the extra argument but I think it's cleaner than a switch statement to infer details for both functions
How about I call in @mattklein123 as a style tiebreaker - if he prefers the single argument I'll move it over tuesday when I'm back at work?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't strongly prefer fewer argument in that case. Adding more and more output arguments indicates we probably need a better interface any way. But that is out of scope of this PR. We can leave it as is for now.

end_stream_decoded_ = true;
}

quic::QuicRstStreamErrorCode transform_rst = quic::QUIC_STREAM_EXCESSIVE_LOAD;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the rst error be initialized to a neutral error like QUIC_STREAM_NO_ERROR in both places. I was wondering why these two were initialized with different errors when I first read the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, this confused me also. Or a comment?

quicHeadersToEnvoyHeaders(const quic::QuicHeaderList& header_list, HeaderValidator& validator,
uint32_t max_headers_allowed, absl::string_view& details) {
uint32_t max_headers_allowed, absl::string_view& details,
quic::QuicRstStreamErrorCode& rst) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't strongly prefer fewer argument in that case. Adding more and more output arguments indicates we probably need a better interface any way. But that is out of scope of this PR. We can leave it as is for now.

danzh2010
danzh2010 previously approved these changes Aug 26, 2021
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at a high level with some quick comments from a skim.

/wait

end_stream_decoded_ = true;
}

quic::QuicRstStreamErrorCode transform_rst = quic::QUIC_STREAM_EXCESSIVE_LOAD;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, this confused me also. Or a comment?

rst);
if (trailers == nullptr) {
onStreamError(close_connection_upon_invalid_header_);
onStreamError(close_connection_upon_invalid_header_, quic::QUIC_STREAM_EXCESSIVE_LOAD);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onStreamError(close_connection_upon_invalid_header_, quic::QUIC_STREAM_EXCESSIVE_LOAD);
onStreamError(close_connection_upon_invalid_header_, rst);

?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping on this one?

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

(Ci deflaked)

@alyssawilk alyssawilk merged commit 5c5cd1a into envoyproxy:main Sep 1, 2021
@alyssawilk alyssawilk deleted the details_from_17520 branch August 4, 2022 01:09
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.

3 participants