]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: snapshot: start to reorder the HTTP snapshot output a little bit
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Sep 2018 11:49:44 +0000 (13:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Sep 2018 15:48:14 +0000 (17:48 +0200)
The output of "show errors" was slightly reordered to split the HTTP part
in a single chunk_appendf() call. The useless buffer total input was
replaced to report the buffer's start offset, which is the offset in the
stream of the first input byte (thus not counting output). Also it was
the opportunity to stop calling the stream "session".

src/proto_http.c

index 2555c66994a6646a541d1bd45071e2e45e163f96..65f0636e8ac661b66cc8607f8fbbc22a5642e1ad 100644 (file)
@@ -8056,6 +8056,12 @@ void http_capture_bad_message(struct proxy *proxy, struct error_snapshot *es, st
        es->buf_out  = co_data(chn);
        es->buf_ofs  = chn->total;
 
+       /* be sure to indicate the offset of the first IN byte */
+       if (es->buf_ofs >= es->buf_len)
+               es->buf_ofs -= es->buf_len;
+       else
+               es->buf_ofs = 0;
+
        /* http-specific part now */
        es->ctx.http.sid  = s->uniq_id;
        es->ctx.http.state = state;
@@ -12766,20 +12772,24 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
                        }
 
                        chunk_appendf(&trash,
-                                    ", server %s (#%d), event #%u\n"
-                                    "  src %s:%d, session #%d, session flags 0x%08x\n"
-                                    "  HTTP msg state %s(%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 : "<NONE>", es->srv ? es->srv->puid : -1,
-                                    es->ev_id,
-                                    pn, port, es->ctx.http.sid, es->ctx.http.s_flags,
-                                    h1_msg_state_str(es->ctx.http.state), es->ctx.http.state,
-                                    es->ctx.http.m_flags, es->ctx.http.t_flags,
-                                    es->ctx.http.m_clen, es->ctx.http.m_blen,
-                                    es->ctx.http.b_flags, es->buf_out, es->buf_ofs,
-                                    es->buf_len, es->buf_wrap, es->buf_err);
+                                     ", server %s (#%d), event #%u, src %s:%d\n"
+                                     "  buffer starts at %llu (including %u out), %u free,\n"
+                                     "  len %u, wraps at %u, error at position %u\n",
+                                     es->srv ? es->srv->id : "<NONE>",
+                                     es->srv ? es->srv->puid : -1,
+                                     es->ev_id, pn, port,
+                                     es->buf_ofs, es->buf_out,
+                                     global.tune.bufsize - es->buf_out - es->buf_len,
+                                     es->buf_len, es->buf_wrap, es->buf_err);
+
+                       chunk_appendf(&trash,
+                                     "  stream #%d, stream flags 0x%08x, tx flags 0x%08x\n"
+                                     "  HTTP msg state %s(%d), msg flags 0x%08x\n"
+                                     "  HTTP chunk len %lld bytes, HTTP body len %lld bytes, channel flags 0x%08x :\n  \n",
+                                     es->ctx.http.sid, es->ctx.http.s_flags, es->ctx.http.t_flags,
+                                     h1_msg_state_str(es->ctx.http.state), es->ctx.http.state,
+                                     es->ctx.http.m_flags, es->ctx.http.m_clen,
+                                     es->ctx.http.m_blen, es->ctx.http.b_flags);
 
                        if (ci_putchk(si_ic(si), &trash) == -1) {
                                /* Socket buffer full. Let's try again later from the same point */