summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2008-07-27 10:47:46 +0000
committerpixel <pixel>2008-07-27 10:47:46 +0000
commitbf0c4cb31f764f6ec9a56576a9e9b800698ccd66 (patch)
tree6d37076919d4b057c59b875c595f623648936ba5 /lib
parent30f696282ffd3d4896d9d14dcf4e914938e9a09c (diff)
Fix for badly formatted query strings.
Diffstat (limited to 'lib')
-rw-r--r--lib/LuaHttp.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc
index cfa26da..be4f143 100644
--- a/lib/LuaHttp.cc
+++ b/lib/LuaHttp.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: LuaHttp.cc,v 1.29 2008-07-18 14:02:39 pixel Exp $ */
+/* $Id: LuaHttp.cc,v 1.30 2008-07-27 10:47:46 pixel Exp $ */
#include "Domain.h"
#include "LuaHttp.h"
@@ -405,13 +405,18 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx
char * v = (*(req.vars))[i].strdup(), * p;
p = strchr(v, '=');
- *p = 0;
- p++;
-
- L->push(v);
- L->push(p);
- L->settable();
+ if (!p) {
+ L->push(v);
+ L->push(true);
+ } else {
+ *p = 0;
+ p++;
+ L->push(v);
+ L->push(p);
+ }
+
+ L->settable();
free(v);
}
L->settable();
@@ -422,6 +427,10 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx
char * v = (*(req.headers))[i].strdup(), * p;
p = strchr(v, '=');
+ if (!p) {
+ free(v);
+ continue;
+ }
*p = 0;
p++;