ensure that they contain the expected values. This command is restricted and
can only be issued on sockets configured for levels "operator" or "admin".
-show errors [<iid>|<proxy>]
+show errors [<iid>|<proxy>] [request|response]
Dump last known request and response errors collected by frontends and
backends. If <iid> is specified, the limit the dump to errors concerning
either frontend or backend whose ID is <iid>. Proxy ID "-1" will cause
all instances to be dumped. If a proxy name is specified instead, its ID
- will be used as the filter. This command is restricted and can only be
- issued on sockets configured for levels "operator" or "admin".
+ will be used as the filter. If "request" or "response" is added after the
+ proxy name or ID, only request or response errors will be dumped. This
+ command is restricted and can only be issued on sockets configured for
+ levels "operator" or "admin".
The errors which may be collected are the last request and response errors
caused by protocol violations, often due to invalid characters in header
line.
Example :
- $ echo "show errors" | socat stdio /tmp/sock1
+ $ echo "show errors -1 response" | socat stdio /tmp/sock1
>>> [04/Mar/2009:15:46:56.081] backend http-in (#2) : invalid response
src 127.0.0.1, session #54, frontend fe-eth0 (#1), server s2 (#1)
response length 213 bytes, error at position 23:
struct {
int iid; /* if >= 0, ID of the proxy to filter on */
struct proxy *px; /* current proxy being dumped, NULL = not started yet. */
- unsigned int buf; /* buffer being dumped, 0 = req, 1 = rep */
+ unsigned int flag; /* bit0: buffer being dumped, 0 = req, 1 = resp ; bit1=skip req ; bit2=skip resp. */
unsigned int sid; /* session ID of error being dumped */
int ptr; /* <0: headers, >=0 : text pointer to restart from */
int bol; /* pointer to beginning of current line */
else
appctx->ctx.errors.iid = -1; // dump all proxies
+ appctx->ctx.errors.flag = 0;
+ if (strcmp(args[3], "request") == 0)
+ appctx->ctx.errors.flag |= 4; // ignore response
+ else if (strcmp(args[3], "response") == 0)
+ appctx->ctx.errors.flag |= 2; // ignore request
appctx->ctx.errors.px = NULL;
return 0;
}
}
appctx->ctx.errors.px = proxy;
- appctx->ctx.errors.buf = 0;
appctx->ctx.errors.bol = 0;
appctx->ctx.errors.ptr = -1;
}
while (appctx->ctx.errors.px) {
struct error_snapshot *es;
- if (appctx->ctx.errors.buf == 0)
+ if ((appctx->ctx.errors.flag & 1) == 0) {
es = &appctx->ctx.errors.px->invalid_req;
- else
+ if (appctx->ctx.errors.flag & 2) // skip req
+ goto next;
+ }
+ else {
es = &appctx->ctx.errors.px->invalid_rep;
+ if (appctx->ctx.errors.flag & 4) // skip resp
+ goto next;
+ }
if (!es->when.tv_sec)
goto next;
port = 0;
}
- switch (appctx->ctx.errors.buf) {
+ switch (appctx->ctx.errors.flag & 1) {
case 0:
chunk_appendf(&trash,
" frontend %s (#%d): invalid request\n"
next:
appctx->ctx.errors.bol = 0;
appctx->ctx.errors.ptr = -1;
- appctx->ctx.errors.buf++;
- if (appctx->ctx.errors.buf > 1) {
- appctx->ctx.errors.buf = 0;
+ appctx->ctx.errors.flag ^= 1;
+ if (!(appctx->ctx.errors.flag & 1))
appctx->ctx.errors.px = appctx->ctx.errors.px->next;
- }
}
/* dump complete */