Skip to content

Commit

Permalink
Merge pull request grpc#7366 from y-zeng/fix-chttp2-parsing-msg
Browse files Browse the repository at this point in the history
Remove unnecessary "Failed parsing HTTP2" detail
  • Loading branch information
kpayson64 authored Jul 13, 2016
2 parents 9195ea0 + 9f34095 commit cb6d26a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/core/ext/transport/chttp2/transport/chttp2_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,7 @@ static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx,
static void parsing_action(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_chttp2_transport *t = arg;
grpc_error *err = GRPC_ERROR_NONE;
GPR_TIMER_BEGIN("reading_action.parse", 0);
size_t i = 0;
grpc_error *errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
Expand All @@ -1780,15 +1781,13 @@ static void parsing_action(grpc_exec_ctx *exec_ctx, void *arg,
errors[1] = grpc_chttp2_perform_read(exec_ctx, &t->parsing,
t->read_buffer.slices[i]);
};
if (i != t->read_buffer.count) {
if (errors[1] == GRPC_ERROR_NONE) {
err = GRPC_ERROR_REF(error);
} else {
errors[2] = try_http_parsing(exec_ctx, t);
err = GRPC_ERROR_CREATE_REFERENCING("Failed parsing HTTP/2", errors,
GPR_ARRAY_SIZE(errors));
}
grpc_error *err =
errors[0] == GRPC_ERROR_NONE && errors[1] == GRPC_ERROR_NONE &&
errors[2] == GRPC_ERROR_NONE
? GRPC_ERROR_NONE
: GRPC_ERROR_CREATE_REFERENCING("Failed parsing HTTP/2", errors,
GPR_ARRAY_SIZE(errors));
for (i = 0; i < GPR_ARRAY_SIZE(errors); i++) {
GRPC_ERROR_UNREF(errors[i]);
}
Expand Down
4 changes: 3 additions & 1 deletion test/core/end2end/bad_server_response_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

#define UNPARSEABLE_DETAIL_MSG "Failed parsing HTTP/2"

#define HTTP1_DETAIL_MSG "Trying to connect an http1.x server"

/* TODO(zyc) Check the content of incomming data instead of using this length */
#define EXPECTED_INCOMING_DATA_LENGTH (size_t)310

Expand Down Expand Up @@ -334,7 +336,7 @@ int main(int argc, char **argv) {

/* http1 response */
run_test(HTTP1_RESP, sizeof(HTTP1_RESP) - 1, GRPC_STATUS_UNAVAILABLE,
UNPARSEABLE_DETAIL_MSG);
HTTP1_DETAIL_MSG);

return 0;
}

0 comments on commit cb6d26a

Please sign in to comment.