summaryrefslogtreecommitdiffhomepage
path: root/src/reqs.c
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2010-01-08 22:05:17 +0530
committerMukund Sivaraman <muks@banu.com>2010-01-08 22:05:17 +0530
commit9c0c3d5ced559cb723247a54475fa59b403560b0 (patch)
tree716d3684a4662d463b3590bf090fb91a15f6a24a /src/reqs.c
parentb96a3a32500a6680a83f0928158b1f310cd6b0ec (diff)
[BB#17] Add custom HTTP request headers to outgoing HTTP requests
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 2f6b67e..a2df786 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1327,6 +1327,7 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
*/
void handle_connection (int fd)
{
+ ssize_t i;
struct conn_s *connptr;
struct request_s *request = NULL;
hashmap_t hashofheaders = NULL;
@@ -1407,6 +1408,19 @@ void handle_connection (int fd)
return;
}
+ /*
+ * Add any user-specified headers (AddHeader directive) to the
+ * outgoing HTTP request.
+ */
+ for (i = 0; i < vector_length (config.add_headers); i++) {
+ http_header_t *header = (http_header_t *)
+ vector_getentry (config.add_headers, i, NULL);
+
+ hashmap_insert (hashofheaders,
+ header->name,
+ header->value, strlen (header->value) + 1);
+ }
+
request = process_request (connptr, hashofheaders);
if (!request) {
if (!connptr->error_variables && !connptr->show_stats) {