]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: split initialization
authorThierry FOURNIER <tfournier@arpalert.org>
Fri, 25 Sep 2015 16:53:18 +0000 (18:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Sep 2015 21:39:48 +0000 (23:39 +0200)
The goal is to export the http txn initialisation functions for
using it in the Lua code.

include/proto/proto_http.h
src/proto_http.c

index 3691074b218e2b33ee97115b25929b8fbbed6a21..f5aef3bae42c0e7a3fc311f029ca45c8e6159285 100644 (file)
@@ -78,6 +78,8 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
 int http_request_forward_body(struct stream *s, struct channel *req, int an_bit);
 int http_response_forward_body(struct stream *s, struct channel *res, int an_bit);
 void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx);
+void http_txn_reset_req(struct http_txn *txn);
+void http_txn_reset_res(struct http_txn *txn);
 
 void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end);
 int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hdr_exp *exp);
index 33893edf5a3905ae48508710d323cda298e6a5ae..104df2020d7a60d951f39ee3ac3e7992c68b3f32 100644 (file)
@@ -8841,6 +8841,26 @@ struct http_txn *http_alloc_txn(struct stream *s)
        return txn;
 }
 
+void http_txn_reset_req(struct http_txn *txn)
+{
+       txn->req.flags = 0;
+       txn->req.sol = txn->req.eol = txn->req.eoh = 0; /* relative to the buffer */
+       txn->req.next = 0;
+       txn->req.chunk_len = 0LL;
+       txn->req.body_len = 0LL;
+       txn->req.msg_state = HTTP_MSG_RQBEFORE; /* at the very beginning of the request */
+}
+
+void http_txn_reset_res(struct http_txn *txn)
+{
+       txn->rsp.flags = 0;
+       txn->rsp.sol = txn->rsp.eol = txn->rsp.eoh = 0; /* relative to the buffer */
+       txn->rsp.next = 0;
+       txn->rsp.chunk_len = 0LL;
+       txn->rsp.body_len = 0LL;
+       txn->rsp.msg_state = HTTP_MSG_RPBEFORE; /* at the very beginning of the response */
+}
+
 /*
  * Initialize a new HTTP transaction for stream <s>. It is assumed that all
  * the required fields are properly allocated and that we only need to (re)init
@@ -8861,18 +8881,9 @@ void http_init_txn(struct stream *s)
        txn->cli_cookie = NULL;
        txn->uri = NULL;
 
-       txn->req.flags = 0;
-       txn->req.sol = txn->req.eol = txn->req.eoh = 0; /* relative to the buffer */
-       txn->req.next = 0;
-       txn->rsp.flags = 0;
-       txn->rsp.sol = txn->rsp.eol = txn->rsp.eoh = 0; /* relative to the buffer */
-       txn->rsp.next = 0;
-       txn->req.chunk_len = 0LL;
-       txn->req.body_len = 0LL;
-       txn->rsp.chunk_len = 0LL;
-       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 */
+       http_txn_reset_req(txn);
+       http_txn_reset_res(txn);
+
        txn->req.chn = &s->req;
        txn->rsp.chn = &s->res;