From c6da5413d4dc011d948549ed04617cccafa927c1 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 7 Feb 2024 15:32:44 +0100 Subject: [PATCH] Add logging for 100 Continue --- src/lib/proxy.c | 3 +++ src/worker/fastcgi_handler.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/lib/proxy.c b/src/lib/proxy.c index ed03553..ae24938 100644 --- a/src/lib/proxy.c +++ b/src/lib/proxy.c @@ -456,6 +456,7 @@ int proxy_init(proxy_ctx_t **proxy_ptr, http_req *req, http_res *res, http_statu } ret = proxy_peek_response(proxy, &tmp_res, ctx, custom_status, err_msg); + http_free_hdr(&tmp_res.hdr); if (ret < 0) return (int) ret; @@ -466,6 +467,7 @@ int proxy_init(proxy_ctx_t **proxy_ptr, http_req *req, http_res *res, http_statu error("Unable to receive from server"); return -1; } + info("%s -> %03i %s%s", http_get_status_color(tmp_res.status->code), tmp_res.status->code, tmp_res.status->msg, CLR_STR); if (http_send_response(client, &tmp_res) != 0) { res->status = http_get_status(400); ctx->origin = CLIENT_RES; @@ -528,6 +530,7 @@ int proxy_init(proxy_ctx_t **proxy_ptr, http_req *req, http_res *res, http_statu return -1; } if (res->status->code == 100) { + info("%s -> %03i %s%s", http_get_status_color(res->status->code), res->status->code, res->status->msg, CLR_STR); if (http_send_response(client, res) != 0) { res->status = http_get_status(400); ctx->origin = CLIENT_RES; diff --git a/src/worker/fastcgi_handler.c b/src/worker/fastcgi_handler.c index 237ee7b..f3e3079 100644 --- a/src/worker/fastcgi_handler.c +++ b/src/worker/fastcgi_handler.c @@ -90,12 +90,14 @@ static int fastcgi_handler_1(client_ctx_t *ctx, fastcgi_cnx_t **fcgi_cnx) { const char *client_transfer_encoding = http_get_header_field(&req->hdr, "Transfer-Encoding"); if (client_content_length != NULL) { if (expect_100_continue) { + info(HTTP_COLOR_SUCCESS "100 Continue" CLR_STR); http_send_100_continue(client); } unsigned long client_content_len = strtoul(client_content_length, NULL, 10); ret = fastcgi_receive(*fcgi_cnx, client, client_content_len); } else if (strcontains(client_transfer_encoding, "chunked")) { if (expect_100_continue) { + info(HTTP_COLOR_SUCCESS "100 Continue" CLR_STR); http_send_100_continue(client); } ret = fastcgi_receive_chunked(*fcgi_cnx, client);