Commit e6dc20ca0992450f68f9880a3eb1d626f1a91f89

Authored by Georg Hopp
1 parent 43072d0a

fix urldecode of post vars. I can't urldecode the whole body and then start spli…

…tting 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.
Showing 1 changed file with 1 additions and 2 deletions
@@ -42,8 +42,6 @@ httpParserPostVars(HttpParser this) @@ -42,8 +42,6 @@ httpParserPostVars(HttpParser this)
42 char * pair = this->current->body; 42 char * pair = this->current->body;
43 ssize_t togo = this->current->nbody; 43 ssize_t togo = this->current->nbody;
44 44
45 - togo = urldecode(pair, togo);  
46 -  
47 while(NULL != pair && 0 < togo) { 45 while(NULL != pair && 0 < togo) {
48 char * key = pair; 46 char * key = pair;
49 char * eqsign = memchr(key, '=', togo); 47 char * eqsign = memchr(key, '=', togo);
@@ -63,6 +61,7 @@ httpParserPostVars(HttpParser this) @@ -63,6 +61,7 @@ httpParserPostVars(HttpParser this)
63 61
64 nvalue = pair-eqsign-1; 62 nvalue = pair-eqsign-1;
65 value = (0 != nvalue)? eqsign+1 : NULL; 63 value = (0 != nvalue)? eqsign+1 : NULL;
  64 + nvalue = urldecode(value, nvalue);
66 65
67 hashAdd(request->post, 66 hashAdd(request->post,
68 new(HashValue, key, eqsign-key, value, nvalue)); 67 new(HashValue, key, eqsign-key, value, nvalue));
Please register or login to post a comment