{
char *ptr, *end;
- ptr = txn->req.sol + txn->req.sl.rq.u;
+ ptr = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
end = ptr + txn->req.sl.rq.u_l;
if (ptr >= end)
if (!path)
return;
- len = txn->req.sl.rq.u_l + (txn->req.sol + txn->req.sl.rq.u) - path;
+ len = txn->req.sl.rq.u_l + (s->req->p + txn->req.sol + txn->req.sl.rq.u) - path;
if (rdr.len + len > rdr.size - 4) /* 4 for CRLF-CRLF */
return;
* complete. We can then record the response length and return
* to the caller which will be able to register it.
*/
- msg->sl.st.l = ptr - msg->sol;
+ msg->sl.st.l = ptr - msg_start - msg->sol;
return ptr;
#ifdef DEBUG_FULL
* complete. We can then record the request length and return
* to the caller which will be able to register it.
*/
- msg->sl.rq.l = ptr - msg->sol;
+ msg->sl.rq.l = ptr - msg_start - msg->sol;
return ptr;
}
len = strlen(h);
}
- if (!http_find_header2(h, len, txn->req.sol, &txn->hdr_idx, &ctx))
+ if (!http_find_header2(h, len, s->req->p + txn->req.sol, &txn->hdr_idx, &ctx))
return 0;
h = ctx.line + ctx.val;
/* Remove empty leading lines, as recommended by RFC2616. */
buffer_ignore(buf, ptr - beg);
}
- msg->som = ptr - buf->p;
- msg->sol = ptr;
+ msg->sol = msg->som = ptr - buf->p;
hdr_idx_init(idx);
state = HTTP_MSG_RPVER;
goto http_msg_rpver;
*/
hdr_idx_set_start(idx, msg->sl.st.l, *ptr == '\r');
- msg->sol = ptr;
+ msg->sol = ptr - buf->p;
if (likely(*ptr == '\r'))
EAT_AND_JUMP_OR_RETURN(http_msg_rpline_end, HTTP_MSG_RPLINE_END);
goto http_msg_rpline_end;
/* Remove empty leading lines, as recommended by RFC2616. */
buffer_ignore(buf, ptr - beg);
}
- msg->som = ptr - buf->p;
- msg->sol = ptr;
+ msg->sol = msg->som = ptr - buf->p;
/* we will need this when keep-alive will be supported
hdr_idx_init(idx);
*/
*/
hdr_idx_set_start(idx, msg->sl.rq.l, *ptr == '\r');
- msg->sol = ptr;
+ msg->sol = ptr - buf->p;
if (likely(*ptr == '\r'))
EAT_AND_JUMP_OR_RETURN(http_msg_rqline_end, HTTP_MSG_RQLINE_END);
goto http_msg_rqline_end;
*/
case HTTP_MSG_HDR_FIRST:
http_msg_hdr_first:
- msg->sol = ptr;
+ msg->sol = ptr - buf->p;
if (likely(!HTTP_IS_CRLF(*ptr))) {
goto http_msg_hdr_name;
}
* first CR or LF so we know how the line ends. We insert last
* header into the index.
*/
- if (unlikely(hdr_idx_add((msg->eol + buf->p) - msg->sol, buf->p[msg->eol] == '\r',
+ if (unlikely(hdr_idx_add(msg->eol - msg->sol, buf->p[msg->eol] == '\r',
idx, idx->tail) < 0))
goto http_msg_invalid;
- msg->sol = ptr;
+ msg->sol = ptr - buf->p;
if (likely(!HTTP_IS_CRLF(*ptr))) {
goto http_msg_hdr_name;
}
EXPECT_LF_HERE(ptr, http_msg_invalid);
ptr++;
msg->sov = msg->next = ptr - buf->p;
- msg->eoh = msg->sol - buf->p;
- msg->sol = buf->p;
+ msg->eoh = msg->sol;
+ msg->sol = 0;
msg->msg_state = HTTP_MSG_BODY;
return;
if (msg->sl.rq.v_l != 0)
return 1;
- cur_end = msg->sol + msg->sl.rq.l;
+ cur_end = req->p + msg->sol + msg->sl.rq.l;
delta = 0;
if (msg->sl.rq.u_l == 0) {
cur_end += delta;
cur_end = (char *)http_parse_reqline(msg, req->data,
HTTP_MSG_RQMETH,
- msg->sol, cur_end + 1,
+ req->p + msg->sol, cur_end + 1,
NULL, NULL);
if (unlikely(!cur_end))
return 0;
ctx.idx = 0;
txn->flags &= ~(TX_CON_KAL_SET|TX_CON_CLO_SET);
- while (http_find_header2(hdr_val, hdr_len, msg->sol, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_val, hdr_len, buf->p + msg->sol, &txn->hdr_idx, &ctx)) {
if (ctx.vlen >= 10 && word_match(ctx.line + ctx.val, ctx.vlen, "keep-alive", 10)) {
txn->flags |= TX_HDR_CONN_KAL;
if ((to_del & 2) && buf)
}
txn->flags &= ~(TX_CON_CLO_SET | TX_CON_KAL_SET);
- while (http_find_header2(hdr_val, hdr_len, msg->sol, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_val, hdr_len, buf->p + msg->sol, &txn->hdr_idx, &ctx)) {
if (ctx.vlen >= 10 && word_match(ctx.line + ctx.val, ctx.vlen, "keep-alive", 10)) {
if (wanted & TX_CON_KAL_SET)
txn->flags |= TX_CON_KAL_SET;
/* This function may only be used when the buffer's o is empty */
void http_buffer_heavy_realign(struct buffer *buf, struct http_msg *msg)
{
- char *end = buf->data + buf->size;
int off = buf->data + buf->size - buf->p;
/* two possible cases :
/* adjust all known pointers */
buf->p = buf->data;
- msg->sol += off; if (msg->sol >= end) msg->sol -= buf->size;
if (msg->err_pos >= 0) {
msg->err_pos += off;
/*
* 1: identify the method
*/
- txn->meth = find_http_meth(msg->sol, msg->sl.rq.m_l);
+ txn->meth = find_http_meth(req->p + msg->sol, msg->sl.rq.m_l);
/* we can make use of server redirect on GET and HEAD */
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
*/
if (unlikely((s->fe->monitor_uri_len != 0) &&
(s->fe->monitor_uri_len == msg->sl.rq.u_l) &&
- !memcmp(msg->sol + msg->sl.rq.u,
+ !memcmp(req->p + msg->sol + msg->sl.rq.u,
s->fe->monitor_uri,
s->fe->monitor_uri_len))) {
/*
/* ... and check if the request is HTTP/1.1 or above */
if ((msg->sl.rq.v_l == 8) &&
- ((msg->sol[msg->sl.rq.v + 5] > '1') ||
- ((msg->sol[msg->sl.rq.v + 5] == '1') &&
- (msg->sol[msg->sl.rq.v + 7] >= '1'))))
+ ((req->p[msg->sol + msg->sl.rq.v + 5] > '1') ||
+ ((req->p[msg->sol + msg->sl.rq.v + 5] == '1') &&
+ (req->p[msg->sol + msg->sl.rq.v + 7] >= '1'))))
msg->flags |= HTTP_MSGF_VER_11;
/* "connection" has not been parsed yet */
* CONNECT ip:port.
*/
if ((s->fe->options2 & PR_O2_USE_PXHDR) &&
- msg->sol[msg->sl.rq.u] != '/' && msg->sol[msg->sl.rq.u] != '*')
+ req->p[msg->sol + msg->sl.rq.u] != '/' && req->p[msg->sol + msg->sl.rq.u] != '*')
txn->flags |= TX_USE_PX_CONN;
/* transfer length unknown*/
/* 5: we may need to capture headers */
if (unlikely((s->logs.logwait & LW_REQHDR) && txn->req.cap))
- capture_headers(msg->sol, &txn->hdr_idx,
+ capture_headers(req->p + msg->sol, &txn->hdr_idx,
txn->req.cap, s->fe->req_cap);
/* 6: determine the transfer-length.
ctx.idx = 0;
/* set TE_CHNK and XFER_LEN only if "chunked" is seen last */
while ((msg->flags & HTTP_MSGF_VER_11) &&
- http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Transfer-Encoding", 17, req->p + msg->sol, &txn->hdr_idx, &ctx)) {
if (ctx.vlen == 7 && strncasecmp(ctx.line + ctx.val, "chunked", 7) == 0)
msg->flags |= (HTTP_MSGF_TE_CHNK | HTTP_MSGF_XFER_LEN);
else if (msg->flags & HTTP_MSGF_TE_CHNK) {
ctx.idx = 0;
while (!(msg->flags & HTTP_MSGF_TE_CHNK) && !use_close_only &&
- http_find_header2("Content-Length", 14, msg->sol, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Content-Length", 14, req->p + msg->sol, &txn->hdr_idx, &ctx)) {
signed long long cl;
if (!ctx.vlen) {
struct hdr_ctx ctx;
ctx.idx = 0;
/* Expect is allowed in 1.1, look for it */
- if (http_find_header2("Expect", 6, msg->sol, &txn->hdr_idx, &ctx) &&
+ if (http_find_header2("Expect", 6, req->p + msg->sol, &txn->hdr_idx, &ctx) &&
unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
buffer_write(s->rep, http_100_chunk.str, http_100_chunk.len);
}
path = http_get_path(txn);
/* build message using path */
if (path) {
- pathlen = txn->req.sl.rq.u_l + (txn->req.sol + txn->req.sl.rq.u) - path;
+ pathlen = txn->req.sl.rq.u_l + (req->p + txn->req.sol + txn->req.sl.rq.u) - path;
if (rule->flags & REDIRECT_FLAG_DROP_QS) {
int qs = 0;
while (qs < pathlen) {
* parsing incoming request.
*/
if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SN_ADDR_SET)) {
- url2sa(msg->sol + msg->sl.rq.u, msg->sl.rq.u_l, &s->req->cons->addr.to);
+ url2sa(req->p + msg->sol + msg->sl.rq.u, msg->sl.rq.u_l, &s->req->cons->addr.to);
}
/*
/* It needs to look into the URI unless persistence must be ignored */
if ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SN_IGNORE_PRST)) {
- get_srv_from_appsession(s, msg->sol + msg->sl.rq.u, msg->sl.rq.u_l);
+ get_srv_from_appsession(s, req->p + msg->sol + msg->sl.rq.u, msg->sl.rq.u_l);
}
/* add unique-id if "header-unique-id" is specified */
struct hdr_ctx ctx = { .idx = 0 };
if (!((s->fe->options | s->be->options) & PR_O_FF_ALWAYS) &&
- http_find_header2(s->be->fwdfor_hdr_name, s->be->fwdfor_hdr_len, txn->req.sol, &txn->hdr_idx, &ctx)) {
+ http_find_header2(s->be->fwdfor_hdr_name, s->be->fwdfor_hdr_len, req->p + txn->req.sol, &txn->hdr_idx, &ctx)) {
/* The header is set to be added only if none is present
* and we found it, so don't do anything.
*/
struct hdr_ctx ctx;
ctx.idx = 0;
/* Expect is allowed in 1.1, look for it */
- if (http_find_header2("Expect", 6, msg->sol, &txn->hdr_idx, &ctx) &&
+ if (http_find_header2("Expect", 6, req->p + msg->sol, &txn->hdr_idx, &ctx) &&
unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
buffer_write(s->rep, http_100_chunk.str, http_100_chunk.len);
}
ctx.idx = 0;
- while (http_find_header2(hdr_name, hdr_name_len, msg->sol, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_name, hdr_name_len, buf->p + msg->sol, &txn->hdr_idx, &ctx)) {
/* remove any existing values from the header */
http_remove_header2(msg, buf, &txn->hdr_idx, &ctx);
}
/*
* 1: get the status code
*/
- n = msg->sol[msg->sl.st.c] - '0';
+ n = rep->p[msg->sol + msg->sl.st.c] - '0';
if (n < 1 || n > 5)
n = 0;
/* when the client triggers a 4xx from the server, it's most often due
/* check if the response is HTTP/1.1 or above */
if ((msg->sl.st.v_l == 8) &&
- ((msg->sol[5] > '1') ||
- ((msg->sol[5] == '1') &&
- (msg->sol[7] >= '1'))))
+ ((rep->p[msg->sol + 5] > '1') ||
+ ((rep->p[msg->sol + 5] == '1') &&
+ (rep->p[msg->sol + 7] >= '1'))))
msg->flags |= HTTP_MSGF_VER_11;
/* "connection" has not been parsed yet */
/* transfer length unknown*/
msg->flags &= ~HTTP_MSGF_XFER_LEN;
- txn->status = strl2ui(msg->sol + msg->sl.st.c, msg->sl.st.c_l);
+ txn->status = strl2ui(rep->p + msg->sol + msg->sl.st.c, msg->sl.st.c_l);
/* Adjust server's health based on status code. Note: status codes 501
* and 505 are triggered on demand by client request, so we must not
*/
s->logs.logwait &= ~LW_RESP;
if (unlikely((s->logs.logwait & LW_RSPHDR) && txn->rsp.cap))
- capture_headers(msg->sol, &txn->hdr_idx,
+ capture_headers(rep->p + msg->sol, &txn->hdr_idx,
txn->rsp.cap, s->fe->rsp_cap);
/* 4: determine the transfer-length.
use_close_only = 0;
ctx.idx = 0;
while ((msg->flags & HTTP_MSGF_VER_11) &&
- http_find_header2("Transfer-Encoding", 17, msg->sol, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Transfer-Encoding", 17, rep->p + msg->sol, &txn->hdr_idx, &ctx)) {
if (ctx.vlen == 7 && strncasecmp(ctx.line + ctx.val, "chunked", 7) == 0)
msg->flags |= (HTTP_MSGF_TE_CHNK | HTTP_MSGF_XFER_LEN);
else if (msg->flags & HTTP_MSGF_TE_CHNK) {
/* FIXME: below we should remove the content-length header(s) in case of chunked encoding */
ctx.idx = 0;
while (!(msg->flags & HTTP_MSGF_TE_CHNK) && !use_close_only &&
- http_find_header2("Content-Length", 14, msg->sol, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Content-Length", 14, rep->p + msg->sol, &txn->hdr_idx, &ctx)) {
signed long long cl;
if (!ctx.vlen) {
*/
if (unlikely(txn->status == 100)) {
hdr_idx_init(&txn->hdr_idx);
- msg->next -= buffer_forward(rep, rep->p + msg->next - msg->sol);
+ msg->next -= buffer_forward(rep, msg->next - msg->sol);
msg->msg_state = HTTP_MSG_RPBEFORE;
txn->status = 0;
rep->analysers |= AN_RES_WAIT_HTTP | an_bit;
last_hdr = 0;
- cur_next = txn->req.sol + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = req->p + txn->req.sol + hdr_idx_first_pos(&txn->hdr_idx);
old_idx = 0;
while (!last_hdr) {
done = 0;
- cur_ptr = txn->req.sol;
+ cur_ptr = req->p + txn->req.sol;
cur_end = cur_ptr + txn->req.sl.rq.l;
/* Now we have the request line between cur_ptr and cur_end */
/* Iterate through the headers, we start with the start line. */
old_idx = 0;
- hdr_next = txn->req.sol + hdr_idx_first_pos(&txn->hdr_idx);
+ hdr_next = req->p + txn->req.sol + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[old_idx].next)) {
struct hdr_idx_elem *cur_hdr;
last_hdr = 0;
- cur_next = txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = rtr->p + txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
old_idx = 0;
while (!last_hdr) {
done = 0;
- cur_ptr = txn->rsp.sol;
+ cur_ptr = rtr->p + txn->rsp.sol;
cur_end = cur_ptr + txn->rsp.sl.st.l;
/* Now we have the status line between cur_ptr and cur_end */
/* we have a full respnse and we know that we have either a CR
* or an LF at <ptr>.
*/
- txn->status = strl2ui(txn->rsp.sol + txn->rsp.sl.st.c, txn->rsp.sl.st.c_l);
+ txn->status = strl2ui(rtr->p + txn->rsp.sol + txn->rsp.sl.st.c, txn->rsp.sl.st.c_l);
hdr_idx_set_start(&txn->hdr_idx, txn->rsp.sl.st.l, *cur_end == '\r');
/* there is no point trying this regex on headers */
return 1;
* we start with the start line.
*/
old_idx = 0;
- hdr_next = txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
+ hdr_next = res->p + txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[old_idx].next)) {
struct hdr_idx_elem *cur_hdr;
* we start with the start line.
*/
cur_idx = 0;
- cur_next = txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = rtr->p + txn->rsp.sol + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[cur_idx].next)) {
struct hdr_idx_elem *cur_hdr;
int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct proxy *backend)
{
struct uri_auth *uri_auth = backend->uri_auth;
- char *h;
+ struct http_msg *msg = &txn->req;
+ const char *uri = msg->buf->p + msg->sol + msg->sl.rq.u;
+ const char *h;
if (!uri_auth)
return 0;
si->applet.ctx.stats.st_code = STAT_STATUS_INIT;
/* check URI size */
- if (uri_auth->uri_len > txn->req.sl.rq.u_l)
+ if (uri_auth->uri_len > msg->sl.rq.u_l)
return 0;
- h = txn->req.sol + txn->req.sl.rq.u;
-
- /* the URI is in h */
+ h = uri;
if (memcmp(h, uri_auth->uri_prefix, uri_auth->uri_len) != 0)
return 0;
h += uri_auth->uri_len;
- while (h <= txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l - 3) {
+ while (h <= uri + msg->sl.rq.u_l - 3) {
if (memcmp(h, ";up", 3) == 0) {
si->applet.ctx.stats.flags |= STAT_HIDE_DOWN;
break;
}
if (uri_auth->refresh) {
- h = txn->req.sol + txn->req.sl.rq.u + uri_auth->uri_len;
- while (h <= txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l - 10) {
+ h = uri + uri_auth->uri_len;
+ while (h <= uri + msg->sl.rq.u_l - 10) {
if (memcmp(h, ";norefresh", 10) == 0) {
si->applet.ctx.stats.flags |= STAT_NO_REFRESH;
break;
}
}
- h = txn->req.sol + txn->req.sl.rq.u + uri_auth->uri_len;
- while (h <= txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l - 4) {
+ h = uri + uri_auth->uri_len;
+ while (h <= uri + msg->sl.rq.u_l - 4) {
if (memcmp(h, ";csv", 4) == 0) {
si->applet.ctx.stats.flags |= STAT_FMT_CSV;
break;
h++;
}
- h = txn->req.sol + txn->req.sl.rq.u + uri_auth->uri_len;
- while (h <= txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l - 8) {
+ h = uri + uri_auth->uri_len;
+ while (h <= uri + msg->sl.rq.u_l - 8) {
if (memcmp(h, ";st=", 4) == 0) {
int i;
h += 4;
if (occ >= 0) {
/* search from the beginning */
- while (http_find_header2(hname, hlen, msg->sol, idx, ctx)) {
+ while (http_find_header2(hname, hlen, msg->buf->p + msg->sol, idx, ctx)) {
occ--;
if (occ <= 0) {
*vptr = ctx->line + ctx->val;
return 0;
found = hist_ptr = 0;
- while (http_find_header2(hname, hlen, msg->sol, idx, ctx)) {
+ while (http_find_header2(hname, hlen, msg->buf->p + msg->sol, idx, ctx)) {
ptr_hist[hist_ptr] = ctx->line + ctx->val;
len_hist[hist_ptr] = ctx->vlen;
if (++hist_ptr >= MAX_HDR_HISTORY)
txn->cookie_last_date = 0;
txn->req.flags = 0;
- txn->req.sol = NULL;
- txn->req.eol = txn->req.som = txn->req.eoh = 0; /* relative to the buffer */
+ txn->req.sol = txn->req.eol = txn->req.som = txn->req.eoh = 0; /* relative to the buffer */
txn->req.next = 0;
txn->rsp.flags = 0;
- txn->rsp.sol = NULL;
- txn->rsp.eol = txn->rsp.som = txn->rsp.eoh = 0; /* relative to the buffer */
+ txn->rsp.sol = txn->rsp.eol = txn->rsp.som = txn->rsp.eoh = 0; /* relative to the buffer */
txn->rsp.next = 0;
txn->req.chunk_len = 0LL;
txn->req.body_len = 0LL;
/* ensure the indexes are not affected */
return 0;
temp_pattern.data.str.len = txn->req.sl.rq.m_l;
- temp_pattern.data.str.str = txn->req.sol;
+ temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol;
}
test->flags = ACL_TEST_F_READ_ONLY | ACL_TEST_F_VOL_1ST;
return 1;
return 0;
len = txn->req.sl.rq.v_l;
- ptr = txn->req.sol + txn->req.sl.rq.v;
+ ptr = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.v;
while ((len-- > 0) && (*ptr++ != '/'));
if (len <= 0)
return 0;
len = txn->rsp.sl.st.v_l;
- ptr = txn->rsp.sol;
+ ptr = txn->rsp.buf->p + txn->rsp.sol;
while ((len-- > 0) && (*ptr++ != '/'));
if (len <= 0)
return 0;
len = txn->rsp.sl.st.c_l;
- ptr = txn->rsp.sol + txn->rsp.sl.st.c;
+ ptr = txn->rsp.buf->p + txn->rsp.sol + txn->rsp.sl.st.c;
temp_pattern.data.integer = __strl2ui(ptr, len);
test->flags = ACL_TEST_F_VOL_1ST;
return 0;
temp_pattern.data.str.len = txn->req.sl.rq.u_l;
- temp_pattern.data.str.str = txn->req.sol + txn->req.sl.rq.u;
+ temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
/* we do not need to set READ_ONLY because the data is in a buffer */
test->flags = ACL_TEST_F_VOL_1ST;
return 0;
/* Parse HTTP request */
- url2sa(txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
+ url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
if (((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_family != AF_INET)
return 0;
temp_pattern.type = PATTERN_TYPE_IP;
return 0;
/* Same optimization as url_ip */
- url2sa(txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
+ url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
temp_pattern.data.integer = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port);
if (px->options & PR_O_HTTP_PROXY)
/* ensure the indexes are not affected */
return 0;
- return acl_fetch_hdr(px, l4, txn, txn->req.sol, expr, test);
+ return acl_fetch_hdr(px, l4, txn, txn->req.buf->p + txn->req.sol, expr, test);
}
static int
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
- return acl_fetch_hdr(px, l4, txn, txn->rsp.sol, expr, test);
+ return acl_fetch_hdr(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, expr, test);
}
/* 6. Check on HTTP header count. The number of occurrences is returned.
/* ensure the indexes are not affected */
return 0;
- return acl_fetch_hdr_cnt(px, l4, txn, txn->req.sol, expr, test);
+ return acl_fetch_hdr_cnt(px, l4, txn, txn->req.buf->p + txn->req.sol, expr, test);
}
static int
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
- return acl_fetch_hdr_cnt(px, l4, txn, txn->rsp.sol, expr, test);
+ return acl_fetch_hdr_cnt(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, expr, test);
}
/* 7. Check on HTTP header's integer value. The integer value is returned.
/* ensure the indexes are not affected */
return 0;
- return acl_fetch_hdr_val(px, l4, txn, txn->req.sol, expr, test);
+ return acl_fetch_hdr_val(px, l4, txn, txn->req.buf->p + txn->req.sol, expr, test);
}
static int
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
- return acl_fetch_hdr_val(px, l4, txn, txn->rsp.sol, expr, test);
+ return acl_fetch_hdr_val(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, expr, test);
}
/* 7. Check on HTTP header's IPv4 address value. The IPv4 address is returned.
/* ensure the indexes are not affected */
return 0;
- return acl_fetch_hdr_ip(px, l4, txn, txn->req.sol, expr, test);
+ return acl_fetch_hdr_ip(px, l4, txn, txn->req.buf->p + txn->req.sol, expr, test);
}
static int
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
- return acl_fetch_hdr_ip(px, l4, txn, txn->rsp.sol, expr, test);
+ return acl_fetch_hdr_ip(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, expr, test);
}
/* 8. Check on URI PATH. A pointer to the PATH is stored. The path starts at
/* ensure the indexes are not affected */
return 0;
- end = txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
+ end = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
ptr = http_get_path(txn);
if (!ptr)
return 0;
/* OK we got a valid HTTP request. We have some minor preparation to
* perform so that further checks can rely on HTTP tests.
*/
- txn->meth = find_http_meth(msg->sol, msg->sl.rq.m_l);
+ txn->meth = find_http_meth(msg->buf->p + msg->sol, msg->sl.rq.m_l);
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
s->flags |= SN_REDIRECTABLE;
return 0;
/* The Cookie header allows multiple cookies on the same line */
- return acl_fetch_any_cookie_value(px, l4, txn, txn->req.sol, "Cookie", 6, 1, expr, test);
+ return acl_fetch_any_cookie_value(px, l4, txn, txn->req.buf->p + txn->req.sol, "Cookie", 6, 1, expr, test);
}
static int
return 0;
/* The Set-Cookie header allows only one cookie on the same line */
- return acl_fetch_any_cookie_value(px, l4, txn, txn->rsp.sol, "Set-Cookie", 10, 0, expr, test);
+ return acl_fetch_any_cookie_value(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, "Set-Cookie", 10, 0, expr, test);
}
/* Iterate over all cookies present in a request to count how many occurrences
return 0;
/* The Cookie header allows multiple cookies on the same line */
- return acl_fetch_any_cookie_cnt(px, l4, txn, txn->req.sol, "Cookie", 6, 1, expr, test);
+ return acl_fetch_any_cookie_cnt(px, l4, txn, txn->req.buf->p + txn->req.sol, "Cookie", 6, 1, expr, test);
}
static int
return 0;
/* The Set-Cookie header allows only one cookie on the same line */
- return acl_fetch_any_cookie_cnt(px, l4, txn, txn->rsp.sol, "Set-Cookie", 10, 0, expr, test);
+ return acl_fetch_any_cookie_cnt(px, l4, txn, txn->rsp.buf->p + txn->rsp.sol, "Set-Cookie", 10, 0, expr, test);
}
/************************************************************************/
char *url_param_value;
size_t url_param_value_l;
- if (!find_url_param_value(msg->sol + msg->sl.rq.u, msg->sl.rq.u_l,
+ if (!find_url_param_value(msg->buf->p + msg->sol + msg->sl.rq.u, msg->sl.rq.u_l,
arg_p->data.str.str, arg_p->data.str.len,
&url_param_value, &url_param_value_l))
return 0;
int found = 0;
ctx.idx = 0;
- while (http_find_header2(hdr_name, hdr_name_len, msg->sol, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_name, hdr_name_len, msg->buf->p + msg->sol, &txn->hdr_idx, &ctx)) {
char *hdr, *end;
-
if (ctx.vlen < cookie_name_l + 1)
continue;