diff --git a/include/types/proxy.h b/include/types/proxy.h index 4766e130d..26af50154 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -177,7 +177,15 @@ struct error_snapshot { unsigned int sid; /* ID of the faulty session */ unsigned int ev_id; /* event number (counter incremented for each capture) */ unsigned int state; /* message state before the error (when saved) */ - unsigned int flags; /* buffer flags */ + unsigned int b_flags; /* buffer flags */ + unsigned int s_flags; /* session flags */ + unsigned int t_flags; /* transaction flags */ + unsigned int m_flags; /* message flags */ + unsigned int b_out; /* pending output bytes */ + unsigned int b_wrap; /* position where the buffer is expected to wrap */ + unsigned long long b_tot; /* total bytes transferred via this buffer */ + unsigned long long m_clen; /* chunk len for this message */ + unsigned long long m_blen; /* body len for this message */ struct server *srv; /* server associated with the error (or NULL) */ struct proxy *oe; /* other end = frontend or backend involved */ struct sockaddr_storage src; /* client's address */ diff --git a/src/dumpstats.c b/src/dumpstats.c index 465844f84..ae19db796 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -3925,43 +3925,55 @@ static int stats_dump_errors_to_buffer(struct stream_interface *si) char pn[INET6_ADDRSTRLEN]; struct tm tm; + int port; get_localtime(es->when.tv_sec, &tm); chunk_printf(&msg, " \n[%02d/%s/%04d:%02d:%02d:%02d.%03d]", tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(es->when.tv_usec/1000)); - addr_to_str(&es->src, pn, sizeof(pn)); + switch (addr_to_str(&es->src, pn, sizeof(pn))) { + case AF_INET: + case AF_INET6: + port = get_host_port(&es->src); + break; + default: + port = 0; + } + switch (si->applet.ctx.errors.buf) { case 0: chunk_printf(&msg, " frontend %s (#%d): invalid request\n" - " src %s, session #%d, backend %s (#%d), server %s (#%d)\n" - " HTTP internal state %d, buffer flags 0x%08x, event #%u\n" - " request length %d bytes, error at position %d:\n \n", + " backend %s (#%d)", si->applet.ctx.errors.px->id, si->applet.ctx.errors.px->uuid, - pn, es->sid, (es->oe->cap & PR_CAP_BE) ? es->oe->id : "", - (es->oe->cap & PR_CAP_BE) ? es->oe->uuid : -1, - es->srv ? es->srv->id : "", - es->srv ? es->srv->puid : -1, - es->state, es->flags, es->ev_id, - es->len, es->pos); + (es->oe->cap & PR_CAP_BE) ? es->oe->id : "", + (es->oe->cap & PR_CAP_BE) ? es->oe->uuid : -1); break; case 1: chunk_printf(&msg, " backend %s (#%d) : invalid response\n" - " src %s, session #%d, frontend %s (#%d), server %s (#%d)\n" - " HTTP internal state %d, buffer flags 0x%08x, event #%u\n" - " response length %d bytes, error at position %d:\n \n", + " frontend %s (#%d)", si->applet.ctx.errors.px->id, si->applet.ctx.errors.px->uuid, - pn, es->sid, es->oe->id, es->oe->uuid, - es->srv ? es->srv->id : "", - es->srv ? es->srv->puid : -1, - es->state, es->flags, es->ev_id, - es->len, es->pos); + es->oe->id, es->oe->uuid); break; } + chunk_printf(&msg, + ", server %s (#%d), event #%u\n" + " src %s:%d, session #%d, session flags 0x%08x\n" + " HTTP msg state %d, msg flags 0x%08x, tx flags 0x%08x\n" + " HTTP chunk len %lld bytes, HTTP body len %lld bytes\n" + " buffer flags 0x%08x, out %d bytes, total %lld bytes\n" + " pending %d bytes, wrapping at %d, error at position %d:\n \n", + es->srv ? es->srv->id : "", es->srv ? es->srv->puid : -1, + es->ev_id, + pn, port, es->sid, es->s_flags, + es->state, es->m_flags, es->t_flags, + es->m_clen, es->m_blen, + es->b_flags, es->b_out, es->b_tot, + es->len, es->b_wrap, es->pos); + if (bi_putchk(si->ib, &msg) == -1) { /* Socket buffer full. Let's try again later from the same point */ return 0; diff --git a/src/proto_http.c b/src/proto_http.c index aec711cb7..5f169152d 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7235,8 +7235,16 @@ void http_capture_bad_message(struct error_snapshot *es, struct session *s, es->oe = other_end; es->src = s->req->prod->addr.from; es->state = state; - es->flags = buf->flags; es->ev_id = error_snapshot_id++; + es->b_flags = buf->flags; + es->s_flags = s->flags; + es->t_flags = s->txn.flags; + es->m_flags = msg->flags; + es->b_out = buf->o; + es->b_wrap = buf->data + buf->size - buf->p; + es->b_tot = buf->total; + es->m_clen = msg->chunk_len; + es->m_blen = msg->body_len; } /* Return in and the pointer and length of occurrence of