From 597fdcf34d2e255e5266d8b6c24214c3030f9904 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 27 Dec 2010 12:08:00 -0500 Subject: Fix time comparison operators; safer saving of queryStrings --- src/c/request.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/c/request.c') 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); -- cgit v1.2.3