Skip to content

Commit

Permalink
cleanup testing prints
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Feb 26, 2025
1 parent a2077ed commit 4341fed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
14 changes: 1 addition & 13 deletions source/h1_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,11 +1386,7 @@ static int s_decoder_on_body(const struct aws_byte_cursor *data, bool finished,
}

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: Incoming body: %zu bytes received: " PRInSTR,
(void *)&incoming_stream->base,
data->len,
AWS_BYTE_CURSOR_PRI(*data));
AWS_LS_HTTP_STREAM, "id=%p: Incoming body: %zu bytes received.", (void *)&incoming_stream->base, data->len);

if (connection->base.stream_manual_window_management) {
/* Let stream window shrink by amount of body data received */
Expand Down Expand Up @@ -2022,14 +2018,6 @@ static int s_try_process_next_stream_read_message(struct aws_h1_connection *conn
*/
message_cursor.len = (size_t)aws_min_u64(message_cursor.len, stream_window);

AWS_LOGF_TRACE(
AWS_LS_HTTP_CONNECTION,
"id=%p: Processing %zu bytes of message for stream %p, %zu bytes remain.",
(void *)&connection->base,
message_cursor.len,
(void *)&incoming_stream->base,
queued_msg->message_data.len - queued_msg->copy_mark);

const size_t prev_cursor_len = message_cursor.len;

/* Set some decoder state, based on current stream */
Expand Down
45 changes: 0 additions & 45 deletions source/h1_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,8 @@ static int s_mark_done(struct aws_h1_decoder *decoder) {
/* Reset state, in preparation for processing a new message */
static void s_reset_state(struct aws_h1_decoder *decoder) {
if (decoder->is_decoding_requests) {
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM, "id=%p: s_set_line_state in s_reset_state, s_linestate_request.", decoder->logging_id);
s_set_line_state(decoder, s_linestate_request);
} else {
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM, "id=%p: s_set_line_state in s_reset_state, s_linestate_response.", decoder->logging_id);
s_set_line_state(decoder, s_linestate_response);
}

Expand Down Expand Up @@ -266,18 +262,8 @@ static int s_linestate_chunk_terminator(struct aws_h1_decoder *decoder, struct a
/* Expecting CRLF at end of each chunk */
/* RFC-7230 section 4.1 Chunked Transfer Encoding */
if (AWS_UNLIKELY(input.len != 0)) {
AWS_LOGF_ERROR(
AWS_LS_HTTP_STREAM,
"id=%p: Incoming chunk is invalid, does not end with CRLF %zu: " PRInSTR,
decoder->logging_id,
input.len,
AWS_BYTE_CURSOR_PRI(input));
return aws_raise_error(AWS_ERROR_HTTP_PROTOCOL_ERROR);
}
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_chunk_terminator, s_linestate_chunk_size.",
decoder->logging_id);

s_set_line_state(decoder, s_linestate_chunk_size);

Expand All @@ -304,11 +290,6 @@ static int s_state_chunk(struct aws_h1_decoder *decoder, struct aws_byte_cursor
}

if (AWS_LIKELY(finished)) {
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: Finished reading chunk of size %llu, set to s_linestate_chunk_terminator",
decoder->logging_id,
decoder->chunk_size);
s_set_line_state(decoder, s_linestate_chunk_terminator);
}

Expand Down Expand Up @@ -356,19 +337,13 @@ static int s_linestate_chunk_size(struct aws_h1_decoder *decoder, struct aws_byt
/* Expected empty newline and end of message. */
decoder->doing_trailers = true;

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_chunk_size, set to s_linestate_header",
decoder->logging_id);
s_set_line_state(decoder, s_linestate_header);
return AWS_OP_SUCCESS;
}

/* Skip all chunk extensions, as they are optional. */
/* RFC-7230 section 4.1.1 Chunk Extensions */

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM, "id=%p: s_set_state in s_linestate_chunk_size, set to s_state_chunk", decoder->logging_id);
s_set_state(decoder, s_state_chunk);

return AWS_OP_SUCCESS;
Expand All @@ -388,16 +363,8 @@ static int s_linestate_header(struct aws_h1_decoder *decoder, struct aws_byte_cu
return AWS_OP_ERR;
}
} else if (decoder->transfer_encoding & AWS_HTTP_TRANSFER_ENCODING_CHUNKED) {
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_header, set to s_linestate_chunk_size",
decoder->logging_id);
s_set_line_state(decoder, s_linestate_chunk_size);
} else if (decoder->content_length > 0) {
AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_state in s_linestate_header, set to s_state_unchunked_body",
decoder->logging_id);
s_set_state(decoder, s_state_unchunked_body);
} else {
err = s_mark_done(decoder);
Expand Down Expand Up @@ -577,10 +544,6 @@ static int s_linestate_header(struct aws_h1_decoder *decoder, struct aws_byte_cu
return AWS_OP_ERR;
}

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_header, set to s_linestate_header",
decoder->logging_id);
s_set_line_state(decoder, s_linestate_header);

return AWS_OP_SUCCESS;
Expand Down Expand Up @@ -653,10 +616,6 @@ static int s_linestate_request(struct aws_h1_decoder *decoder, struct aws_byte_c
return AWS_OP_ERR;
}

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_request, set to s_linestate_header",
decoder->logging_id);
s_set_line_state(decoder, s_linestate_header);

return AWS_OP_SUCCESS;
Expand Down Expand Up @@ -730,10 +689,6 @@ static int s_linestate_response(struct aws_h1_decoder *decoder, struct aws_byte_
return AWS_OP_ERR;
}

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: s_set_line_state in s_linestate_response, set to s_linestate_header",
decoder->logging_id);
s_set_line_state(decoder, s_linestate_header);
return AWS_OP_SUCCESS;
}
Expand Down

0 comments on commit 4341fed

Please sign in to comment.