* labels and variable names. Note that msg->sol is left unchanged.
*/
const char *http_parse_stsline(struct http_msg *msg, const char *msg_buf,
- const char *msg_start,
unsigned int state, const char *ptr, const char *end,
unsigned int *ret_ptr, unsigned int *ret_state)
{
+ const char *msg_start = msg->buf->p;
+
switch (state) {
case HTTP_MSG_RPVER:
http_msg_rpver:
* labels and variable names. Note that msg->sol is left unchanged.
*/
const char *http_parse_reqline(struct http_msg *msg, const char *msg_buf,
- const char *msg_start,
unsigned int state, const char *ptr, const char *end,
unsigned int *ret_ptr, unsigned int *ret_state)
{
+ const char *msg_start = msg->buf->p;
+
switch (state) {
case HTTP_MSG_RQMETH:
http_msg_rqmeth:
case HTTP_MSG_RPCODE:
case HTTP_MSG_RPCODE_SP:
case HTTP_MSG_RPREASON:
- ptr = (char *)http_parse_stsline(msg, buf->data, buf->p,
+ ptr = (char *)http_parse_stsline(msg, buf->data,
state, ptr, end,
&msg->next, &msg->msg_state);
if (unlikely(!ptr))
case HTTP_MSG_RQURI:
case HTTP_MSG_RQURI_SP:
case HTTP_MSG_RQVER:
- ptr = (char *)http_parse_reqline(msg, buf->data, buf->p,
+ ptr = (char *)http_parse_reqline(msg, buf->data,
state, ptr, end,
&msg->next, &msg->msg_state);
if (unlikely(!ptr))
delta = buffer_replace2(req, 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, req->data, req->p,
+ cur_end = (char *)http_parse_reqline(msg, req->data,
HTTP_MSG_RQMETH,
msg->sol, cur_end + 1,
NULL, NULL);
http_msg_move_end(&txn->req, delta);
cur_end += delta;
- cur_end = (char *)http_parse_reqline(&txn->req, req->data, req->p,
+ cur_end = (char *)http_parse_reqline(&txn->req, req->data,
HTTP_MSG_RQMETH,
cur_ptr, cur_end + 1,
NULL, NULL);
http_msg_move_end(&txn->rsp, delta);
cur_end += delta;
- cur_end = (char *)http_parse_stsline(&txn->rsp, rtr->data, rtr->p,
+ cur_end = (char *)http_parse_stsline(&txn->rsp, rtr->data,
HTTP_MSG_RPVER,
cur_ptr, cur_end + 1,
NULL, NULL);
txn->rsp.body_len = 0LL;
txn->req.msg_state = HTTP_MSG_RQBEFORE; /* at the very beginning of the request */
txn->rsp.msg_state = HTTP_MSG_RPBEFORE; /* at the very beginning of the response */
+ txn->req.buf = s->req;
+ txn->rsp.buf = s->rep;
txn->auth.method = HTTP_AUTH_UNKNOWN;
if (unlikely(fcntl(cfd, F_SETFL, O_NONBLOCK) == -1))
goto out_free_task;
- txn = &s->txn;
- /* Those variables will be checked and freed if non-NULL in
- * session.c:session_free(). It is important that they are
- * properly initialized.
- */
- txn->sessid = NULL;
- txn->srv_cookie = NULL;
- txn->cli_cookie = NULL;
- txn->uri = NULL;
- txn->req.cap = NULL;
- txn->rsp.cap = NULL;
- txn->hdr_idx.v = NULL;
- txn->hdr_idx.size = txn->hdr_idx.used = 0;
- txn->req.flags = 0;
- txn->rsp.flags = 0;
-
if (unlikely((s->req = pool_alloc2(pool2_buffer)) == NULL))
goto out_free_task; /* no memory */
s->rep->wex = TICK_ETERNITY;
s->rep->analyse_exp = TICK_ETERNITY;
+ txn = &s->txn;
+ /* Those variables will be checked and freed if non-NULL in
+ * session.c:session_free(). It is important that they are
+ * properly initialized.
+ */
+ txn->sessid = NULL;
+ txn->srv_cookie = NULL;
+ txn->cli_cookie = NULL;
+ txn->uri = NULL;
+ txn->req.cap = NULL;
+ txn->rsp.cap = NULL;
+ txn->hdr_idx.v = NULL;
+ txn->hdr_idx.size = txn->hdr_idx.used = 0;
+ txn->req.flags = 0;
+ txn->rsp.flags = 0;
+ /* the HTTP messages need to know what buffer they're associated with */
+ txn->req.buf = s->req;
+ txn->rsp.buf = s->rep;
+
/* finish initialization of the accepted file descriptor */
fd_insert(cfd);
fdtab[cfd].owner = &s->si[0];