aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@esdenera.com>2015-06-21 15:01:49 +0200
committerReyk Floeter <reyk@esdenera.com>2015-06-21 15:01:49 +0200
commitf15e18fe3175323d60b49af9db8ffa6b648682bf (patch)
tree48d9c129fc2baa01ed3943abb9b76894b285148f
parent739f1323fdd1b31986f8d976b287b5a250539ec7 (diff)
parent2c93f9b5dc502e6bc4b7050a5676dc5d8e16f8f2 (diff)
downloadhttpd-f15e18fe3175323d60b49af9db8ffa6b648682bf.tar.gz
httpd-f15e18fe3175323d60b49af9db8ffa6b648682bf.zip
Merge commit '2c93f9b5dc502e6bc4b7050a5676dc5d8e16f8f2'
-rw-r--r--httpd/server_http.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/httpd/server_http.c b/httpd/server_http.c
index 32b9e7d..c37e8d5 100644
--- a/httpd/server_http.c
+++ b/httpd/server_http.c
@@ -881,7 +881,7 @@ server_expand_http(struct client *clt, const char *val, char *buf,
{
struct http_descriptor *desc = clt->clt_descreq;
struct server_config *srv_conf = clt->clt_srv_conf;
- char ibuf[128], *str, *path;
+ char ibuf[128], *str, *path, *query;
int ret;
if (strlcpy(buf, val, len) >= len)
@@ -896,9 +896,15 @@ server_expand_http(struct client *clt, const char *val, char *buf,
return (NULL);
}
if (strstr(val, "$QUERY_STRING") != NULL) {
- if (expand_string(buf, len, "$QUERY_STRING",
- desc->http_query == NULL ? "" :
- desc->http_query) != 0)
+ if (desc->http_query == NULL) {
+ ret = expand_string(buf, len, "$QUERY_STRING", "");
+ } else {
+ if ((query = url_encode(desc->http_query)) == NULL)
+ return (NULL);
+ ret = expand_string(buf, len, "$QUERY_STRING", query);
+ free(query);
+ }
+ if (ret != 0)
return (NULL);
}
if (strstr(val, "$REMOTE_") != NULL) {
@@ -934,9 +940,13 @@ server_expand_http(struct client *clt, const char *val, char *buf,
if (desc->http_query == NULL) {
str = path;
} else {
- ret = asprintf(&str, "%s?%s",
- path, desc->http_query);
+ if ((query = url_encode(desc->http_query)) == NULL) {
+ free(path);
+ return (NULL);
+ }
+ ret = asprintf(&str, "%s?%s", path, query);
free(path);
+ free(query);
if (ret == -1)
return (NULL);
}