aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c/request.c
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
commit597fdcf34d2e255e5266d8b6c24214c3030f9904 (patch)
treed865a8f0953f4d049fa1905871d6f3c742019ef3 /src/c/request.c
parentad00c1edb8f819c4489dbf1e2106108f92e7bf98 (diff)
Fix time comparison operators; safer saving of queryStrings
Diffstat (limited to 'src/c/request.c')
-rw-r--r--src/c/request.c10
1 files changed, 7 insertions, 3 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);