MEDIUM: http: http_send_name_header: remove references to msg and buffer
They can be deduced from txn.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 9e1dcb9..7e2151d 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -71,7 +71,7 @@
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);
diff --git a/src/proto_http.c b/src/proto_http.c
index af44a0f..17d2125 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -3665,7 +3665,8 @@
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 @@
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 @@
*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;
}
diff --git a/src/session.c b/src/session.c
index ac8a8cc..e930daf 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1954,14 +1954,9 @@
/* 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);
}
}