diff options
author | Michael Adam <obnox@samba.org> | 2009-12-06 22:59:08 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-12-07 00:22:46 +0100 |
commit | 3f1201c8b37280111efaf2e44d5992459eb4f4be (patch) | |
tree | c3309448b561496c8736947668e67717c77820bc | |
parent | 624d146cd6eefe1a6e6317f27a99f8c9521ab63d (diff) | |
download | tinyproxy-3f1201c8b37280111efaf2e44d5992459eb4f4be.tar.gz tinyproxy-3f1201c8b37280111efaf2e44d5992459eb4f4be.zip |
Add a reversepath argument to reversepath_get().
This abstracts the setter/getter functions for the reversepath
list from the concrete list in config.reversepath_list.
Michael
Diffstat (limited to '')
-rw-r--r-- | src/reverse-proxy.c | 11 | ||||
-rw-r--r-- | src/reverse-proxy.h | 3 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/reverse-proxy.c b/src/reverse-proxy.c index 126b957..efafa74 100644 --- a/src/reverse-proxy.c +++ b/src/reverse-proxy.c @@ -80,10 +80,8 @@ void reversepath_add (const char *path, const char *url, /* * Check if a request url is in the reversepath list */ -struct reversepath *reversepath_get (char *url) +struct reversepath *reversepath_get (char *url, struct reversepath *reverse) { - struct reversepath *reverse = config.reversepath_list; - while (reverse) { if (strstr (url, reverse->path) == url) return reverse; @@ -108,7 +106,7 @@ char *reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, /* Reverse requests always start with a slash */ if (*url == '/') { /* First try locating the reverse mapping by request url */ - reverse = reversepath_get (url); + reverse = reversepath_get (url, config.reversepath_list); if (reverse) { rewrite_url = (char *) safemalloc (strlen (url) + strlen (reverse->url) + @@ -124,8 +122,9 @@ char *reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, if ((cookieval = strstr (cookie, REVERSE_COOKIE "=")) && (reverse = reversepath_get (cookieval + - strlen (REVERSE_COOKIE) + - 1))) { + strlen (REVERSE_COOKIE) + 1, + config.reversepath_list))) + { rewrite_url = (char *) safemalloc (strlen (url) + diff --git a/src/reverse-proxy.h b/src/reverse-proxy.h index 6bd40d6..252b41b 100644 --- a/src/reverse-proxy.h +++ b/src/reverse-proxy.h @@ -33,7 +33,8 @@ struct reversepath { extern void reversepath_add (const char *path, const char *url, struct reversepath **reversepath_list); -extern struct reversepath *reversepath_get (char *url); +extern struct reversepath *reversepath_get (char *url, + struct reversepath *reverse); extern char *reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, char *url); |