-
Notifications
You must be signed in to change notification settings - Fork 5.3k
http: O(1) custom header map #11546
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: O(1) custom header map #11546
Changes from all commits
0b2900a
ed8169c
f25b4f4
8c8ad55
17a0f39
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 |
|---|---|---|
|
|
@@ -100,14 +100,18 @@ void AsyncStreamImpl::initialize(bool buffer_body_for_retry) { | |
| void AsyncStreamImpl::onHeaders(Http::ResponseHeaderMapPtr&& headers, bool end_stream) { | ||
| const auto http_response_status = Http::Utility::getResponseStatus(*headers); | ||
| const auto grpc_status = Common::getGrpcStatus(*headers); | ||
| callbacks_.onReceiveInitialMetadata(end_stream ? std::make_unique<Http::ResponseHeaderMapImpl>() | ||
| callbacks_.onReceiveInitialMetadata(end_stream ? Http::ResponseHeaderMapImpl::create() | ||
|
Contributor
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. clang-tidy doesn't like the pre-existing std::move of headers below, followed on line 115 by a reference to the moved object. I'm guessing you'll want to fix this somehow; maybe by holding a ref in a temp?
Member
Author
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. I added a TODO below. This is a pre-existing bug and I would rather not fix this in this change. |
||
| : std::move(headers)); | ||
| if (http_response_status != enumToInt(Http::Code::OK)) { | ||
| // https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md requires that | ||
| // grpc-status be used if available. | ||
| if (end_stream && grpc_status) { | ||
| // Due to headers/trailers type differences we need to copy here. This is an uncommon case but | ||
| // we can potentially optimize in the future. | ||
|
|
||
| // TODO(mattklein123): clang-tidy is showing a use after move when passing to | ||
| // onReceiveInitialMetadata() above. This looks like an actual bug that I will fix in a | ||
| // follow up. | ||
| onTrailers(Http::createHeaderMap<Http::ResponseTrailerMapImpl>(*headers)); | ||
| return; | ||
| } | ||
|
|
@@ -163,7 +167,7 @@ void AsyncStreamImpl::onTrailers(Http::ResponseTrailerMapPtr&& trailers) { | |
| } | ||
|
|
||
| void AsyncStreamImpl::streamError(Status::GrpcStatus grpc_status, const std::string& message) { | ||
| callbacks_.onReceiveTrailingMetadata(std::make_unique<Http::ResponseTrailerMapImpl>()); | ||
| callbacks_.onReceiveTrailingMetadata(Http::ResponseTrailerMapImpl::create()); | ||
| callbacks_.onRemoteClose(grpc_status, message); | ||
| resetStream(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.