X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=filters.c;h=e5cf406d78fa2ca939f7cae51bd6a788cf46fd17;hp=7b586bc0881f4e6254adc3c424c2709d45c49875;hb=beee9096e6118e2c0ce3c2c062135980dedb80d2;hpb=c83713758e9465e03ec3b0228c433e6f2d843352 diff --git a/filters.c b/filters.c index 7b586bc0..e5cf406d 100644 --- a/filters.c +++ b/filters.c @@ -66,6 +66,9 @@ #ifdef FEATURE_CLIENT_TAGS #include "client-tags.h" #endif +#ifdef FEATURE_HTTPS_INSPECTION +#include "ssl.h" +#endif #ifdef _WIN32 #include "win32.h" @@ -1220,8 +1223,33 @@ struct http_response *redirect_url(struct client_state *csp) if (*redirection_string == 's') { - old_url = csp->http->url; +#ifdef FEATURE_HTTPS_INSPECTION + if (client_use_ssl(csp)) + { + jb_err err; + + old_url = strdup_or_die("https://"); + err = string_append(&old_url, csp->http->hostport); + if (!err) err = string_append(&old_url, csp->http->path); + if (err) + { + log_error(LOG_LEVEL_FATAL, + "Failed to rebuild URL 'https://%s%s'", + csp->http->hostport, csp->http->path); + } + } + else +#endif + { + old_url = csp->http->url; + } new_url = rewrite_url(old_url, redirection_string); +#ifdef FEATURE_HTTPS_INSPECTION + if (client_use_ssl(csp)) + { + freez(old_url); + } +#endif } else { @@ -2675,7 +2703,7 @@ int content_requires_filtering(struct client_state *csp) * The server didn't bother to declare a MIME-Type. * Assume it's text that can be filtered. * - * This also regulary happens with 304 responses, + * This also regularly happens with 304 responses, * therefore logging anything here would cause * too much noise. */