I'm trying to modify haproxy-1.4.11 (on Ubuntu) to do some additional logging.
I've added to http_sess_log(), some experimental code:
--- a/src/proto_http.c Sat Mar 26 12:38:10 2011 -0400
+++ b/src/proto_http.c Sat Mar 26 19:18:30 2011 -0400
@@ -1081,6 +1081,7 @@
static char tmpline[MAX_SYSLOG_LEN];
int t_request;
int hdr;
+ struct hdr_ctx ctx;
/* if we don't want to log normal traffic, return now */
err = (s->flags & (SN_ERR_MASK | SN_REDISP)) ||
@@ -1149,6 +1150,14 @@
'#', url_encode_map, uri);
*(h++) = '"';
}
+
+ if (http_find_header("X-Unique-ID", txn->req.sol, &txn->hdr_idx, &ctx))
{
+ // if (h < tmpline + ctx.vlen - 4) {
+ // memcpy(tmpline, ctx.val, ctx.vlen);
+ // h += ctx.vlen;
+ // }
+ }
+
*h = '\0';
svid = (tolog & LW_SVID) ?
when this code runs, I get a segfault as soon as it tries to log anything. I'm
obviously calling http_find_header() wrong, but I can't figure out what I
should be doing. When I look at the resulting core file with gdb, it shows
that txn->req.sol is not initialized.
#0 http_find_header2 (name=0x44d6af "X-Unique-ID", len=11, sol=0x1 <Address
0x1 out of bounds>, idx=0x795960, ctx=0x7fff37575a80) at src/proto_http.c:513
513 eol = sol + idx->v[cur_idx].len;
Is there something I need to be doing to initialize the sol element of the
request?
--
Roy Smith
[email protected]