diff options
author | Makarand Dharmapurikar <makarandd@makarand-linux.mtv.corp.google.com> | 2016-08-29 15:47:43 -0700 |
---|---|---|
committer | Makarand Dharmapurikar <makarandd@makarand-linux.mtv.corp.google.com> | 2016-08-29 15:47:43 -0700 |
commit | f44946bd9b44527c6fafe225c9098087b8029798 (patch) | |
tree | 2172a7deace089b9f6f41eff34d029e81974369f /src | |
parent | d322d4b3293201fab1e03296edfd75357b6d4f0f (diff) |
fixes for asan leak, and proxy test
freeing up payload_bytes.
returning GET response only once.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/channel/http_client_filter.c | 9 | ||||
-rw-r--r-- | src/core/lib/channel/http_server_filter.c | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 0d3f416861..3647c33049 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -153,7 +153,7 @@ static void hc_mutate_op(grpc_call_element *elem, /* Decide which HTTP VERB to use */ grpc_mdelem *method = GRPC_MDELEM_METHOD_POST; - if ((op->send_initial_metadata_flags & + if (op->send_initial_metadata != NULL && (op->send_initial_metadata_flags & GRPC_INITIAL_METADATA_CACHEABLE_REQUEST) && op->send_message != NULL && op->send_message->length < channeld->max_payload_size_for_get) { @@ -189,6 +189,8 @@ static void hc_mutate_op(grpc_call_element *elem, break; } } + calld->on_complete = op->on_complete; + op->on_complete = &calld->hc_on_complete; op->send_message = NULL; } @@ -216,11 +218,6 @@ static void hc_mutate_op(grpc_call_element *elem, calld->on_done_recv = op->recv_initial_metadata_ready; op->recv_initial_metadata_ready = &calld->hc_on_recv; } - - if (op->on_complete != NULL && op->send_message != NULL) { - calld->on_complete = op->on_complete; - op->on_complete = &calld->hc_on_complete; - } } static void hc_start_transport_op(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index 92e9bcd1c3..0f2bf97824 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -53,6 +53,9 @@ typedef struct call_data { grpc_linked_mdelem status; grpc_linked_mdelem content_type; + /* flag to ensure payload_bin is delivered only once */ + uint8_t payload_bin_delivered; + grpc_metadata_batch *recv_initial_metadata; bool *recv_idempotent_request; bool *recv_cacheable_request; @@ -221,10 +224,13 @@ static void hs_on_complete(grpc_exec_ctx *exec_ctx, void *user_data, call_data *calld = elem->call_data; /* Call recv_message_ready if we got the payload via the header field */ if (calld->seen_payload_bin && calld->recv_message_ready != NULL) { - *calld->pp_recv_message = (grpc_byte_stream *)&calld->read_stream; + *calld->pp_recv_message = calld->payload_bin_delivered + ? NULL + : (grpc_byte_stream *)&calld->read_stream; calld->recv_message_ready->cb(exec_ctx, calld->recv_message_ready->cb_arg, err); calld->recv_message_ready = NULL; + calld->payload_bin_delivered = true; } calld->on_complete->cb(exec_ctx, calld->on_complete->cb_arg, err); } |