Add logging for 100 Continue

This commit is contained in:
2024-02-07 15:32:44 +01:00
parent 80d7626208
commit c6da5413d4
2 changed files with 5 additions and 0 deletions

View File

@ -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); ret = proxy_peek_response(proxy, &tmp_res, ctx, custom_status, err_msg);
http_free_hdr(&tmp_res.hdr);
if (ret < 0) if (ret < 0)
return (int) ret; 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"); error("Unable to receive from server");
return -1; 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) { if (http_send_response(client, &tmp_res) != 0) {
res->status = http_get_status(400); res->status = http_get_status(400);
ctx->origin = CLIENT_RES; 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; return -1;
} }
if (res->status->code == 100) { 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) { if (http_send_response(client, res) != 0) {
res->status = http_get_status(400); res->status = http_get_status(400);
ctx->origin = CLIENT_RES; ctx->origin = CLIENT_RES;

View File

@ -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"); const char *client_transfer_encoding = http_get_header_field(&req->hdr, "Transfer-Encoding");
if (client_content_length != NULL) { if (client_content_length != NULL) {
if (expect_100_continue) { if (expect_100_continue) {
info(HTTP_COLOR_SUCCESS "100 Continue" CLR_STR);
http_send_100_continue(client); http_send_100_continue(client);
} }
unsigned long client_content_len = strtoul(client_content_length, NULL, 10); unsigned long client_content_len = strtoul(client_content_length, NULL, 10);
ret = fastcgi_receive(*fcgi_cnx, client, client_content_len); ret = fastcgi_receive(*fcgi_cnx, client, client_content_len);
} else if (strcontains(client_transfer_encoding, "chunked")) { } else if (strcontains(client_transfer_encoding, "chunked")) {
if (expect_100_continue) { if (expect_100_continue) {
info(HTTP_COLOR_SUCCESS "100 Continue" CLR_STR);
http_send_100_continue(client); http_send_100_continue(client);
} }
ret = fastcgi_receive_chunked(*fcgi_cnx, client); ret = fastcgi_receive_chunked(*fcgi_cnx, client);