summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-27 12:08:00 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-27 12:08:00 -0500
commit5cab93a0031e80264226f44ff986c62b65b03c5e (patch)
treed865a8f0953f4d049fa1905871d6f3c742019ef3
parent43a2c0777948cd8ab868befbaffbb0585eee208c (diff)
Fix time comparison operators; safer saving of queryStrings
-rw-r--r--src/c/request.c10
-rw-r--r--src/monoize.sml8
2 files changed, 11 insertions, 7 deletions
diff --git a/src/c/request.c b/src/c/request.c
index 3627d2f3..1fff0693 100644
--- a/src/c/request.c
+++ b/src/c/request.c
@@ -170,9 +170,10 @@ typedef struct uw_rc {
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 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
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 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
rc->queryString = realloc(rc->queryString, len+1);
}
strcpy(rc->queryString, inputs);
- uw_setQueryString(ctx, rc->queryString);
while (*inputs) {
name = inputs;
@@ -416,6 +418,8 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
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);
diff --git a/src/monoize.sml b/src/monoize.sml
index 4009226d..30dfdd46 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1112,11 +1112,11 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(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 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(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",