[MINOR] http: take a capture of bad content-lengths.
Sometimes a bad content-length header is encountered and this causes
an abort. It's hard to debug without a trace, so let's take a capture
of the contents when this happens.
diff --git a/src/proto_http.c b/src/proto_http.c
index 439e1ce..26b8f73 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2808,17 +2808,25 @@
http_find_header2("Content-Length", 14, msg->sol, &txn->hdr_idx, &ctx)) {
signed long long cl;
- if (!ctx.vlen)
+ if (!ctx.vlen) {
+ msg->err_pos = ctx.line + ctx.val - req->data;
goto return_bad_req;
+ }
- if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl))
+ if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl)) {
+ msg->err_pos = ctx.line + ctx.val - req->data;
goto return_bad_req; /* parse failure */
+ }
- if (cl < 0)
+ if (cl < 0) {
+ msg->err_pos = ctx.line + ctx.val - req->data;
goto return_bad_req;
+ }
- if ((txn->flags & TX_REQ_CNT_LEN) && (msg->chunk_len != cl))
+ if ((txn->flags & TX_REQ_CNT_LEN) && (msg->chunk_len != cl)) {
+ msg->err_pos = ctx.line + ctx.val - req->data;
goto return_bad_req; /* already specified, was different */
+ }
txn->flags |= TX_REQ_CNT_LEN | TX_REQ_XFER_LEN;
msg->body_len = msg->chunk_len = cl;
@@ -5023,17 +5031,25 @@
http_find_header2("Content-Length", 14, msg->sol, &txn->hdr_idx, &ctx)) {
signed long long cl;
- if (!ctx.vlen)
+ if (!ctx.vlen) {
+ msg->err_pos = ctx.line + ctx.val - rep->data;
goto hdr_response_bad;
+ }
- if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl))
+ if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl)) {
+ msg->err_pos = ctx.line + ctx.val - rep->data;
goto hdr_response_bad; /* parse failure */
+ }
- if (cl < 0)
+ if (cl < 0) {
+ msg->err_pos = ctx.line + ctx.val - rep->data;
goto hdr_response_bad;
+ }
- if ((txn->flags & TX_RES_CNT_LEN) && (msg->chunk_len != cl))
+ if ((txn->flags & TX_RES_CNT_LEN) && (msg->chunk_len != cl)) {
+ msg->err_pos = ctx.line + ctx.val - rep->data;
goto hdr_response_bad; /* already specified, was different */
+ }
txn->flags |= TX_RES_CNT_LEN | TX_RES_XFER_LEN;
msg->body_len = msg->chunk_len = cl;