Skip to content

Commit

Permalink
[http] Remove exceptions from HTTP/1 codec callbacks (#11101)
Browse files Browse the repository at this point in the history
Commit Message: Remove exceptions from HTTP/1 codec callbacks. Replaces with http_parser exit codes that indicate failure. codec_status_ propagates the error.

Additional Description:

I know the diff is slightly messy but the principles I abided by were: Replace throw with setting codec_status_, immediately return and propagate return up to callback with an error exit code, always ASSERT(dispatching_) in the body of the method that throws, always ASSERT(codec_status_.ok()) before setting the codec status.
The remaining exception is in encodeHeaders, which I will need to replace with ENVOY_BUG
I audited for throws in the includes for this file and did not find anything used in the codec_impl, but I will need to do another pass.
This is just part 1 of my HTTP/1 PRs. Part 2 is exception to error handling for encodeHeaders and any other utility functions. This is just a PR to stage.
Testing: Tests pass, codec_impl_fuzz_test has been running for a few minutes.
Risk level: Medium, this should do nothing but is a codec behavior change.
Issues: #10878

Signed-off-by: Asra Ali asraa@google.com
  • Loading branch information
asraa authored May 14, 2020
1 parent ed6a1b8 commit 3550a7a
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 77 deletions.
1 change: 1 addition & 0 deletions source/common/http/http1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ envoy_cc_library(
"//source/common/buffer:buffer_lib",
"//source/common/buffer:watermark_buffer_lib",
"//source/common/common:assert_lib",
"//source/common/common:cleanup_lib",
"//source/common/common:statusor_lib",
"//source/common/common:utility_lib",
"//source/common/http:codec_helper_lib",
Expand Down
Loading

0 comments on commit 3550a7a

Please sign in to comment.