diff options
author | Craig Tiller <ctiller@google.com> | 2016-03-29 13:53:50 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-03-29 13:53:50 -0700 |
commit | 9557869e158d723ad7afd0b273fdcc414c036666 (patch) | |
tree | 15b9ee12245edd2fd7ec57a6ce01d16fd87892ec /src/core/lib | |
parent | ad46ecfebabe79fe1941c54e8e7e46bb0e909fa3 (diff) | |
parent | 447bab1553d6b872e9cd447919f1b3a1e21c9ad6 (diff) |
Merge branch 'optionalize_roundrobin' into optionalize_census
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/http/parser.c | 16 | ||||
-rw-r--r-- | src/core/lib/json/json_reader.c | 7 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c index 5d4e304615..2782ad758e 100644 --- a/src/core/lib/http/parser.c +++ b/src/core/lib/http/parser.c @@ -39,6 +39,8 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> +extern int grpc_http_trace; + static char *buf2str(void *buffer, size_t length) { char *out = gpr_malloc(length + 1); memcpy(out, buffer, length); @@ -72,7 +74,7 @@ static int handle_response_line(grpc_http_parser *parser) { return 1; error: - gpr_log(GPR_ERROR, "Failed parsing response line"); + if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing response line"); return 0; } @@ -125,7 +127,7 @@ static int handle_request_line(grpc_http_parser *parser) { return 1; error: - gpr_log(GPR_ERROR, "Failed parsing request line"); + if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing request line"); return 0; } @@ -150,7 +152,8 @@ static int add_header(grpc_http_parser *parser) { GPR_ASSERT(cur != end); if (*cur == ' ' || *cur == '\t') { - gpr_log(GPR_ERROR, "Continued header lines not supported yet"); + if (grpc_http_trace) + gpr_log(GPR_ERROR, "Continued header lines not supported yet"); goto error; } @@ -158,7 +161,7 @@ static int add_header(grpc_http_parser *parser) { cur++; } if (cur == end) { - gpr_log(GPR_ERROR, "Didn't find ':' in header string"); + if (grpc_http_trace) gpr_log(GPR_ERROR, "Didn't find ':' in header string"); goto error; } GPR_ASSERT(cur >= beg); @@ -249,8 +252,9 @@ static int addbyte(grpc_http_parser *parser, uint8_t byte) { case GRPC_HTTP_FIRST_LINE: case GRPC_HTTP_HEADERS: if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) { - gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded", - GRPC_HTTP_PARSER_MAX_HEADER_LENGTH); + if (grpc_http_trace) + gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded", + GRPC_HTTP_PARSER_MAX_HEADER_LENGTH); return 0; } parser->cur_line[parser->cur_line_length] = byte; diff --git a/src/core/lib/json/json_reader.c b/src/core/lib/json/json_reader.c index 0807f029ce..4cff13dff1 100644 --- a/src/core/lib/json/json_reader.c +++ b/src/core/lib/json/json_reader.c @@ -280,13 +280,14 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader *reader) { break; case GRPC_JSON_STATE_OBJECT_KEY_STRING: - GPR_ASSERT(reader->unicode_high_surrogate == 0); + if (reader->unicode_high_surrogate != 0) + return GRPC_JSON_PARSE_ERROR; if (c == '"') { reader->state = GRPC_JSON_STATE_OBJECT_KEY_END; json_reader_set_key(reader); json_reader_string_clear(reader); } else { - if (c <= 0x001f) return GRPC_JSON_PARSE_ERROR; + if (c < 32) return GRPC_JSON_PARSE_ERROR; json_reader_string_add_char(reader, c); } break; @@ -362,6 +363,8 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader *reader) { reader->in_object = 0; reader->in_array = 1; break; + default: + return GRPC_JSON_PARSE_ERROR; } break; |