mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-01 22:48:25 +00:00
[DEBUG] add an http_silent_debug function to debug HTTP states
This function outputs to fd #-1 the status of request and response buffers, the transaction states, the stream interface states, etc... That way, it's easy to find that output in an strace report, correctly placed WRT the other syscalls.
This commit is contained in:
parent
f5c8bd6a99
commit
e988a79c74
@ -360,6 +360,32 @@ const char http_is_ver_token[256] = {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Silent debug that outputs only in strace, using fd #-1. Trash is modified.
|
||||
*/
|
||||
#if defined(DEBUG_FSM)
|
||||
static void http_silent_debug(int line, struct session *s)
|
||||
{
|
||||
int size = 0;
|
||||
size += snprintf(trash + size, sizeof(trash) - size,
|
||||
"[%04d] req: p=%d(%d) s=%d bf=%08x an=%08x data=%p size=%d l=%d w=%p r=%p lr=%p sm=%d fw=%ld tf=%08x\n",
|
||||
line,
|
||||
s->si[0].state, s->si[0].fd, s->txn.req.msg_state, s->req->flags, s->req->analysers,
|
||||
s->req->data, s->req->size, s->req->l, s->req->w, s->req->r, s->req->lr, s->req->send_max, s->req->to_forward, s->txn.flags);
|
||||
write(-1, trash, size);
|
||||
size = 0;
|
||||
size += snprintf(trash + size, sizeof(trash) - size,
|
||||
" %04d rep: p=%d(%d) s=%d bf=%08x an=%08x data=%p size=%d l=%d w=%p r=%p lr=%p sm=%d fw=%ld\n",
|
||||
line,
|
||||
s->si[1].state, s->si[1].fd, s->txn.rsp.msg_state, s->rep->flags, s->rep->analysers,
|
||||
s->rep->data, s->rep->size, s->rep->l, s->rep->w, s->rep->r, s->rep->lr, s->rep->send_max, s->rep->to_forward);
|
||||
|
||||
write(-1, trash, size);
|
||||
}
|
||||
#else
|
||||
#define http_silent_debug(l,s) do { } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Adds a header and its CRLF at the tail of buffer <b>, just before the last
|
||||
* CRLF. Text length is measured first, so it cannot be NULL.
|
||||
|
Loading…
Reference in New Issue
Block a user