diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-12-26 17:29:03 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-12-26 17:29:03 -0500 |
commit | ad00c1edb8f819c4489dbf1e2106108f92e7bf98 (patch) | |
tree | 897f72fa64ec732b9a26c428c5ddeb9a0d7f6cf6 /src/c/request.c | |
parent | bfbe3b9c6870d6a501816c080b52d9e0c922db6c (diff) |
queryString and effectfulUrl
Diffstat (limited to 'src/c/request.c')
-rw-r--r-- | src/c/request.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/c/request.c b/src/c/request.c index b49a524e..3627d2f3 100644 --- a/src/c/request.c +++ b/src/c/request.c @@ -164,19 +164,21 @@ void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_log typedef struct uw_rc { - size_t path_copy_size; - char *path_copy; + size_t path_copy_size, queryString_size; + char *path_copy, *queryString; } *uw_request_context; uw_request_context uw_new_request_context(void) { uw_request_context r = malloc(sizeof(struct uw_rc)); - r->path_copy_size = 0; + r->path_copy_size = r->queryString_size = 0; r->path_copy = malloc(0); + r->queryString = malloc(0); return r; } void uw_free_request_context(uw_request_context r) { free(r->path_copy); + free(r->queryString); free(r); } @@ -380,6 +382,14 @@ request_result uw_request(uw_request_context rc, uw_context ctx, if (inputs) { char *name, *value; + int len = strlen(inputs); + + if (len+1 > rc->queryString_size) { + rc->queryString_size = len+1; + rc->queryString = realloc(rc->queryString, len+1); + } + strcpy(rc->queryString, inputs); + uw_setQueryString(ctx, rc->queryString); while (*inputs) { name = inputs; |