changeset 1371:4e5ca2a77a4d

Fix time comparison operators; safer saving of queryStrings
author Adam Chlipala <adam@chlipala.net>
date Mon, 27 Dec 2010 12:08:00 -0500
parents 44a12a321150
children 268d9af9103f
files src/c/request.c src/monoize.sml
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/request.c	Sun Dec 26 17:29:03 2010 -0500
+++ b/src/c/request.c	Mon Dec 27 12:08:00 2010 -0500
@@ -170,9 +170,10 @@
 
 uw_request_context uw_new_request_context(void) {
   uw_request_context r = malloc(sizeof(struct uw_rc));
-  r->path_copy_size = r->queryString_size = 0;
+  r->path_copy_size = 0;
+  r->queryString_size = 1;
   r->path_copy = malloc(0);
-  r->queryString = malloc(0);
+  r->queryString = malloc(1);
   return r;
 }
 
@@ -201,6 +202,8 @@
   int had_error = 0;
   char errmsg[ERROR_BUF_LEN];
 
+  rc->queryString[0] = 0;
+
   for (s = path; *s; ++s) {
     if (s[0] == '%' && s[1] == '2' && s[2] == '7') {
       s[0] = '\'';
@@ -389,7 +392,6 @@
         rc->queryString = realloc(rc->queryString, len+1);
       }
       strcpy(rc->queryString, inputs);
-      uw_setQueryString(ctx, rc->queryString);
 
       while (*inputs) {
         name = inputs;
@@ -416,6 +418,8 @@
   log_debug(logger_data, "Serving URI %s....\n", path);
 
   while (1) {
+    uw_setQueryString(ctx, rc->queryString);
+
     if (!had_error) {
       size_t path_len = strlen(path);
 
--- a/src/monoize.sml	Sun Dec 26 17:29:03 2010 -0500
+++ b/src/monoize.sml	Mon Dec 27 12:08:00 2010 -0500
@@ -1112,11 +1112,11 @@
                               (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
                               (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc),
                                         (L'.TFfi ("Basis", "bool"), loc),
-                                        (L'.EFfiApp ("Basis", s, [(L'.ERel 1, loc), (L'.ERel 0, loc)]), loc)), loc)), loc)
+                                        (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc)
             in
                 ordEx ((L'.TFfi ("Basis", "bool"), loc),
-                       boolBin "lt_time",
-                       boolBin "le_time")
+                       boolBin "<",
+                       boolBin "<=")
             end
           | L.EFfi ("Basis", "ord_string") =>
             let
@@ -1155,7 +1155,7 @@
                               (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
                               (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc),
                                         (L'.TFfi ("Basis", "bool"), loc),
-                                        (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc)
+                                        (L'.EFfiApp ("Basis", s, [(L'.ERel 1, loc), (L'.ERel 0, loc)]), loc)), loc)), loc)
             in
                 ordEx ((L'.TFfi ("Basis", "time"), loc),
                        boolBin "lt_time",