summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/anonymous.c22
-rw-r--r--src/anonymous.h6
-rw-r--r--src/conf.c2
-rw-r--r--src/main.c6
-rw-r--r--src/reqs.c4
5 files changed, 20 insertions, 20 deletions
diff --git a/src/anonymous.c b/src/anonymous.c
index 8d44465..f38fd44 100644
--- a/src/anonymous.c
+++ b/src/anonymous.c
@@ -28,21 +28,21 @@
#include "log.h"
#include "conf.h"
-short int is_anonymous_enabled (void)
+short int is_anonymous_enabled (struct config_s *conf)
{
- return (config->anonymous_map != NULL) ? 1 : 0;
+ return (conf->anonymous_map != NULL) ? 1 : 0;
}
/*
* Search for the header. This function returns a positive value greater than
* zero if the string was found, zero if it wasn't and negative upon error.
*/
-int anonymous_search (const char *s)
+int anonymous_search (struct config_s *conf, const char *s)
{
assert (s != NULL);
- assert (config->anonymous_map != NULL);
+ assert (conf->anonymous_map != NULL);
- return hashmap_search (config->anonymous_map, s);
+ return hashmap_search (conf->anonymous_map, s);
}
/*
@@ -51,23 +51,23 @@ int anonymous_search (const char *s)
* Return -1 if there is an error, otherwise a 0 is returned if the insert was
* successful.
*/
-int anonymous_insert (const char *s)
+int anonymous_insert (struct config_s *conf, const char *s)
{
char data = 1;
assert (s != NULL);
- if (!config->anonymous_map) {
- config->anonymous_map = hashmap_create (32);
- if (!config->anonymous_map)
+ if (!conf->anonymous_map) {
+ conf->anonymous_map = hashmap_create (32);
+ if (!conf->anonymous_map)
return -1;
}
- if (hashmap_search (config->anonymous_map, s) > 0) {
+ if (hashmap_search (conf->anonymous_map, s) > 0) {
/* The key was already found, so return a positive number. */
return 0;
}
/* Insert the new key */
- return hashmap_insert (config->anonymous_map, s, &data, sizeof (data));
+ return hashmap_insert (conf->anonymous_map, s, &data, sizeof (data));
}
diff --git a/src/anonymous.h b/src/anonymous.h
index 0ca980e..6fc4518 100644
--- a/src/anonymous.h
+++ b/src/anonymous.h
@@ -21,8 +21,8 @@
#ifndef _TINYPROXY_ANONYMOUS_H_
#define _TINYPROXY_ANONYMOUS_H_
-extern short int is_anonymous_enabled (void);
-extern int anonymous_search (const char *s);
-extern int anonymous_insert (const char *s);
+extern short int is_anonymous_enabled (struct config_s *conf);
+extern int anonymous_search (struct config_s *conf, const char *s);
+extern int anonymous_insert (struct config_s *conf, const char *s);
#endif
diff --git a/src/conf.c b/src/conf.c
index 69a4c85..9dd6da2 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -624,7 +624,7 @@ static HANDLE_FUNC (handle_anonymous)
if (!arg)
return -1;
- anonymous_insert (arg);
+ anonymous_insert (conf, arg);
safefree (arg);
return 0;
}
diff --git a/src/main.c b/src/main.c
index 2963957..fc5ad45 100644
--- a/src/main.c
+++ b/src/main.c
@@ -325,9 +325,9 @@ main (int argc, char **argv)
* in the list of allowed headers, since it is required in a
* HTTP/1.0 request. Also add the Content-Type header since it
* goes hand in hand with Content-Length. */
- if (is_anonymous_enabled ()) {
- anonymous_insert ("Content-Length");
- anonymous_insert ("Content-Type");
+ if (is_anonymous_enabled (config)) {
+ anonymous_insert (config, "Content-Length");
+ anonymous_insert (config, "Content-Type");
}
if (daemonized == TRUE) {
diff --git a/src/reqs.c b/src/reqs.c
index 310871c..041fb03 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -919,8 +919,8 @@ process_client_headers (struct conn_s *connptr, hashmap_t hashofheaders)
hashmap_return_entry (hashofheaders,
iter, &data, (void **) &header);
- if (!is_anonymous_enabled ()
- || anonymous_search (data) > 0) {
+ if (!is_anonymous_enabled (config)
+ || anonymous_search (config, data) > 0) {
ret =
write_message (connptr->server_fd,
"%s: %s\r\n", data, header);