"[%04d] req: p=%d(%d) s=%d bf=%08x an=%08x data=%p size=%d l=%d w=%p r=%p o=%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->buf.data, s->req->buf.size, s->req->l, s->req->w, s->req->r, s->req->buf.p, s->req->buf.o, s->req->to_forward, s->txn.flags);
+ s->req->buf->data, s->req->buf->size, s->req->l, s->req->w, s->req->r, s->req->buf->p, s->req->buf->o, s->req->to_forward, s->txn.flags);
write(-1, trash, size);
size = 0;
size += snprintf(trash + size, trashlen - size,
" %04d rep: p=%d(%d) s=%d bf=%08x an=%08x data=%p size=%d l=%d w=%p r=%p o=%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->buf.data, s->rep->buf.size, s->rep->l, s->rep->w, s->rep->r, s->rep->buf.p, s->rep->buf.o, s->rep->to_forward);
+ s->rep->buf->data, s->rep->buf->size, s->rep->l, s->rep->w, s->rep->r, s->rep->buf->p, s->rep->buf->o, s->rep->to_forward);
write(-1, trash, size);
}
int bytes, len;
len = strlen(text);
- bytes = buffer_insert_line2(&msg->chn->buf, msg->chn->buf.p + msg->eoh, text, len);
+ bytes = buffer_insert_line2(msg->chn->buf, msg->chn->buf->p + msg->eoh, text, len);
if (!bytes)
return -1;
http_msg_move_end(msg, bytes);
{
int bytes;
- bytes = buffer_insert_line2(&msg->chn->buf, msg->chn->buf.p + msg->eoh, text, len);
+ bytes = buffer_insert_line2(msg->chn->buf, msg->chn->buf->p + msg->eoh, text, len);
if (!bytes)
return -1;
http_msg_move_end(msg, bytes);
hdr = &idx->v[cur_idx];
if (sol[ctx->del] == ':' && ctx->val + ctx->vlen + ctx->tws == hdr->len) {
/* This was the only value of the header, we must now remove it entirely. */
- delta = buffer_replace2(&msg->chn->buf, sol, sol + hdr->len + hdr->cr + 1, NULL, 0);
+ delta = buffer_replace2(msg->chn->buf, sol, sol + hdr->len + hdr->cr + 1, NULL, 0);
http_msg_move_end(msg, delta);
idx->used--;
hdr->len = 0; /* unused entry */
*/
skip_comma = (ctx->val + ctx->vlen + ctx->tws == hdr->len) ? 0 : 1;
- delta = buffer_replace2(&msg->chn->buf, sol + ctx->del + skip_comma,
+ delta = buffer_replace2(msg->chn->buf, sol + ctx->del + skip_comma,
sol + ctx->val + ctx->vlen + ctx->tws + skip_comma,
NULL, 0);
hdr->len += delta;
{
char *ptr, *end;
- ptr = txn->req.chn->buf.p + txn->req.sl.rq.u;
+ ptr = txn->req.chn->buf->p + txn->req.sl.rq.u;
end = ptr + txn->req.sl.rq.u_l;
if (ptr >= end)
* to temporarily rewind the buffer.
*/
txn = &s->txn;
- b_rew(&s->req->buf, rewind = s->req->buf.o);
+ b_rew(s->req->buf, rewind = s->req->buf->o);
path = http_get_path(txn);
- len = buffer_count(&s->req->buf, path, b_ptr(&s->req->buf, txn->req.sl.rq.u + txn->req.sl.rq.u_l));
+ len = buffer_count(s->req->buf, path, b_ptr(s->req->buf, txn->req.sl.rq.u + txn->req.sl.rq.u_l));
- b_adv(&s->req->buf, rewind);
+ b_adv(s->req->buf, rewind);
if (!path)
return;
unsigned int state, const char *ptr, const char *end,
unsigned int *ret_ptr, unsigned int *ret_state)
{
- const char *msg_start = msg->chn->buf.p;
+ const char *msg_start = msg->chn->buf->p;
switch (state) {
case HTTP_MSG_RPVER:
unsigned int state, const char *ptr, const char *end,
unsigned int *ret_ptr, unsigned int *ret_state)
{
- const char *msg_start = msg->chn->buf.p;
+ const char *msg_start = msg->chn->buf->p;
switch (state) {
case HTTP_MSG_RQMETH:
len = strlen(h);
}
- if (!http_find_header2(h, len, s->req->buf.p, &txn->hdr_idx, &ctx))
+ if (!http_find_header2(h, len, s->req->buf->p, &txn->hdr_idx, &ctx))
return 0;
h = ctx.line + ctx.val;
struct buffer *buf;
state = msg->msg_state;
- buf = &msg->chn->buf;
+ buf = msg->chn->buf;
ptr = buf->p + msg->next;
end = buf->p + buf->i;
if (msg->sl.rq.v_l != 0)
return 1;
- cur_end = msg->chn->buf.p + msg->sl.rq.l;
+ cur_end = msg->chn->buf->p + msg->sl.rq.l;
delta = 0;
if (msg->sl.rq.u_l == 0) {
/* if no URI was set, add "/" */
- delta = buffer_replace2(&msg->chn->buf, cur_end, cur_end, " /", 2);
+ delta = buffer_replace2(msg->chn->buf, cur_end, cur_end, " /", 2);
cur_end += delta;
http_msg_move_end(msg, delta);
}
/* add HTTP version */
- delta = buffer_replace2(&msg->chn->buf, cur_end, cur_end, " HTTP/1.0\r\n", 11);
+ delta = buffer_replace2(msg->chn->buf, cur_end, cur_end, " HTTP/1.0\r\n", 11);
http_msg_move_end(msg, delta);
cur_end += delta;
cur_end = (char *)http_parse_reqline(msg,
HTTP_MSG_RQMETH,
- msg->chn->buf.p, cur_end + 1,
+ msg->chn->buf->p, 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->chn->buf.p, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_val, hdr_len, msg->chn->buf->p, &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)
}
txn->flags &= ~(TX_CON_CLO_SET | TX_CON_KAL_SET);
- while (http_find_header2(hdr_val, hdr_len, msg->chn->buf.p, &txn->hdr_idx, &ctx)) {
+ while (http_find_header2(hdr_val, hdr_len, msg->chn->buf->p, &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;
*/
int http_parse_chunk_size(struct http_msg *msg)
{
- const struct buffer *buf = &msg->chn->buf;
+ const struct buffer *buf = msg->chn->buf;
const char *ptr = b_ptr(buf, msg->next);
const char *ptr_old = ptr;
const char *end = buf->data + buf->size;
*/
int http_forward_trailers(struct http_msg *msg)
{
- const struct buffer *buf = &msg->chn->buf;
+ const struct buffer *buf = msg->chn->buf;
/* we have msg->next which points to next line. Look for CRLF. */
while (1) {
*/
int http_skip_chunk_crlf(struct http_msg *msg)
{
- const struct buffer *buf = &msg->chn->buf;
+ const struct buffer *buf = msg->chn->buf;
const char *ptr;
int bytes;
* For the parsing, we use a 28 states FSM.
*
* Here is the information we currently have :
- * req->buf.p = beginning of request
- * req->buf.p + msg->eoh = end of processed headers / start of current one
- * req->buf.p + req->buf.i = end of input data
+ * req->buf->p = beginning of request
+ * req->buf->p + msg->eoh = end of processed headers / start of current one
+ * req->buf->p + req->buf->i = end of input data
* msg->eol = end of current header or line (LF or CRLF)
* msg->next = first non-visited byte
*
req,
req->rex, req->wex,
req->flags,
- req->buf.i,
+ req->buf->i,
req->analysers);
/* we're speaking HTTP here, so let's speak HTTP to the client */
* protected area is affected, because we may have to move processed
* data later, which is much more complicated.
*/
- if (buffer_not_empty(&req->buf) && msg->msg_state < HTTP_MSG_ERROR) {
+ if (buffer_not_empty(req->buf) && msg->msg_state < HTTP_MSG_ERROR) {
if ((txn->flags & TX_NOT_FIRST) &&
unlikely(channel_full(req) ||
- bi_end(&req->buf) < b_ptr(&req->buf, msg->next) ||
- bi_end(&req->buf) > req->buf.data + req->buf.size - global.tune.maxrewrite)) {
- if (req->buf.o) {
+ bi_end(req->buf) < b_ptr(req->buf, msg->next) ||
+ bi_end(req->buf) > req->buf->data + req->buf->size - global.tune.maxrewrite)) {
+ if (req->buf->o) {
if (req->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto failed_keep_alive;
/* some data has still not left the buffer, wake us once that's done */
req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
return 0;
}
- if (bi_end(&req->buf) < b_ptr(&req->buf, msg->next) ||
- bi_end(&req->buf) > req->buf.data + req->buf.size - global.tune.maxrewrite)
- buffer_slow_realign(&msg->chn->buf);
+ if (bi_end(req->buf) < b_ptr(req->buf, msg->next) ||
+ bi_end(req->buf) > req->buf->data + req->buf->size - global.tune.maxrewrite)
+ buffer_slow_realign(msg->chn->buf);
}
/* Note that we have the same problem with the response ; we
*/
if ((txn->flags & TX_NOT_FIRST) &&
unlikely(channel_full(s->rep) ||
- bi_end(&s->rep->buf) < b_ptr(&s->rep->buf, txn->rsp.next) ||
- bi_end(&s->rep->buf) > s->rep->buf.data + s->rep->buf.size - global.tune.maxrewrite)) {
- if (s->rep->buf.o) {
+ bi_end(s->rep->buf) < b_ptr(s->rep->buf, txn->rsp.next) ||
+ bi_end(s->rep->buf) > s->rep->buf->data + s->rep->buf->size - global.tune.maxrewrite)) {
+ if (s->rep->buf->o) {
if (s->rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto failed_keep_alive;
/* don't let a connection request be initiated */
}
}
- if (likely(msg->next < req->buf.i)) /* some unparsed data are available */
+ if (likely(msg->next < req->buf->i)) /* some unparsed data are available */
http_msg_analyzer(msg, &txn->hdr_idx);
}
(msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
char *eol, *sol;
- sol = req->buf.p;
+ sol = req->buf->p;
/* this is a bit complex : in case of error on the request line,
* we know that rq.l is still zero, so we display only the part
* up to the end of the line (truncated by debug_hdr).
*/
- eol = sol + (msg->sl.rq.l ? msg->sl.rq.l : req->buf.i);
+ eol = sol + (msg->sl.rq.l ? msg->sl.rq.l : req->buf->i);
debug_hdr("clireq", s, sol, eol);
sol += hdr_idx_first_pos(&txn->hdr_idx);
* later, so the session will never terminate. We
* must terminate it now.
*/
- if (unlikely(buffer_full(&req->buf, global.tune.maxrewrite))) {
+ if (unlikely(buffer_full(req->buf, global.tune.maxrewrite))) {
/* FIXME: check if URI is set and return Status
* 414 Request URI too long instead.
*/
session_inc_http_err_ctr(s);
proxy_inc_fe_req_ctr(s->fe);
if (msg->err_pos < 0)
- msg->err_pos = req->buf.i;
+ msg->err_pos = req->buf->i;
goto return_bad_req;
}
req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
#ifdef TCP_QUICKACK
- if (s->listener->options & LI_O_NOQUICKACK && req->buf.i) {
+ if (s->listener->options & LI_O_NOQUICKACK && req->buf->i) {
/* We need more data, we have to re-enable quick-ack in case we
* previously disabled it, otherwise we might cause the client
* to delay next data.
/* OK now we have a complete HTTP request with indexed headers. Let's
* complete the request parsing by setting a few fields we will need
- * later. At this point, we have the last CRLF at req->buf.data + msg->eoh.
+ * later. At this point, we have the last CRLF at req->buf->data + msg->eoh.
* If the request is in HTTP/0.9 form, the rule is still true, and eoh
* points to the CRLF of the request line. msg->next points to the first
* byte after the last LF. msg->sov points to the first byte of data.
/*
* 1: identify the method
*/
- txn->meth = find_http_meth(req->buf.p, msg->sl.rq.m_l);
+ txn->meth = find_http_meth(req->buf->p, 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(req->buf.p + msg->sl.rq.u,
+ !memcmp(req->buf->p + msg->sl.rq.u,
s->fe->monitor_uri,
s->fe->monitor_uri_len))) {
/*
if (urilen >= REQURI_LEN)
urilen = REQURI_LEN - 1;
- memcpy(txn->uri, req->buf.p, urilen);
+ memcpy(txn->uri, req->buf->p, urilen);
txn->uri[urilen] = 0;
if (!(s->logs.logwait &= ~LW_REQ))
/* ... and check if the request is HTTP/1.1 or above */
if ((msg->sl.rq.v_l == 8) &&
- ((req->buf.p[msg->sl.rq.v + 5] > '1') ||
- ((req->buf.p[msg->sl.rq.v + 5] == '1') &&
- (req->buf.p[msg->sl.rq.v + 7] >= '1'))))
+ ((req->buf->p[msg->sl.rq.v + 5] > '1') ||
+ ((req->buf->p[msg->sl.rq.v + 5] == '1') &&
+ (req->buf->p[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) &&
- req->buf.p[msg->sl.rq.u] != '/' && req->buf.p[msg->sl.rq.u] != '*')
+ req->buf->p[msg->sl.rq.u] != '/' && req->buf->p[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(req->buf.p, &txn->hdr_idx,
+ capture_headers(req->buf->p, &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, req->buf.p, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Transfer-Encoding", 17, req->buf->p, &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, req->buf.p, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Content-Length", 14, req->buf->p, &txn->hdr_idx, &ctx)) {
signed long long cl;
if (!ctx.vlen) {
- msg->err_pos = ctx.line + ctx.val - req->buf.p;
+ msg->err_pos = ctx.line + ctx.val - req->buf->p;
goto return_bad_req;
}
if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl)) {
- msg->err_pos = ctx.line + ctx.val - req->buf.p;
+ msg->err_pos = ctx.line + ctx.val - req->buf->p;
goto return_bad_req; /* parse failure */
}
if (cl < 0) {
- msg->err_pos = ctx.line + ctx.val - req->buf.p;
+ msg->err_pos = ctx.line + ctx.val - req->buf->p;
goto return_bad_req;
}
if ((msg->flags & HTTP_MSGF_CNT_LEN) && (msg->chunk_len != cl)) {
- msg->err_pos = ctx.line + ctx.val - req->buf.p;
+ msg->err_pos = ctx.line + ctx.val - req->buf->p;
goto return_bad_req; /* already specified, was different */
}
char *st_cur_param = NULL;
char *st_next_param = NULL;
- first_param = req->buf.p + txn->req.eoh + 2;
+ first_param = req->buf->p + txn->req.eoh + 2;
end_params = first_param + txn->req.body_len;
cur_param = next_param = end_params;
- if (end_params >= req->buf.data + req->buf.size - global.tune.maxrewrite) {
+ if (end_params >= req->buf->data + req->buf->size - global.tune.maxrewrite) {
/* Prevent buffer overflow */
si->applet.ctx.stats.st_code = STAT_STATUS_EXCD;
return 1;
}
- else if (end_params > req->buf.p + req->buf.i) {
+ else if (end_params > req->buf->p + req->buf->i) {
/* we need more data */
si->applet.ctx.stats.st_code = STAT_STATUS_NONE;
return 0;
req,
req->rex, req->wex,
req->flags,
- req->buf.i,
+ req->buf->i,
req->analysers);
/* first check whether we have some ACLs set to block this request */
struct hdr_ctx ctx;
ctx.idx = 0;
/* Expect is allowed in 1.1, look for it */
- if (http_find_header2("Expect", 6, req->buf.p, &txn->hdr_idx, &ctx) &&
+ if (http_find_header2("Expect", 6, req->buf->p, &txn->hdr_idx, &ctx) &&
unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
bo_inject(s->rep, http_100_chunk.str, http_100_chunk.len);
}
host = "";
hostlen = 0;
ctx.idx = 0;
- if (http_find_header2("Host", 4, txn->req.chn->buf.p + txn->req.sol, &txn->hdr_idx, &ctx)) {
+ if (http_find_header2("Host", 4, txn->req.chn->buf->p + txn->req.sol, &txn->hdr_idx, &ctx)) {
host = ctx.line + ctx.val;
hostlen = ctx.vlen;
}
path = http_get_path(txn);
/* build message using path */
if (path) {
- pathlen = txn->req.sl.rq.u_l + (req->buf.p + txn->req.sl.rq.u) - path;
+ pathlen = txn->req.sl.rq.u_l + (req->buf->p + txn->req.sl.rq.u) - path;
if (rule->flags & REDIRECT_FLAG_DROP_QS) {
int qs = 0;
while (qs < pathlen) {
path = http_get_path(txn);
/* build message using path */
if (path) {
- pathlen = txn->req.sl.rq.u_l + (req->buf.p + txn->req.sl.rq.u) - path;
+ pathlen = txn->req.sl.rq.u_l + (req->buf->p + txn->req.sl.rq.u) - path;
if (rule->flags & REDIRECT_FLAG_DROP_QS) {
int qs = 0;
while (qs < pathlen) {
rdr.len += 4;
bo_inject(req->prod->ob, rdr.str, rdr.len);
/* "eat" the request */
- bi_fast_delete(&req->buf, msg->sov);
+ bi_fast_delete(req->buf, msg->sov);
msg->sov = 0;
req->analysers = AN_REQ_HTTP_XFER_BODY;
s->rep->analysers = AN_RES_HTTP_XFER_BODY;
req,
req->rex, req->wex,
req->flags,
- req->buf.i,
+ req->buf->i,
req->analysers);
/*
* parsing incoming request.
*/
if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SN_ADDR_SET)) {
- url2sa(req->buf.p + msg->sl.rq.u, msg->sl.rq.u_l, &s->req->cons->conn.addr.to);
+ url2sa(req->buf->p + msg->sl.rq.u, msg->sl.rq.u_l, &s->req->cons->conn.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, req->buf.p + msg->sl.rq.u, msg->sl.rq.u_l);
+ get_srv_from_appsession(s, req->buf->p + msg->sl.rq.u, msg->sl.rq.u_l);
}
/* add unique-id if "header-unique-id" is specified */
if (!((s->fe->options | s->be->options) & PR_O_FF_ALWAYS) &&
http_find_header2(s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_name : s->fe->fwdfor_hdr_name,
s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_len : s->fe->fwdfor_hdr_len,
- req->buf.p, &txn->hdr_idx, &ctx)) {
+ req->buf->p, &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.
*/
*/
if ((s->listener->options & LI_O_NOQUICKACK) &&
((msg->flags & HTTP_MSGF_TE_CHNK) ||
- (msg->body_len > req->buf.i - txn->req.eoh - 2)))
+ (msg->body_len > req->buf->i - txn->req.eoh - 2)))
setsockopt(si_fd(&s->si[0]), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
#endif
}
struct hdr_ctx ctx;
ctx.idx = 0;
/* Expect is allowed in 1.1, look for it */
- if (http_find_header2("Expect", 6, req->buf.p, &txn->hdr_idx, &ctx) &&
+ if (http_find_header2("Expect", 6, req->buf->p, &txn->hdr_idx, &ctx) &&
unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
bo_inject(s->rep, http_100_chunk.str, http_100_chunk.len);
}
if (msg->msg_state < HTTP_MSG_CHUNK_SIZE) {
/* we have msg->sov which points to the first byte of message body.
- * req->buf.p still points to the beginning of the message and msg->sol
+ * req->buf->p still points to the beginning of the message and msg->sol
* is still null. We must save the body in msg->next because it
* survives buffer re-alignments.
*/
if (msg->body_len < limit)
limit = msg->body_len;
- if (req->buf.i - msg->sov >= limit) /* we have enough bytes now */
+ if (req->buf->i - msg->sov >= limit) /* we have enough bytes now */
goto http_end;
missing_data:
/* we get here if we need to wait for more data */
- if (buffer_full(&req->buf, global.tune.maxrewrite)) {
+ if (buffer_full(req->buf, global.tune.maxrewrite)) {
session_inc_http_err_ctr(s);
goto return_bad_req;
}
}
/* we get here if we need to wait for more data */
- if (!(req->flags & (CF_SHUTR | CF_READ_ERROR)) && !buffer_full(&req->buf, global.tune.maxrewrite)) {
+ if (!(req->flags & (CF_SHUTR | CF_READ_ERROR)) && !buffer_full(req->buf, global.tune.maxrewrite)) {
/* Not enough data. We'll re-use the http-request
* timeout here. Ideally, we should set the timeout
* relative to the accept() date. We just set the
ctx.idx = 0;
- old_o = chn->buf.o;
+ old_o = chn->buf->o;
if (old_o) {
/* The request was already skipped, let's restore it */
- b_rew(&chn->buf, old_o);
+ b_rew(chn->buf, old_o);
}
- old_i = chn->buf.i;
- while (http_find_header2(hdr_name, hdr_name_len, txn->req.chn->buf.p, &txn->hdr_idx, &ctx)) {
+ old_i = chn->buf->i;
+ while (http_find_header2(hdr_name, hdr_name_len, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) {
/* remove any existing values from the header */
http_remove_header2(&txn->req, &txn->hdr_idx, &ctx);
}
* data to be forwarded in order to take into account the size
* variations.
*/
- b_adv(&chn->buf, old_o + chn->buf.i - old_i);
+ b_adv(chn->buf, old_o + chn->buf->i - old_i);
}
return 0;
}
/* don't count other requests' data */
- s->logs.bytes_in -= s->req->buf.i;
- s->logs.bytes_out -= s->rep->buf.i;
+ s->logs.bytes_in -= s->req->buf->i;
+ s->logs.bytes_out -= s->rep->buf->i;
/* let's do a final log if we need it */
if (s->logs.logwait &&
s->logs.prx_queue_size = 0; /* we get the number of pending conns before us */
s->logs.srv_queue_size = 0; /* we will get this number soon */
- s->logs.bytes_in = s->req->total = s->req->buf.i;
- s->logs.bytes_out = s->rep->total = s->rep->buf.i;
+ s->logs.bytes_in = s->req->total = s->req->buf->i;
+ s->logs.bytes_out = s->rep->total = s->rep->buf->i;
if (s->pend_pos)
pendconn_free(s->pend_pos);
* because the request will wait for it to flush a little
* bit before proceeding.
*/
- if (s->req->buf.i) {
- if (s->rep->buf.o &&
- !buffer_full(&s->rep->buf, global.tune.maxrewrite) &&
- bi_end(&s->rep->buf) <= s->rep->buf.data + s->rep->buf.size - global.tune.maxrewrite)
+ if (s->req->buf->i) {
+ if (s->rep->buf->o &&
+ !buffer_full(s->rep->buf, global.tune.maxrewrite) &&
+ bi_end(s->rep->buf) <= s->rep->buf->data + s->rep->buf->size - global.tune.maxrewrite)
s->rep->flags |= CF_EXPECT_MORE;
}
return 0;
if ((req->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) ||
- ((req->flags & CF_SHUTW) && (req->to_forward || req->buf.o))) {
+ ((req->flags & CF_SHUTW) && (req->to_forward || req->buf->o))) {
/* Output closed while we were sending data. We must abort and
* wake the other side up.
*/
if (msg->msg_state < HTTP_MSG_CHUNK_SIZE) {
/* we have msg->sov which points to the first byte of message body.
- * req->buf.p still points to the beginning of the message and msg->sol
+ * req->buf->p still points to the beginning of the message and msg->sol
* is still null. We must save the body in msg->next because it
* survives buffer re-alignments.
*/
rep,
rep->rex, rep->wex,
rep->flags,
- rep->buf.i,
+ rep->buf->i,
rep->analysers);
/*
* For the parsing, we use a 28 states FSM.
*
* Here is the information we currently have :
- * rep->buf.p = beginning of response
- * rep->buf.p + msg->eoh = end of processed headers / start of current one
- * rep->buf.p + rep->buf.i = end of input data
+ * rep->buf->p = beginning of response
+ * rep->buf->p + msg->eoh = end of processed headers / start of current one
+ * rep->buf->p + rep->buf->i = end of input data
* msg->eol = end of current header or line (LF or CRLF)
* msg->next = first non-visited byte
*/
* protected area is affected, because we may have to move processed
* data later, which is much more complicated.
*/
- if (buffer_not_empty(&rep->buf) && msg->msg_state < HTTP_MSG_ERROR) {
+ if (buffer_not_empty(rep->buf) && msg->msg_state < HTTP_MSG_ERROR) {
if (unlikely(channel_full(rep) ||
- bi_end(&rep->buf) < b_ptr(&rep->buf, msg->next) ||
- bi_end(&rep->buf) > rep->buf.data + rep->buf.size - global.tune.maxrewrite)) {
- if (rep->buf.o) {
+ bi_end(rep->buf) < b_ptr(rep->buf, msg->next) ||
+ bi_end(rep->buf) > rep->buf->data + rep->buf->size - global.tune.maxrewrite)) {
+ if (rep->buf->o) {
/* some data has still not left the buffer, wake us once that's done */
if (rep->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_WRITE_ERROR|CF_WRITE_TIMEOUT))
goto abort_response;
rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
return 0;
}
- if (rep->buf.i <= rep->buf.size - global.tune.maxrewrite)
- buffer_slow_realign(&msg->chn->buf);
+ if (rep->buf->i <= rep->buf->size - global.tune.maxrewrite)
+ buffer_slow_realign(msg->chn->buf);
}
- if (likely(msg->next < rep->buf.i))
+ if (likely(msg->next < rep->buf->i))
http_msg_analyzer(msg, &txn->hdr_idx);
}
(msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
char *eol, *sol;
- sol = rep->buf.p;
- eol = sol + (msg->sl.st.l ? msg->sl.st.l : rep->buf.i);
+ sol = rep->buf->p;
+ eol = sol + (msg->sl.st.l ? msg->sl.st.l : rep->buf->i);
debug_hdr("srvrep", s, sol, eol);
sol += hdr_idx_first_pos(&txn->hdr_idx);
}
/* too large response does not fit in buffer. */
- else if (buffer_full(&rep->buf, global.tune.maxrewrite)) {
+ else if (buffer_full(rep->buf, global.tune.maxrewrite)) {
if (msg->err_pos < 0)
- msg->err_pos = rep->buf.i;
+ msg->err_pos = rep->buf->i;
goto hdr_response_bad;
}
/*
* 1: get the status code
*/
- n = rep->buf.p[msg->sl.st.c] - '0';
+ n = rep->buf->p[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) &&
- ((rep->buf.p[5] > '1') ||
- ((rep->buf.p[5] == '1') && (rep->buf.p[7] >= '1'))))
+ ((rep->buf->p[5] > '1') ||
+ ((rep->buf->p[5] == '1') && (rep->buf->p[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(rep->buf.p + msg->sl.st.c, msg->sl.st.c_l);
+ txn->status = strl2ui(rep->buf->p + 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(rep->buf.p, &txn->hdr_idx,
+ capture_headers(rep->buf->p, &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, rep->buf.p, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Transfer-Encoding", 17, rep->buf->p, &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, rep->buf.p, &txn->hdr_idx, &ctx)) {
+ http_find_header2("Content-Length", 14, rep->buf->p, &txn->hdr_idx, &ctx)) {
signed long long cl;
if (!ctx.vlen) {
- msg->err_pos = ctx.line + ctx.val - rep->buf.p;
+ msg->err_pos = ctx.line + ctx.val - rep->buf->p;
goto hdr_response_bad;
}
if (strl2llrc(ctx.line + ctx.val, ctx.vlen, &cl)) {
- msg->err_pos = ctx.line + ctx.val - rep->buf.p;
+ msg->err_pos = ctx.line + ctx.val - rep->buf->p;
goto hdr_response_bad; /* parse failure */
}
if (cl < 0) {
- msg->err_pos = ctx.line + ctx.val - rep->buf.p;
+ msg->err_pos = ctx.line + ctx.val - rep->buf->p;
goto hdr_response_bad;
}
if ((msg->flags & HTTP_MSGF_CNT_LEN) && (msg->chunk_len != cl)) {
- msg->err_pos = ctx.line + ctx.val - rep->buf.p;
+ msg->err_pos = ctx.line + ctx.val - rep->buf->p;
goto hdr_response_bad; /* already specified, was different */
}
rep,
rep->rex, rep->wex,
rep->flags,
- rep->buf.i,
+ rep->buf->i,
rep->analysers);
if (unlikely(msg->msg_state < HTTP_MSG_BODY)) /* we need more data */
return 0;
if ((res->flags & (CF_READ_ERROR|CF_READ_TIMEOUT|CF_WRITE_ERROR|CF_WRITE_TIMEOUT)) ||
- ((res->flags & CF_SHUTW) && (res->to_forward || res->buf.o)) ||
+ ((res->flags & CF_SHUTW) && (res->to_forward || res->buf->o)) ||
!s->req->analysers) {
/* Output closed while we were sending data. We must abort and
* wake the other side up.
if (msg->msg_state < HTTP_MSG_CHUNK_SIZE) {
/* we have msg->sov which points to the first byte of message body.
- * rep->buf.p still points to the beginning of the message and msg->sol
+ * rep->buf->p still points to the beginning of the message and msg->sol
* is still null. We must save the body in msg->next because it
* survives buffer re-alignments.
*/
last_hdr = 0;
- cur_next = req->buf.p + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = req->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
old_idx = 0;
while (!last_hdr) {
case ACT_REPLACE:
len = exp_replace(trash, cur_ptr, exp->replace, pmatch);
- delta = buffer_replace2(&req->buf, cur_ptr, cur_end, trash, len);
+ delta = buffer_replace2(req->buf, cur_ptr, cur_end, trash, len);
/* FIXME: if the user adds a newline in the replacement, the
* index will not be recalculated for now, and the new line
* will not be counted as a new header.
break;
case ACT_REMOVE:
- delta = buffer_replace2(&req->buf, cur_ptr, cur_next, NULL, 0);
+ delta = buffer_replace2(req->buf, cur_ptr, cur_next, NULL, 0);
cur_next += delta;
http_msg_move_end(&txn->req, delta);
done = 0;
- cur_ptr = req->buf.p;
+ cur_ptr = req->buf->p;
cur_end = cur_ptr + txn->req.sl.rq.l;
/* Now we have the request line between cur_ptr and cur_end */
case ACT_REPLACE:
*cur_end = term; /* restore the string terminator */
len = exp_replace(trash, cur_ptr, exp->replace, pmatch);
- delta = buffer_replace2(&req->buf, cur_ptr, cur_end, trash, len);
+ delta = buffer_replace2(req->buf, cur_ptr, cur_end, trash, len);
/* FIXME: if the user adds a newline in the replacement, the
* index will not be recalculated for now, and the new line
* will not be counted as a new header.
/* Iterate through the headers, we start with the start line. */
old_idx = 0;
- hdr_next = req->buf.p + hdr_idx_first_pos(&txn->hdr_idx);
+ hdr_next = req->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[old_idx].next)) {
struct hdr_idx_elem *cur_hdr;
*/
preserve_hdr = 1;
if (del_from != NULL) {
- int delta = del_hdr_value(&req->buf, &del_from, prev);
+ int delta = del_hdr_value(req->buf, &del_from, prev);
val_end += delta;
next += delta;
hdr_end += delta;
int stripped_after = 0;
if (att_end != equal) {
- stripped_before = buffer_replace2(&req->buf, att_end, equal, NULL, 0);
+ stripped_before = buffer_replace2(req->buf, att_end, equal, NULL, 0);
equal += stripped_before;
val_beg += stripped_before;
}
if (val_beg > equal + 1) {
- stripped_after = buffer_replace2(&req->buf, equal + 1, val_beg, NULL, 0);
+ stripped_after = buffer_replace2(req->buf, equal + 1, val_beg, NULL, 0);
val_beg += stripped_after;
stripped_before += stripped_after;
}
if ((t->be->ck_opts & PR_CK_PFX) && (delim != val_end)) {
int delta; /* negative */
- delta = buffer_replace2(&req->buf, val_beg, delim + 1, NULL, 0);
+ delta = buffer_replace2(req->buf, val_beg, delim + 1, NULL, 0);
val_end += delta;
next += delta;
hdr_end += delta;
preserve_hdr = 1;
if (del_from != NULL) {
- int delta = del_hdr_value(&req->buf, &del_from, prev);
+ int delta = del_hdr_value(req->buf, &del_from, prev);
if (att_beg >= del_from)
att_beg += delta;
if (att_end >= del_from)
if (del_from) {
int delta;
if (preserve_hdr) {
- delta = del_hdr_value(&req->buf, &del_from, hdr_end);
+ delta = del_hdr_value(req->buf, &del_from, hdr_end);
hdr_end = del_from;
cur_hdr->len += delta;
} else {
- delta = buffer_replace2(&req->buf, hdr_beg, hdr_next, NULL, 0);
+ delta = buffer_replace2(req->buf, hdr_beg, hdr_next, NULL, 0);
/* FIXME: this should be a separate function */
txn->hdr_idx.v[old_idx].next = cur_hdr->next;
last_hdr = 0;
- cur_next = rtr->buf.p + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = rtr->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
old_idx = 0;
while (!last_hdr) {
case ACT_REPLACE:
len = exp_replace(trash, cur_ptr, exp->replace, pmatch);
- delta = buffer_replace2(&rtr->buf, cur_ptr, cur_end, trash, len);
+ delta = buffer_replace2(rtr->buf, cur_ptr, cur_end, trash, len);
/* FIXME: if the user adds a newline in the replacement, the
* index will not be recalculated for now, and the new line
* will not be counted as a new header.
break;
case ACT_REMOVE:
- delta = buffer_replace2(&rtr->buf, cur_ptr, cur_next, NULL, 0);
+ delta = buffer_replace2(rtr->buf, cur_ptr, cur_next, NULL, 0);
cur_next += delta;
http_msg_move_end(&txn->rsp, delta);
done = 0;
- cur_ptr = rtr->buf.p;
+ cur_ptr = rtr->buf->p;
cur_end = cur_ptr + txn->rsp.sl.st.l;
/* Now we have the status line between cur_ptr and cur_end */
case ACT_REPLACE:
*cur_end = term; /* restore the string terminator */
len = exp_replace(trash, cur_ptr, exp->replace, pmatch);
- delta = buffer_replace2(&rtr->buf, cur_ptr, cur_end, trash, len);
+ delta = buffer_replace2(rtr->buf, cur_ptr, cur_end, trash, len);
/* FIXME: if the user adds a newline in the replacement, the
* index will not be recalculated for now, and the new line
* will not be counted as a new header.
/* we have a full respnse and we know that we have either a CR
* or an LF at <ptr>.
*/
- txn->status = strl2ui(rtr->buf.p + txn->rsp.sl.st.c, txn->rsp.sl.st.c_l);
+ txn->status = strl2ui(rtr->buf->p + 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 = res->buf.p + hdr_idx_first_pos(&txn->hdr_idx);
+ hdr_next = res->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[old_idx].next)) {
struct hdr_idx_elem *cur_hdr;
int stripped_after = 0;
if (att_end != equal) {
- stripped_before = buffer_replace2(&res->buf, att_end, equal, NULL, 0);
+ stripped_before = buffer_replace2(res->buf, att_end, equal, NULL, 0);
equal += stripped_before;
val_beg += stripped_before;
}
if (val_beg > equal + 1) {
- stripped_after = buffer_replace2(&res->buf, equal + 1, val_beg, NULL, 0);
+ stripped_after = buffer_replace2(res->buf, equal + 1, val_beg, NULL, 0);
val_beg += stripped_after;
stripped_before += stripped_after;
}
/* this cookie must be deleted */
if (*prev == ':' && next == hdr_end) {
/* whole header */
- delta = buffer_replace2(&res->buf, hdr_beg, hdr_next, NULL, 0);
+ delta = buffer_replace2(res->buf, hdr_beg, hdr_next, NULL, 0);
txn->hdr_idx.v[old_idx].next = cur_hdr->next;
txn->hdr_idx.used--;
cur_hdr->len = 0;
*/
} else {
/* just remove the value */
- int delta = del_hdr_value(&res->buf, &prev, next);
+ int delta = del_hdr_value(res->buf, &prev, next);
next = prev;
hdr_end += delta;
hdr_next += delta;
/* replace bytes val_beg->val_end with the cookie name associated
* with this server since we know it.
*/
- delta = buffer_replace2(&res->buf, val_beg, val_end, srv->cookie, srv->cklen);
+ delta = buffer_replace2(res->buf, val_beg, val_end, srv->cookie, srv->cklen);
next += delta;
hdr_end += delta;
hdr_next += delta;
/* insert the cookie name associated with this server
* before existing cookie, and insert a delimiter between them..
*/
- delta = buffer_replace2(&res->buf, val_beg, val_beg, srv->cookie, srv->cklen + 1);
+ delta = buffer_replace2(res->buf, val_beg, val_beg, srv->cookie, srv->cklen + 1);
next += delta;
hdr_end += delta;
hdr_next += delta;
* we start with the start line.
*/
cur_idx = 0;
- cur_next = rtr->buf.p + hdr_idx_first_pos(&txn->hdr_idx);
+ cur_next = rtr->buf->p + hdr_idx_first_pos(&txn->hdr_idx);
while ((cur_idx = txn->hdr_idx.v[cur_idx].next)) {
struct hdr_idx_elem *cur_hdr;
{
struct uri_auth *uri_auth = backend->uri_auth;
struct http_msg *msg = &txn->req;
- const char *uri = msg->chn->buf.p+ msg->sl.rq.u;
+ const char *uri = msg->chn->buf->p+ msg->sl.rq.u;
const char *h;
if (!uri_auth)
struct channel *chn = msg->chn;
int len1, len2;
- es->len = MIN(chn->buf.i, sizeof(es->buf));
- len1 = chn->buf.data + chn->buf.size - chn->buf.p;
+ es->len = MIN(chn->buf->i, sizeof(es->buf));
+ len1 = chn->buf->data + chn->buf->size - chn->buf->p;
len1 = MIN(len1, es->len);
len2 = es->len - len1; /* remaining data if buffer wraps */
- memcpy(es->buf, chn->buf.p, len1);
+ memcpy(es->buf, chn->buf->p, len1);
if (len2)
- memcpy(es->buf + len1, chn->buf.data, len2);
+ memcpy(es->buf + len1, chn->buf->data, len2);
if (msg->err_pos >= 0)
es->pos = msg->err_pos;
es->s_flags = s->flags;
es->t_flags = s->txn.flags;
es->m_flags = msg->flags;
- es->b_out = chn->buf.o;
- es->b_wrap = chn->buf.data + chn->buf.size - chn->buf.p;
+ es->b_out = chn->buf->o;
+ es->b_wrap = chn->buf->data + chn->buf->size - chn->buf->p;
es->b_tot = chn->total;
es->m_clen = msg->chunk_len;
es->m_blen = msg->body_len;
if (occ >= 0) {
/* search from the beginning */
- while (http_find_header2(hname, hlen, msg->chn->buf.p, idx, ctx)) {
+ while (http_find_header2(hname, hlen, msg->chn->buf->p, idx, ctx)) {
occ--;
if (occ <= 0) {
*vptr = ctx->line + ctx->val;
return 0;
found = hist_ptr = 0;
- while (http_find_header2(hname, hlen, msg->chn->buf.p, idx, ctx)) {
+ while (http_find_header2(hname, hlen, msg->chn->buf->p, idx, ctx)) {
ptr_hist[hist_ptr] = ctx->line + ctx->val;
len_hist[hist_ptr] = ctx->vlen;
if (++hist_ptr >= MAX_HDR_HISTORY)
* a HEAD with some data, or sending more than the advertised
* content-length.
*/
- if (unlikely(s->rep->buf.i))
- s->rep->buf.i = 0;
+ if (unlikely(s->rep->buf->i))
+ s->rep->buf->i = 0;
s->req->rto = s->fe->timeout.client;
s->req->wto = TICK_ETERNITY;
if (unlikely(txn->req.msg_state < HTTP_MSG_BODY)) {
if ((msg->msg_state == HTTP_MSG_ERROR) ||
- buffer_full(&s->req->buf, global.tune.maxrewrite)) {
+ buffer_full(s->req->buf, global.tune.maxrewrite)) {
smp->data.uint = 0;
return -1;
}
/* Try to decode HTTP request */
- if (likely(msg->next < s->req->buf.i))
+ if (likely(msg->next < s->req->buf->i))
http_msg_analyzer(msg, &txn->hdr_idx);
/* Still no valid request ? */
if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
if ((msg->msg_state == HTTP_MSG_ERROR) ||
- buffer_full(&s->req->buf, global.tune.maxrewrite)) {
+ buffer_full(s->req->buf, global.tune.maxrewrite)) {
smp->data.uint = 0;
return -1;
}
* preparation to perform so that further checks can rely
* on HTTP tests.
*/
- txn->meth = find_http_meth(msg->chn->buf.p, msg->sl.rq.m_l);
+ txn->meth = find_http_meth(msg->chn->buf->p, msg->sl.rq.m_l);
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
s->flags |= SN_REDIRECTABLE;
return 0;
smp->type = SMP_T_CSTR;
smp->data.str.len = txn->req.sl.rq.m_l;
- smp->data.str.str = txn->req.chn->buf.p;
+ smp->data.str.str = txn->req.chn->buf->p;
}
smp->flags = SMP_F_VOL_1ST;
return 1;
CHECK_HTTP_MESSAGE_FIRST();
len = txn->req.sl.rq.v_l;
- ptr = txn->req.chn->buf.p + txn->req.sl.rq.v;
+ ptr = txn->req.chn->buf->p + txn->req.sl.rq.v;
while ((len-- > 0) && (*ptr++ != '/'));
if (len <= 0)
CHECK_HTTP_MESSAGE_FIRST();
len = txn->rsp.sl.st.v_l;
- ptr = txn->rsp.chn->buf.p;
+ ptr = txn->rsp.chn->buf->p;
while ((len-- > 0) && (*ptr++ != '/'));
if (len <= 0)
CHECK_HTTP_MESSAGE_FIRST();
len = txn->rsp.sl.st.c_l;
- ptr = txn->rsp.chn->buf.p + txn->rsp.sl.st.c;
+ ptr = txn->rsp.chn->buf->p + txn->rsp.sl.st.c;
smp->type = SMP_T_UINT;
smp->data.uint = __strl2ui(ptr, len);
smp->type = SMP_T_CSTR;
smp->data.str.len = txn->req.sl.rq.u_l;
- smp->data.str.str = txn->req.chn->buf.p + txn->req.sl.rq.u;
+ smp->data.str.str = txn->req.chn->buf->p + txn->req.sl.rq.u;
smp->flags = SMP_F_VOL_1ST;
return 1;
}
CHECK_HTTP_MESSAGE_FIRST();
/* Parse HTTP request */
- url2sa(txn->req.chn->buf.p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->conn.addr.to);
+ url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->conn.addr.to);
if (((struct sockaddr_in *)&l4->req->cons->conn.addr.to)->sin_family != AF_INET)
return 0;
smp->type = SMP_T_IPV4;
CHECK_HTTP_MESSAGE_FIRST();
/* Same optimization as url_ip */
- url2sa(txn->req.chn->buf.p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->conn.addr.to);
+ url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->conn.addr.to);
smp->type = SMP_T_UINT;
smp->data.uint = ntohs(((struct sockaddr_in *)&l4->req->cons->conn.addr.to)->sin_port);
ctx.idx = 0;
cnt = 0;
- while (http_find_header2(args->data.str.str, args->data.str.len, msg->chn->buf.p, idx, &ctx))
+ while (http_find_header2(args->data.str.str, args->data.str.len, msg->chn->buf->p, idx, &ctx))
cnt++;
smp->type = SMP_T_UINT;
CHECK_HTTP_MESSAGE_FIRST();
- end = txn->req.chn->buf.p + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
+ end = txn->req.chn->buf->p + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
ptr = http_get_path(txn);
if (!ptr)
return 0;
CHECK_HTTP_MESSAGE_FIRST();
ctx.idx = 0;
- if (!http_find_header2("Host", 4, txn->req.chn->buf.p + txn->req.sol, &txn->hdr_idx, &ctx) ||
+ if (!http_find_header2("Host", 4, txn->req.chn->buf->p + txn->req.sol, &txn->hdr_idx, &ctx) ||
!ctx.vlen)
return smp_fetch_path(px, l4, l7, opt, args, smp);
smp->data.str.len = ctx.vlen;
/* now retrieve the path */
- end = txn->req.chn->buf.p + txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
+ end = txn->req.chn->buf->p + txn->req.sol + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
beg = http_get_path(txn);
if (!beg)
beg = end;
* next one.
*/
- sol = msg->chn->buf.p;
+ sol = msg->chn->buf->p;
if (!(smp->flags & SMP_F_NOT_LAST)) {
/* search for the header from the beginning, we must first initialize
* the search parameters.
hdr_name_len = 10;
}
- sol = msg->chn->buf.p;
+ sol = msg->chn->buf->p;
val_end = val_beg = NULL;
ctx.idx = 0;
cnt = 0;
if (args[1].type)
delim = *args[1].data.str.str;
- if (!find_url_param_value(msg->chn->buf.p + msg->sl.rq.u, msg->sl.rq.u_l,
+ if (!find_url_param_value(msg->chn->buf->p + msg->sl.rq.u, msg->sl.rq.u_l,
args->data.str.str, args->data.str.len,
&smp->data.str.str, &smp->data.str.len,
delim))