mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-28 08:43:36 +00:00
MINOR: buffer: convert most b_ptr() calls to c_ptr()
The latter uses the channel wherever a channel is known.
This commit is contained in:
parent
e5f12ce7f2
commit
188e230704
@ -322,7 +322,7 @@ static struct server *get_server_ph_post(struct stream *s)
|
||||
struct proxy *px = s->be;
|
||||
unsigned int plen = px->url_param_len;
|
||||
unsigned long len = http_body_bytes(msg);
|
||||
const char *params = b_ptr(req->buf, -http_data_rewind(msg));
|
||||
const char *params = c_ptr(req, -http_data_rewind(msg));
|
||||
const char *p = params;
|
||||
const char *start, *end;
|
||||
|
||||
@ -412,7 +412,7 @@ static struct server *get_server_hh(struct stream *s)
|
||||
ctx.idx = 0;
|
||||
|
||||
/* if the message is chunked, we skip the chunk size, but use the value as len */
|
||||
http_find_header2(px->hh_name, plen, b_ptr(s->req.buf, -http_hdr_rewind(&txn->req)), &txn->hdr_idx, &ctx);
|
||||
http_find_header2(px->hh_name, plen, c_ptr(&s->req, -http_hdr_rewind(&txn->req)), &txn->hdr_idx, &ctx);
|
||||
|
||||
/* if the header is not found or empty, let's fallback to round robin */
|
||||
if (!ctx.idx || !ctx.vlen)
|
||||
@ -669,7 +669,7 @@ int assign_server(struct stream *s)
|
||||
if (!s->txn || s->txn->req.msg_state < HTTP_MSG_BODY)
|
||||
break;
|
||||
srv = get_server_uh(s->be,
|
||||
b_ptr(s->req.buf, -http_uri_rewind(&s->txn->req)),
|
||||
c_ptr(&s->req, -http_uri_rewind(&s->txn->req)),
|
||||
s->txn->req.sl.rq.u_l);
|
||||
break;
|
||||
|
||||
@ -679,7 +679,7 @@ int assign_server(struct stream *s)
|
||||
break;
|
||||
|
||||
srv = get_server_ph(s->be,
|
||||
b_ptr(s->req.buf, -http_uri_rewind(&s->txn->req)),
|
||||
c_ptr(&s->req, -http_uri_rewind(&s->txn->req)),
|
||||
s->txn->req.sl.rq.u_l);
|
||||
|
||||
if (!srv && s->txn->meth == HTTP_METH_POST)
|
||||
|
@ -98,7 +98,7 @@ int co_inject(struct channel *chn, const char *msg, int len)
|
||||
|
||||
memcpy(chn->buf->p, msg, len);
|
||||
chn->buf->o += len;
|
||||
chn->buf->p = b_ptr(chn->buf, len);
|
||||
chn->buf->p = c_ptr(chn, len);
|
||||
chn->total += len;
|
||||
return -1;
|
||||
}
|
||||
|
3
src/h1.c
3
src/h1.c
@ -14,6 +14,7 @@
|
||||
#include <common/config.h>
|
||||
#include <common/http-hdr.h>
|
||||
|
||||
#include <proto/channel.h>
|
||||
#include <proto/h1.h>
|
||||
#include <proto/hdr_idx.h>
|
||||
|
||||
@ -1291,7 +1292,7 @@ int http_forward_trailers(struct http_msg *msg)
|
||||
msg->sol = 0;
|
||||
while (1) {
|
||||
const char *p1 = NULL, *p2 = NULL;
|
||||
const char *start = b_ptr(buf, msg->next + msg->sol);
|
||||
const char *start = c_ptr(msg->chn, msg->next + msg->sol);
|
||||
const char *stop = b_tail(buf);
|
||||
const char *ptr = start;
|
||||
int bytes = 0;
|
||||
|
@ -1111,7 +1111,7 @@ void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
|
||||
c_rew(&s->req, rewind = http_hdr_rewind(&txn->req));
|
||||
|
||||
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, c_ptr(&s->req, txn->req.sl.rq.u + txn->req.sl.rq.u_l));
|
||||
|
||||
c_adv(&s->req, rewind);
|
||||
|
||||
@ -1650,7 +1650,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
req->flags |= CF_WAKE_WRITE;
|
||||
return 0;
|
||||
}
|
||||
if (unlikely(ci_tail(req) < b_ptr(req->buf, msg->next) ||
|
||||
if (unlikely(ci_tail(req) < c_ptr(req, msg->next) ||
|
||||
ci_tail(req) > req->buf->data + req->buf->size - global.tune.maxrewrite))
|
||||
channel_slow_realign(req, trash.str);
|
||||
}
|
||||
@ -5137,7 +5137,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (unlikely(ci_tail(rep) < b_ptr(rep->buf, msg->next) ||
|
||||
if (unlikely(ci_tail(rep) < c_ptr(rep, msg->next) ||
|
||||
ci_tail(rep) > rep->buf->data + rep->buf->size - global.tune.maxrewrite))
|
||||
channel_slow_realign(rep, trash.str);
|
||||
|
||||
@ -9919,7 +9919,7 @@ smp_fetch_body(const struct arg *args, struct sample *smp, const char *kw, void
|
||||
msg = &smp->strm->txn->rsp;
|
||||
|
||||
len = http_body_bytes(msg);
|
||||
body = b_ptr(msg->chn->buf, -http_data_rewind(msg));
|
||||
body = c_ptr(msg->chn, -http_data_rewind(msg));
|
||||
|
||||
block1 = len;
|
||||
if (block1 > msg->chn->buf->data + msg->chn->buf->size - body)
|
||||
@ -11390,7 +11390,7 @@ smp_fetch_body_param(const struct arg *args, struct sample *smp, const char *kw,
|
||||
msg = &smp->strm->txn->rsp;
|
||||
|
||||
len = http_body_bytes(msg);
|
||||
body = b_ptr(msg->chn->buf, -http_data_rewind(msg));
|
||||
body = c_ptr(msg->chn, -http_data_rewind(msg));
|
||||
|
||||
block1 = len;
|
||||
if (block1 > msg->chn->buf->data + msg->chn->buf->size - body)
|
||||
|
Loading…
Reference in New Issue
Block a user