|
|
|
@ -38,11 +38,6 @@ |
|
|
|
|
#include <stddef.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
/* This is here for grpc_is_binary_header
|
|
|
|
|
* TODO(murgatroid99): Remove this |
|
|
|
|
*/ |
|
|
|
|
#include <grpc/grpc.h> |
|
|
|
|
|
|
|
|
|
#include <grpc/support/alloc.h> |
|
|
|
|
#include <grpc/support/log.h> |
|
|
|
|
#include <grpc/support/port_platform.h> |
|
|
|
@ -55,13 +50,11 @@ |
|
|
|
|
#include "src/core/lib/support/string.h" |
|
|
|
|
#include "src/core/lib/transport/http2_errors.h" |
|
|
|
|
|
|
|
|
|
/* TODO(ctiller): remove before submission */ |
|
|
|
|
#include "src/core/lib/slice/slice_string_helpers.h" |
|
|
|
|
|
|
|
|
|
extern int grpc_http_trace; |
|
|
|
|
|
|
|
|
|
typedef enum { |
|
|
|
|
NOT_BINARY, |
|
|
|
|
BINARY_BEGIN, |
|
|
|
|
B64_BYTE0, |
|
|
|
|
B64_BYTE1, |
|
|
|
|
B64_BYTE2, |
|
|
|
@ -1325,6 +1318,19 @@ static grpc_error *append_string(grpc_exec_ctx *exec_ctx, |
|
|
|
|
case NOT_BINARY: |
|
|
|
|
append_bytes(str, cur, (size_t)(end - cur)); |
|
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
|
case BINARY_BEGIN: |
|
|
|
|
if (cur == end) { |
|
|
|
|
p->binary = BINARY_BEGIN; |
|
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
|
} |
|
|
|
|
if (*cur == 0) { |
|
|
|
|
/* 'true-binary' case */ |
|
|
|
|
++cur; |
|
|
|
|
p->binary = NOT_BINARY; |
|
|
|
|
append_bytes(str, cur, (size_t)(end - cur)); |
|
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
|
} |
|
|
|
|
/* fallthrough */ |
|
|
|
|
b64_byte0: |
|
|
|
|
case B64_BYTE0: |
|
|
|
|
if (cur == end) { |
|
|
|
@ -1409,6 +1415,8 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx, |
|
|
|
|
switch ((binary_state)p->binary) { |
|
|
|
|
case NOT_BINARY: |
|
|
|
|
break; |
|
|
|
|
case BINARY_BEGIN: |
|
|
|
|
break; |
|
|
|
|
case B64_BYTE0: |
|
|
|
|
break; |
|
|
|
|
case B64_BYTE1: |
|
|
|
@ -1571,7 +1579,7 @@ static grpc_error *parse_value_string(grpc_exec_ctx *exec_ctx, |
|
|
|
|
const uint8_t *cur, const uint8_t *end, |
|
|
|
|
bool is_binary) { |
|
|
|
|
return begin_parse_string(exec_ctx, p, cur, end, |
|
|
|
|
is_binary ? B64_BYTE0 : NOT_BINARY, &p->value); |
|
|
|
|
is_binary ? BINARY_BEGIN : NOT_BINARY, &p->value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static grpc_error *parse_value_string_with_indexed_key( |
|
|
|
|