diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-09-04 19:18:15 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-09-04 19:19:03 -0700 |
commit | 3a41245e465e176dc2cae642cf701f5b476188b6 (patch) | |
tree | a56134db1239548b395139987c4115409fd6589f /src/core/ext | |
parent | dd95194a086b81966fd94726c04f53d279e247d8 (diff) | |
download | grpc-grpc-3a41245e465e176dc2cae642cf701f5b476188b6.tar.gz |
Rectify the condition and add a test
Diffstat (limited to 'src/core/ext')
-rw-r--r-- | src/core/ext/filters/http/client/http_client_filter.cc | 7 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/parsing.cc | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index f44dc032a7..91fa163fec 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -79,7 +79,12 @@ struct channel_data { static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem, grpc_metadata_batch* b) { if (b->idx.named.status != nullptr) { - if (grpc_mdelem_eq(b->idx.named.status->md, GRPC_MDELEM_STATUS_200)) { + /* If both gRPC status and HTTP status are provided in the response, we + * should prefer the gRPC status code, as mentioned in + * https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md. + */ + if (b->idx.named.grpc_status != nullptr || + grpc_mdelem_eq(b->idx.named.status->md, GRPC_MDELEM_STATUS_200)) { grpc_metadata_batch_remove(b, b->idx.named.status); } else { char* val = grpc_dump_slice(GRPC_MDVALUE(b->idx.named.status->md), diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 205fb8c370..1e491d2ef8 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -393,7 +393,6 @@ error_handler: static void free_timeout(void* p) { gpr_free(p); } static void on_initial_header(void* tp, grpc_mdelem md) { - gpr_log(GPR_INFO, "on initial header"); GPR_TIMER_SCOPE("on_initial_header", 0); grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp); @@ -476,7 +475,6 @@ static void on_initial_header(void* tp, grpc_mdelem md) { } static void on_trailing_header(void* tp, grpc_mdelem md) { - gpr_log(GPR_INFO, "on_trailing_header"); GPR_TIMER_SCOPE("on_trailing_header", 0); grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp); |