Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame] | 3 | * Copyright 2015, Google Inc. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #include "src/core/channel/http_server_filter.h" |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 35 | |
| 36 | #include <string.h> |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 37 | #include <grpc/grpc_http.h> |
| 38 | #include <grpc/support/alloc.h> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 39 | #include <grpc/support/log.h> |
| 40 | |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 41 | typedef struct { |
| 42 | grpc_mdelem *path; |
| 43 | grpc_mdelem *content_type; |
| 44 | grpc_byte_buffer *content; |
| 45 | } gettable; |
| 46 | |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 47 | typedef struct call_data { |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 48 | gpr_uint8 got_initial_metadata; |
| 49 | gpr_uint8 seen_path; |
| 50 | gpr_uint8 seen_post; |
Craig Tiller | d2d0a11 | 2015-01-19 16:07:52 -0800 | [diff] [blame] | 51 | gpr_uint8 sent_status; |
| 52 | gpr_uint8 seen_scheme; |
Craig Tiller | d2d0a11 | 2015-01-19 16:07:52 -0800 | [diff] [blame] | 53 | gpr_uint8 seen_te_trailers; |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 54 | grpc_linked_mdelem status; |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 55 | |
| 56 | grpc_stream_op_buffer *recv_ops; |
| 57 | void (*on_done_recv)(void *user_data, int success); |
| 58 | void *recv_user_data; |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 59 | } call_data; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 60 | |
klempner | 1e27328 | 2014-12-10 13:55:41 -0800 | [diff] [blame] | 61 | typedef struct channel_data { |
| 62 | grpc_mdelem *te_trailers; |
Craig Tiller | c923cd7 | 2015-01-19 16:14:31 -0800 | [diff] [blame] | 63 | grpc_mdelem *method_post; |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 64 | grpc_mdelem *http_scheme; |
| 65 | grpc_mdelem *https_scheme; |
| 66 | /* TODO(klempner): Remove this once we stop using it */ |
| 67 | grpc_mdelem *grpc_scheme; |
| 68 | grpc_mdelem *content_type; |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 69 | grpc_mdelem *status_ok; |
| 70 | grpc_mdelem *status_not_found; |
Craig Tiller | d2d0a11 | 2015-01-19 16:07:52 -0800 | [diff] [blame] | 71 | grpc_mdstr *path_key; |
Tatsuhiro Tsujikawa | 229000f | 2015-03-13 23:52:56 +0900 | [diff] [blame] | 72 | grpc_mdstr *authority_key; |
| 73 | grpc_mdstr *host_key; |
| 74 | |
| 75 | grpc_mdctx *mdctx; |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 76 | |
| 77 | size_t gettable_count; |
| 78 | gettable *gettables; |
klempner | 1e27328 | 2014-12-10 13:55:41 -0800 | [diff] [blame] | 79 | } channel_data; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 80 | |
| 81 | /* used to silence 'variable not used' warnings */ |
| 82 | static void ignore_unused(void *ignored) {} |
| 83 | |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 84 | static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { |
| 85 | grpc_call_element *elem = user_data; |
Craig Tiller | ce6e350 | 2015-01-19 18:04:42 -0800 | [diff] [blame] | 86 | channel_data *channeld = elem->channel_data; |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 87 | call_data *calld = elem->call_data; |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 88 | |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 89 | /* Check if it is one of the headers we care about. */ |
Craig Tiller | 87d5b19 | 2015-04-16 14:37:57 -0700 | [diff] [blame] | 90 | if (md == channeld->te_trailers || md == channeld->method_post || |
| 91 | md == channeld->http_scheme || md == channeld->https_scheme || |
| 92 | md == channeld->grpc_scheme || md == channeld->content_type) { |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 93 | /* swallow it */ |
| 94 | if (md == channeld->method_post) { |
| 95 | calld->seen_post = 1; |
| 96 | } else if (md->key == channeld->http_scheme->key) { |
| 97 | calld->seen_scheme = 1; |
| 98 | } else if (md == channeld->te_trailers) { |
| 99 | calld->seen_te_trailers = 1; |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 100 | } |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 101 | /* TODO(klempner): Track that we've seen all the headers we should |
| 102 | require */ |
| 103 | return NULL; |
| 104 | } else if (md->key == channeld->content_type->key) { |
Craig Tiller | 87d5b19 | 2015-04-16 14:37:57 -0700 | [diff] [blame] | 105 | if (strncmp(grpc_mdstr_as_c_string(md->value), "application/grpc+", 17) == |
| 106 | 0) { |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 107 | /* Although the C implementation doesn't (currently) generate them, |
Craig Tiller | 9c9d4e0 | 2015-04-20 09:03:29 -0700 | [diff] [blame] | 108 | any custom +-suffix is explicitly valid. */ |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 109 | /* TODO(klempner): We should consider preallocating common values such |
| 110 | as +proto or +json, or at least stashing them if we see them. */ |
| 111 | /* TODO(klempner): Should we be surfacing this to application code? */ |
| 112 | } else { |
| 113 | /* TODO(klempner): We're currently allowing this, but we shouldn't |
| 114 | see it without a proxy so log for now. */ |
| 115 | gpr_log(GPR_INFO, "Unexpected content-type %s", |
| 116 | channeld->content_type->key); |
| 117 | } |
| 118 | return NULL; |
| 119 | } else if (md->key == channeld->te_trailers->key || |
| 120 | md->key == channeld->method_post->key || |
| 121 | md->key == channeld->http_scheme->key || |
| 122 | md->key == channeld->content_type->key) { |
| 123 | gpr_log(GPR_ERROR, "Invalid %s: header: '%s'", |
Craig Tiller | 87d5b19 | 2015-04-16 14:37:57 -0700 | [diff] [blame] | 124 | grpc_mdstr_as_c_string(md->key), grpc_mdstr_as_c_string(md->value)); |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 125 | /* swallow it and error everything out. */ |
| 126 | /* TODO(klempner): We ought to generate more descriptive error messages |
| 127 | on the wire here. */ |
| 128 | grpc_call_element_send_cancel(elem); |
| 129 | return NULL; |
| 130 | } else if (md->key == channeld->path_key) { |
| 131 | if (calld->seen_path) { |
| 132 | gpr_log(GPR_ERROR, "Received :path twice"); |
| 133 | return NULL; |
| 134 | } |
| 135 | calld->seen_path = 1; |
| 136 | return md; |
| 137 | } else if (md->key == channeld->host_key) { |
| 138 | /* translate host to :authority since :authority may be |
| 139 | omitted */ |
| 140 | grpc_mdelem *authority = grpc_mdelem_from_metadata_strings( |
| 141 | channeld->mdctx, grpc_mdstr_ref(channeld->authority_key), |
| 142 | grpc_mdstr_ref(md->value)); |
| 143 | grpc_mdelem_unref(md); |
| 144 | return authority; |
| 145 | } else { |
| 146 | return md; |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 147 | } |
Craig Tiller | ce6e350 | 2015-01-19 18:04:42 -0800 | [diff] [blame] | 148 | } |
| 149 | |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 150 | static void hs_on_recv(void *user_data, int success) { |
| 151 | grpc_call_element *elem = user_data; |
| 152 | call_data *calld = elem->call_data; |
| 153 | if (success) { |
| 154 | size_t i; |
| 155 | size_t nops = calld->recv_ops->nops; |
| 156 | grpc_stream_op *ops = calld->recv_ops->ops; |
| 157 | for (i = 0; i < nops; i++) { |
| 158 | grpc_stream_op *op = &ops[i]; |
| 159 | if (op->type != GRPC_OP_METADATA) continue; |
| 160 | calld->got_initial_metadata = 1; |
| 161 | grpc_metadata_batch_filter(&op->data.metadata, server_filter, elem); |
| 162 | /* Have we seen the required http2 transport headers? |
| 163 | (:method, :scheme, content-type, with :path and :authority covered |
| 164 | at the channel level right now) */ |
| 165 | if (calld->seen_post && calld->seen_scheme && calld->seen_te_trailers && |
| 166 | calld->seen_path) { |
| 167 | /* do nothing */ |
| 168 | } else { |
| 169 | if (!calld->seen_post) { |
| 170 | gpr_log(GPR_ERROR, "Missing :method header"); |
| 171 | } |
| 172 | if (!calld->seen_scheme) { |
| 173 | gpr_log(GPR_ERROR, "Missing :scheme header"); |
| 174 | } |
| 175 | if (!calld->seen_te_trailers) { |
| 176 | gpr_log(GPR_ERROR, "Missing te trailers header"); |
| 177 | } |
| 178 | /* Error this call out */ |
| 179 | success = 0; |
| 180 | grpc_call_element_send_cancel(elem); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | calld->on_done_recv(calld->recv_user_data, success); |
| 185 | } |
| 186 | |
| 187 | static void hs_start_transport_op(grpc_call_element *elem, grpc_transport_op *op) { |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 188 | /* grab pointers to our data from the call element */ |
| 189 | call_data *calld = elem->call_data; |
| 190 | channel_data *channeld = elem->channel_data; |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 191 | size_t i; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 192 | GRPC_CALL_LOG_OP(GPR_INFO, elem, op); |
| 193 | |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 194 | if (op->send_ops && !calld->sent_status) { |
| 195 | size_t nops = op->send_ops->nops; |
| 196 | grpc_stream_op *ops = op->send_ops->ops; |
| 197 | for (i = 0; i < nops; i++) { |
| 198 | grpc_stream_op *op = &ops[i]; |
| 199 | if (op->type != GRPC_OP_METADATA) continue; |
| 200 | calld->sent_status = 1; |
| 201 | grpc_metadata_batch_add_head(&op->data.metadata, &calld->status, |
| 202 | grpc_mdelem_ref(channeld->status_ok)); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 203 | break; |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 204 | } |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 205 | } |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 206 | |
| 207 | if (op->recv_ops && !calld->got_initial_metadata) { |
| 208 | /* substitute our callback for the higher callback */ |
| 209 | calld->recv_ops = op->recv_ops; |
| 210 | calld->on_done_recv = op->on_done_recv; |
| 211 | calld->recv_user_data = op->recv_user_data; |
| 212 | op->on_done_recv = hs_on_recv; |
| 213 | op->recv_user_data = elem; |
| 214 | } |
| 215 | |
| 216 | grpc_call_next_op(elem, op); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | /* Called on special channel events, such as disconnection or new incoming |
| 220 | calls on the server */ |
ctiller | f962f52 | 2014-12-10 15:28:27 -0800 | [diff] [blame] | 221 | static void channel_op(grpc_channel_element *elem, |
| 222 | grpc_channel_element *from_elem, grpc_channel_op *op) { |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 223 | /* grab pointers to our data from the channel element */ |
| 224 | channel_data *channeld = elem->channel_data; |
| 225 | |
| 226 | ignore_unused(channeld); |
| 227 | |
| 228 | switch (op->type) { |
| 229 | default: |
| 230 | /* pass control up or down the stack depending on op->dir */ |
| 231 | grpc_channel_next_op(elem, op); |
| 232 | break; |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | /* Constructor for call_data */ |
| 237 | static void init_call_elem(grpc_call_element *elem, |
| 238 | const void *server_transport_data) { |
| 239 | /* grab pointers to our data from the call element */ |
| 240 | call_data *calld = elem->call_data; |
| 241 | channel_data *channeld = elem->channel_data; |
| 242 | |
| 243 | ignore_unused(channeld); |
| 244 | |
| 245 | /* initialize members */ |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 246 | memset(calld, 0, sizeof(*calld)); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | /* Destructor for call_data */ |
Craig Tiller | 87d5b19 | 2015-04-16 14:37:57 -0700 | [diff] [blame] | 250 | static void destroy_call_elem(grpc_call_element *elem) {} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 251 | |
| 252 | /* Constructor for channel_data */ |
| 253 | static void init_channel_elem(grpc_channel_element *elem, |
| 254 | const grpc_channel_args *args, grpc_mdctx *mdctx, |
| 255 | int is_first, int is_last) { |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 256 | size_t i; |
| 257 | size_t gettable_capacity = 0; |
| 258 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 259 | /* grab pointers to our data from the channel element */ |
| 260 | channel_data *channeld = elem->channel_data; |
| 261 | |
| 262 | /* The first and the last filters tend to be implemented differently to |
| 263 | handle the case that there's no 'next' filter to call on the up or down |
| 264 | path */ |
| 265 | GPR_ASSERT(!is_first); |
| 266 | GPR_ASSERT(!is_last); |
| 267 | |
| 268 | /* initialize members */ |
| 269 | channeld->te_trailers = grpc_mdelem_from_strings(mdctx, "te", "trailers"); |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 270 | channeld->status_ok = grpc_mdelem_from_strings(mdctx, ":status", "200"); |
| 271 | channeld->status_not_found = |
| 272 | grpc_mdelem_from_strings(mdctx, ":status", "404"); |
Craig Tiller | c923cd7 | 2015-01-19 16:14:31 -0800 | [diff] [blame] | 273 | channeld->method_post = grpc_mdelem_from_strings(mdctx, ":method", "POST"); |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 274 | channeld->http_scheme = grpc_mdelem_from_strings(mdctx, ":scheme", "http"); |
| 275 | channeld->https_scheme = grpc_mdelem_from_strings(mdctx, ":scheme", "https"); |
| 276 | channeld->grpc_scheme = grpc_mdelem_from_strings(mdctx, ":scheme", "grpc"); |
Craig Tiller | d2d0a11 | 2015-01-19 16:07:52 -0800 | [diff] [blame] | 277 | channeld->path_key = grpc_mdstr_from_string(mdctx, ":path"); |
Tatsuhiro Tsujikawa | 229000f | 2015-03-13 23:52:56 +0900 | [diff] [blame] | 278 | channeld->authority_key = grpc_mdstr_from_string(mdctx, ":authority"); |
| 279 | channeld->host_key = grpc_mdstr_from_string(mdctx, "host"); |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 280 | channeld->content_type = |
| 281 | grpc_mdelem_from_strings(mdctx, "content-type", "application/grpc"); |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 282 | |
Tatsuhiro Tsujikawa | 229000f | 2015-03-13 23:52:56 +0900 | [diff] [blame] | 283 | channeld->mdctx = mdctx; |
| 284 | |
Craig Tiller | 53d5f9d | 2015-01-21 13:03:18 -0800 | [diff] [blame] | 285 | /* initialize http download support */ |
| 286 | channeld->gettable_count = 0; |
| 287 | channeld->gettables = NULL; |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 288 | for (i = 0; i < args->num_args; i++) { |
| 289 | if (0 == strcmp(args->args[i].key, GRPC_ARG_SERVE_OVER_HTTP)) { |
| 290 | gettable *g; |
| 291 | gpr_slice slice; |
| 292 | grpc_http_server_page *p = args->args[i].value.pointer.p; |
| 293 | if (channeld->gettable_count == gettable_capacity) { |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 294 | gettable_capacity = |
| 295 | GPR_MAX(gettable_capacity * 3 / 2, gettable_capacity + 1); |
Craig Tiller | 5a8a807 | 2015-01-30 09:41:25 -0800 | [diff] [blame] | 296 | channeld->gettables = gpr_realloc(channeld->gettables, |
| 297 | gettable_capacity * sizeof(gettable)); |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 298 | } |
| 299 | g = &channeld->gettables[channeld->gettable_count++]; |
| 300 | g->path = grpc_mdelem_from_strings(mdctx, ":path", p->path); |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 301 | g->content_type = |
| 302 | grpc_mdelem_from_strings(mdctx, "content-type", p->content_type); |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 303 | slice = gpr_slice_from_copied_string(p->content); |
| 304 | g->content = grpc_byte_buffer_create(&slice, 1); |
Craig Tiller | d375663 | 2015-01-30 09:45:50 -0800 | [diff] [blame] | 305 | gpr_slice_unref(slice); |
Craig Tiller | c50e398 | 2015-01-20 16:30:54 -0800 | [diff] [blame] | 306 | } |
| 307 | } |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | /* Destructor for channel data */ |
| 311 | static void destroy_channel_elem(grpc_channel_element *elem) { |
Craig Tiller | 5a8a807 | 2015-01-30 09:41:25 -0800 | [diff] [blame] | 312 | size_t i; |
| 313 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 314 | /* grab pointers to our data from the channel element */ |
| 315 | channel_data *channeld = elem->channel_data; |
| 316 | |
Craig Tiller | 5a8a807 | 2015-01-30 09:41:25 -0800 | [diff] [blame] | 317 | for (i = 0; i < channeld->gettable_count; i++) { |
| 318 | grpc_mdelem_unref(channeld->gettables[i].path); |
| 319 | grpc_mdelem_unref(channeld->gettables[i].content_type); |
Craig Tiller | d375663 | 2015-01-30 09:45:50 -0800 | [diff] [blame] | 320 | grpc_byte_buffer_destroy(channeld->gettables[i].content); |
Craig Tiller | 5a8a807 | 2015-01-30 09:41:25 -0800 | [diff] [blame] | 321 | } |
| 322 | gpr_free(channeld->gettables); |
| 323 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 324 | grpc_mdelem_unref(channeld->te_trailers); |
Craig Tiller | fd7d3ec | 2015-01-21 13:37:09 -0800 | [diff] [blame] | 325 | grpc_mdelem_unref(channeld->status_ok); |
| 326 | grpc_mdelem_unref(channeld->status_not_found); |
Craig Tiller | c923cd7 | 2015-01-19 16:14:31 -0800 | [diff] [blame] | 327 | grpc_mdelem_unref(channeld->method_post); |
ctiller | d74729d | 2015-01-12 13:31:36 -0800 | [diff] [blame] | 328 | grpc_mdelem_unref(channeld->http_scheme); |
| 329 | grpc_mdelem_unref(channeld->https_scheme); |
| 330 | grpc_mdelem_unref(channeld->grpc_scheme); |
| 331 | grpc_mdelem_unref(channeld->content_type); |
Craig Tiller | d2d0a11 | 2015-01-19 16:07:52 -0800 | [diff] [blame] | 332 | grpc_mdstr_unref(channeld->path_key); |
Tatsuhiro Tsujikawa | 229000f | 2015-03-13 23:52:56 +0900 | [diff] [blame] | 333 | grpc_mdstr_unref(channeld->authority_key); |
| 334 | grpc_mdstr_unref(channeld->host_key); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | const grpc_channel_filter grpc_http_server_filter = { |
Craig Tiller | 83f88d9 | 2015-04-21 16:02:05 -0700 | [diff] [blame^] | 338 | hs_start_transport_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, |
Craig Tiller | 5a8a807 | 2015-01-30 09:41:25 -0800 | [diff] [blame] | 339 | sizeof(channel_data), init_channel_elem, destroy_channel_elem, |
Craig Tiller | 190d360 | 2015-02-18 09:23:38 -0800 | [diff] [blame] | 340 | "http-server"}; |