Fix misbehavior of H09 server on delayed FIN
@@ -964,6 +964,7 @@ int picoquic_h09_server_process_data(picoquic_cnx_t* cnx,
}
/* if FIN present, process request through http 0.9 */
+ if (stream_ctx->ps.hq.status != picohttp_server_stream_status_finished) {
if (fin_or_event == picoquic_callback_stream_fin || (stream_ctx->method == 0 && stream_ctx->ps.hq.status == picohttp_server_stream_status_crlf)) {
char buf[1024];
uint8_t post_response[512];
@@ -1030,7 +1031,8 @@ int picoquic_h09_server_process_data(picoquic_cnx_t* cnx,
stream_ctx->response_length = strlen(bad_request_message);
(void)picoquic_add_to_stream_with_ctx(cnx, stream_ctx->stream_id, (const uint8_t*)bad_request_message,
stream_ctx->response_length, 1, (void*)stream_ctx);
- } else {
+ }
+ else {
/* If this is HTTP1, send an HTTP1 OK message, with the appropriate content type */
if (stream_ctx->ps.hq.proto != 0) {
size_t header_length = 0;
@@ -1068,6 +1070,7 @@ int picoquic_h09_server_process_data(picoquic_cnx_t* cnx,
fflush(cnx->quic->F_log);
}
}
+ }
return ret;
}
