diff options
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 7cbf9afef..2b0acd7dc 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -411,7 +411,7 @@ struct globals { | |||
411 | char *rmt_ip_str; /* for $REMOTE_ADDR and $REMOTE_PORT */ | 411 | char *rmt_ip_str; /* for $REMOTE_ADDR and $REMOTE_PORT */ |
412 | const char *bind_addr_or_port; | 412 | const char *bind_addr_or_port; |
413 | 413 | ||
414 | const char *g_query; | 414 | char *g_query; |
415 | const char *opt_c_configFile; | 415 | const char *opt_c_configFile; |
416 | const char *home_httpd; | 416 | const char *home_httpd; |
417 | const char *index_page; | 417 | const char *index_page; |
@@ -2166,14 +2166,6 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2166 | strcpy(urlcopy, urlp); | 2166 | strcpy(urlcopy, urlp); |
2167 | /* NB: urlcopy ptr is never changed after this */ | 2167 | /* NB: urlcopy ptr is never changed after this */ |
2168 | 2168 | ||
2169 | /* Extract url args if present */ | ||
2170 | /* g_query = NULL; - already is */ | ||
2171 | tptr = strchr(urlcopy, '?'); | ||
2172 | if (tptr) { | ||
2173 | *tptr++ = '\0'; | ||
2174 | g_query = tptr; | ||
2175 | } | ||
2176 | |||
2177 | #if ENABLE_FEATURE_HTTPD_PROXY | 2169 | #if ENABLE_FEATURE_HTTPD_PROXY |
2178 | { | 2170 | { |
2179 | int proxy_fd; | 2171 | int proxy_fd; |
@@ -2194,12 +2186,10 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2194 | * When /urlSFX is requested, reverse proxy it | 2186 | * When /urlSFX is requested, reverse proxy it |
2195 | * to http://hostname[:port]/new/pathSFX | 2187 | * to http://hostname[:port]/new/pathSFX |
2196 | */ | 2188 | */ |
2197 | fdprintf(proxy_fd, "%s %s%s%s%s %s\r\n", | 2189 | fdprintf(proxy_fd, "%s %s%s %s\r\n", |
2198 | prequest, /* "GET" or "POST" */ | 2190 | prequest, /* "GET" or "POST" */ |
2199 | proxy_entry->url_to, /* "/new/path" */ | 2191 | proxy_entry->url_to, /* "/new/path" */ |
2200 | urlcopy + strlen(proxy_entry->url_from), /* "SFX" */ | 2192 | urlcopy + strlen(proxy_entry->url_from), /* "SFX" */ |
2201 | (g_query ? "?" : ""), /* "?" (maybe) */ | ||
2202 | (g_query ? g_query : ""), /* query string (maybe) */ | ||
2203 | HTTP_slash /* HTTP/xyz" or "" */ | 2193 | HTTP_slash /* HTTP/xyz" or "" */ |
2204 | ); | 2194 | ); |
2205 | cgi_io_loop_and_exit(proxy_fd, proxy_fd, /*max POST length:*/ INT_MAX); | 2195 | cgi_io_loop_and_exit(proxy_fd, proxy_fd, /*max POST length:*/ INT_MAX); |
@@ -2207,6 +2197,11 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
2207 | } | 2197 | } |
2208 | #endif | 2198 | #endif |
2209 | 2199 | ||
2200 | /* Extract url args if present */ | ||
2201 | g_query = strchr(urlcopy, '?'); | ||
2202 | if (g_query) | ||
2203 | *g_query++ = '\0'; | ||
2204 | |||
2210 | /* Decode URL escape sequences */ | 2205 | /* Decode URL escape sequences */ |
2211 | tptr = percent_decode_in_place(urlcopy, /*strict:*/ 1); | 2206 | tptr = percent_decode_in_place(urlcopy, /*strict:*/ 1); |
2212 | if (tptr == NULL) | 2207 | if (tptr == NULL) |