diff options
author | Mukund Sivaraman <muks@banu.com> | 2010-01-08 22:05:17 +0530 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2010-01-08 22:05:17 +0530 |
commit | 9c0c3d5ced559cb723247a54475fa59b403560b0 (patch) | |
tree | 716d3684a4662d463b3590bf090fb91a15f6a24a /src/reqs.c | |
parent | b96a3a32500a6680a83f0928158b1f310cd6b0ec (diff) |
[BB#17] Add custom HTTP request headers to outgoing HTTP requests
Diffstat (limited to 'src/reqs.c')
-rw-r--r-- | src/reqs.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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) { |