]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: http: http_send_name_header: remove references to msg and buffer
authorWilly Tarreau <w@1wt.eu>
Fri, 9 Mar 2012 11:11:57 +0000 (12:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 May 2012 10:28:12 +0000 (12:28 +0200)
They can be deduced from txn.

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

index 9e1dcb9603b01c7a30d58400b43f6fc0db4331c1..7e2151d46324599cf437a2b2909cc473d1d6fe41 100644 (file)
@@ -71,7 +71,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
 int http_process_request(struct session *t, struct buffer *req, int an_bit);
 int http_process_tarpit(struct session *s, struct buffer *req, int an_bit);
 int http_process_request_body(struct session *s, struct buffer *req, int an_bit);
-int http_send_name_header(struct http_txn *txn, struct http_msg *msg, struct buffer *buf, struct proxy* be, const char* svr_name);
+int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* svr_name);
 int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit);
 int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, struct proxy *px);
 int http_request_forward_body(struct session *s, struct buffer *req, int an_bit);
index af44a0f283f61bb2076af82db61e3e96256336d7..17d21259f160d726fe1ff6156846ff71f342906f 100644 (file)
@@ -3665,7 +3665,8 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
        return 0;
 }
 
-int http_send_name_header(struct http_txn *txn, struct http_msg *msg, struct buffer *buf, struct proxy* be, const char* srv_name) {
+/* send a server's name with an outgoing request over an established connection */
+int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* srv_name) {
 
        struct hdr_ctx ctx;
 
@@ -3676,9 +3677,9 @@ int http_send_name_header(struct http_txn *txn, struct http_msg *msg, struct buf
 
        ctx.idx = 0;
 
-       while (http_find_header2(hdr_name, hdr_name_len, buf->p + msg->sol, &txn->hdr_idx, &ctx)) {
+       while (http_find_header2(hdr_name, hdr_name_len, txn->req.buf->p + txn->req.sol, &txn->hdr_idx, &ctx)) {
                /* remove any existing values from the header */
-               http_remove_header2(msg, buf, &txn->hdr_idx, &ctx);
+               http_remove_header2(&txn->req, txn->req.buf, &txn->hdr_idx, &ctx);
        }
 
        /* Add the new header requested with the server value */
@@ -3688,7 +3689,7 @@ int http_send_name_header(struct http_txn *txn, struct http_msg *msg, struct buf
        *hdr_val++ = ':';
        *hdr_val++ = ' ';
        hdr_val += strlcpy2(hdr_val, srv_name, trash + sizeof(trash) - hdr_val);
-       http_header_add_tail2(buf, msg, &txn->hdr_idx, trash, hdr_val - trash);
+       http_header_add_tail2(txn->req.buf, &txn->req, &txn->hdr_idx, trash, hdr_val - trash);
 
        return 0;
 }
index ac8a8cc7c63c8a1ad2c0abfb566a301c26a674b9..e930dafd1aa3a524a35d7219c8f59e2f4ae2b23f 100644 (file)
@@ -1954,14 +1954,9 @@ struct task *process_session(struct task *t)
                /* Now we can add the server name to a header (if requested) */
                /* check for HTTP mode and proxy server_name_hdr_name != NULL */
                if ((s->flags & SN_BE_ASSIGNED) &&
-                       (s->be->mode == PR_MODE_HTTP) &&
-                       (s->be->server_id_hdr_name != NULL)) {
-
-                       http_send_name_header(&s->txn,
-                                             &s->txn.req,
-                                             s->req,
-                                             s->be,
-                                             target_srv(&s->target)->id);
+                   (s->be->mode == PR_MODE_HTTP) &&
+                   (s->be->server_id_hdr_name != NULL)) {
+                       http_send_name_header(&s->txn, s->be, target_srv(&s->target)->id);
                }
        }