From 9c4c73afa1557fed1ef6925819220b83dd98834b Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 30 May 2007 19:21:21 +0000 Subject: [PATCH] - fix for Fix #266 --- libhttpd/api.c | 13 ++++++------- libhttpd/httpd.h | 1 + src/http.c | 8 +++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libhttpd/api.c b/libhttpd/api.c index 2590b674..2324dc5e 100644 --- a/libhttpd/api.c +++ b/libhttpd/api.c @@ -573,9 +573,8 @@ int httpdReadRequest(httpd *server, request *r) #if 0 - /* XXX: For WifiDog, we do not need to process any of the - post or query string parameters. So, lets keep the GET variables - in the request.path too! + /* XXX: For WifiDog, we only process the query string parameters + but keep the GET variables in the request.query! */ /* ** Process and POST data @@ -587,18 +586,18 @@ int httpdReadRequest(httpd *server, request *r) _httpd_storeData(r, buf); } - +#endif + /* ** Process any URL data */ cp = index(r->request.path,'?'); if (cp != NULL) { - *cp = 0; - cp++; + *cp++ = 0; + strncpy(r->request.query, cp, sizeof(r->request.query)); _httpd_storeData(r, cp); } -#endif return(0); } diff --git a/libhttpd/httpd.h b/libhttpd/httpd.h index 963d8069..30158008 100644 --- a/libhttpd/httpd.h +++ b/libhttpd/httpd.h @@ -98,6 +98,7 @@ typedef struct { contentLength, authLength; char path[HTTP_MAX_URL], + query[HTTP_MAX_URL], host[HTTP_MAX_URL], /* acv@acv.ca/wifidog: Added decoding of host: header if present. */ ifModified[HTTP_MAX_URL]; diff --git a/src/http.c b/src/http.c index d54a94c6..9336d13b 100644 --- a/src/http.c +++ b/src/http.c @@ -77,9 +77,11 @@ http_callback_404(httpd *webserver, request *r) * http request to a standard port. At any rate, this handler is called only * if the internet/auth server is down so it's not a huge loss, but still. */ - snprintf(tmp_url, (sizeof(tmp_url) - 1), "http://%s%s", - r->request.host, - r->request.path); + snprintf(tmp_url, (sizeof(tmp_url) - 1), "http://%s%s%s%s", + r->request.host, + r->request.path, + r->request.query[0] ? "?" : "", + r->request.query); url = httpdUrlEncode(tmp_url); if (!is_online()) {