summaryrefslogtreecommitdiffhomepage
path: root/src/reqs.c
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-09-16 01:25:59 +0100
committerrofl0r <rofl0r@users.noreply.github.com>2020-09-16 02:39:09 +0100
commite929e81a55241b63d8921c071806195eae91ab91 (patch)
treec52b4412b57866fe328222d426ef9a3241158ce6 /src/reqs.c
parent7d33fc8e8a8802f8962f612510d252bbbe465757 (diff)
add_header: use sblist
note that the old code inserted added headers at the beginning of the list, reasoning unknown. this seems counter-intuitive as the headers would end up in the request in the reverse order they were added, but this was irrelevant, as the headers were originally first put into the hashmap hashofheaders before sending it to the client. since the hashmap didn't preserve ordering, the headers would appear in random order anyway.
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 6bb456b..5f26333 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1511,7 +1511,7 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
while(0)
int got_headers = 0, fd = connptr->client_fd;
- ssize_t i;
+ size_t i;
struct request_s *request = NULL;
struct timeval tv;
orderedmap hashofheaders = NULL;
@@ -1648,9 +1648,9 @@ e401:
* 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);
+ if (config->add_headers)
+ for (i = 0; i < sblist_getsize (config->add_headers); i++) {
+ http_header_t *header = sblist_get (config->add_headers, i);
orderedmap_append (hashofheaders, header->name, header->value);
}