From e6dc20ca0992450f68f9880a3eb1d626f1a91f89 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Tue, 26 Nov 2013 22:36:53 +0000 Subject: [PATCH] fix urldecode of post vars. I can't urldecode the whole body and then start splitting it into values because the urldecode can add reserved characters. I have to urldecode each value by it's own. TODO: check if the keys have to be urldecoded too. --- src/http/parser/p_post_vars.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/http/parser/p_post_vars.c b/src/http/parser/p_post_vars.c index 361bf10..105c192 100644 --- a/src/http/parser/p_post_vars.c +++ b/src/http/parser/p_post_vars.c @@ -42,8 +42,6 @@ httpParserPostVars(HttpParser this) char * pair = this->current->body; ssize_t togo = this->current->nbody; - togo = urldecode(pair, togo); - while(NULL != pair && 0 < togo) { char * key = pair; char * eqsign = memchr(key, '=', togo); @@ -63,6 +61,7 @@ httpParserPostVars(HttpParser this) nvalue = pair-eqsign-1; value = (0 != nvalue)? eqsign+1 : NULL; + nvalue = urldecode(value, nvalue); hashAdd(request->post, new(HashValue, key, eqsign-key, value, nvalue));