Skip to content

Commit c83309f

Browse files
authored
Don't fire on_body for empty chunks of data. (#163)
This was leading to the python crt passing None to the on_body callback instead of byte buffer. Seems simpler to nip this complexity at the source.
1 parent 6af2c8e commit c83309f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/h1_connection.c

+5
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,11 @@ static int s_decoder_on_body(const struct aws_byte_cursor *data, bool finished,
10791079
return AWS_OP_ERR;
10801080
}
10811081

1082+
/* No need to invoke callback for 0-length data */
1083+
if (data->len == 0) {
1084+
return AWS_OP_SUCCESS;
1085+
}
1086+
10821087
AWS_LOGF_TRACE(
10831088
AWS_LS_HTTP_STREAM, "id=%p: Incoming body: %zu bytes received.", (void *)&incoming_stream->base, data->len);
10841089

0 commit comments

Comments
 (0)