diff options
author | Mukund Sivaraman <muks@banu.com> | 2008-12-08 13:39:44 +0000 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2008-12-08 13:39:44 +0000 |
commit | 024b317de09a7d426973ffa16e4781ec75aaef35 (patch) | |
tree | 6994f5266e93773333bfa99fa24489ac139452a3 /src/reverse-proxy.c | |
parent | 6e6f992f8cbc01ce4d6840d1a020f18846c37847 (diff) |
Convert tabs to spaces
Diffstat (limited to 'src/reverse-proxy.c')
-rw-r--r-- | src/reverse-proxy.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/src/reverse-proxy.c b/src/reverse-proxy.c index db07bae..d4ca7eb 100644 --- a/src/reverse-proxy.c +++ b/src/reverse-proxy.c @@ -43,17 +43,16 @@ reversepath_add (const char *path, const char *url) if (!strstr (url, "://")) { log_message (LOG_WARNING, - "Skipping reverse proxy rule: '%s' is not a valid url", - url); + "Skipping reverse proxy rule: '%s' is not a valid url", + url); return; } if (path && *path != '/') { log_message (LOG_WARNING, - "Skipping reverse proxy rule: path '%s' " - "doesn't start with a /", - path); + "Skipping reverse proxy rule: path '%s' " + "doesn't start with a /", path); return; } @@ -74,8 +73,8 @@ reversepath_add (const char *path, const char *url) config.reversepath_list = reverse; log_message (LOG_INFO, - "Added reverse proxy rule: %s -> %s", reverse->path, - reverse->url); + "Added reverse proxy rule: %s -> %s", reverse->path, + reverse->url); } /* @@ -89,7 +88,7 @@ reversepath_get (char *url) while (reverse) { if (strstr (url, reverse->path) == url) - return reverse; + return reverse; reverse = reverse->next; } @@ -102,7 +101,7 @@ reversepath_get (char *url) */ char * reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, - char *url) + char *url) { char *rewrite_url = NULL; char *cookie = NULL; @@ -115,31 +114,31 @@ reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, /* First try locating the reverse mapping by request url */ reverse = reversepath_get (url); if (reverse) - { - rewrite_url = safemalloc (strlen (url) + strlen (reverse->url) + 1); - strcpy (rewrite_url, reverse->url); - strcat (rewrite_url, url + strlen (reverse->path)); - } + { + rewrite_url = safemalloc (strlen (url) + strlen (reverse->url) + 1); + strcpy (rewrite_url, reverse->url); + strcat (rewrite_url, url + strlen (reverse->path)); + } else if (config.reversemagic - && hashmap_entry_by_key (hashofheaders, - "cookie", (void **) &cookie) > 0) - { - - /* No match - try the magical tracking cookie next */ - if ((cookieval = strstr (cookie, REVERSE_COOKIE "=")) - && (reverse = - reversepath_get (cookieval + strlen (REVERSE_COOKIE) + 1))) - { - - rewrite_url = safemalloc (strlen (url) + - strlen (reverse->url) + 1); - strcpy (rewrite_url, reverse->url); - strcat (rewrite_url, url + 1); - - log_message (LOG_INFO, - "Magical tracking cookie says: %s", reverse->path); - } - } + && hashmap_entry_by_key (hashofheaders, + "cookie", (void **) &cookie) > 0) + { + + /* No match - try the magical tracking cookie next */ + if ((cookieval = strstr (cookie, REVERSE_COOKIE "=")) + && (reverse = + reversepath_get (cookieval + strlen (REVERSE_COOKIE) + 1))) + { + + rewrite_url = safemalloc (strlen (url) + + strlen (reverse->url) + 1); + strcpy (rewrite_url, reverse->url); + strcat (rewrite_url, url + 1); + + log_message (LOG_INFO, + "Magical tracking cookie says: %s", reverse->path); + } + } } /* Forward proxy support off and no reverse path match found */ @@ -147,8 +146,8 @@ reverse_rewrite_url (struct conn_s *connptr, hashmap_t hashofheaders, { log_message (LOG_ERR, "Bad request"); indicate_http_error (connptr, 400, "Bad Request", - "detail", - "Request has an invalid URL", "url", url, NULL); + "detail", + "Request has an invalid URL", "url", url, NULL); return NULL; } |