Browse Source

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.

v0.1.8
Georg Hopp 12 years ago
parent
commit
e6dc20ca09
  1. 3
      src/http/parser/p_post_vars.c

3
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));

Loading…
Cancel
Save