aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/http/parser.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-30 07:41:40 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-30 07:41:40 -0700
commitee225ef2316458c64e456da9253b4ba59d32e464 (patch)
tree46bceb92086ffd6ff2bb8e2f829d5263c92d9520 /src/core/lib/http/parser.c
parentd9ea50ed4f8936d0385bbc8854029321ab15f320 (diff)
parent026a3dda920335b08d9d970fbe29f72627113384 (diff)
Merge branch 'accounting' into split-me-baby-one-more-time
Diffstat (limited to 'src/core/lib/http/parser.c')
-rw-r--r--src/core/lib/http/parser.c16
1 files changed, 10 insertions, 6 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;