diff options
author | Nathan Angelacos <nangel@alpinelinux.org> | 2015-03-11 19:12:33 +0000 |
---|---|---|
committer | Nathan Angelacos <nangel@alpinelinux.org> | 2015-03-11 19:12:33 +0000 |
commit | f2c0e230a549bb6e2f0329a6b7746b876913fd14 (patch) | |
tree | 394aa2d0124b58d4eb15dc123966efc8545343c1 /src | |
parent | 22275203cc9f97b79ffdedcbe6b51e0086fa8cb6 (diff) | |
download | haserl-f2c0e230a549bb6e2f0329a6b7746b876913fd14.tar.bz2 haserl-f2c0e230a549bb6e2f0329a6b7746b876913fd14.tar.xz |
Diffstat (limited to 'src')
-rw-r--r-- | src/haserl.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/haserl.c b/src/haserl.c index b23a9da..3d405ab 100644 --- a/src/haserl.c +++ b/src/haserl.c @@ -1,5 +1,5 @@ /* -------------------------------------------------------------------------- - * Copyright 2003-2014 (inclusive) Nathan Angelacos + * Copyright 2003-2015 (inclusive) Nathan Angelacos * (nangel@users.sourceforge.net) * * This file is part of haserl. @@ -473,23 +473,26 @@ ReadCGIPOSTValues (list_t * env ) unsigned char *data; const char *CONTENT_LENGTH = "CONTENT_LENGTH"; const char *CONTENT_TYPE = "CONTENT_TYPE"; + char *content_type = NULL; if ((getenv (CONTENT_LENGTH) == NULL) || (strtoul (getenv (CONTENT_LENGTH), NULL, 10) == 0)) return (0); - if (strncasecmp (getenv (CONTENT_TYPE) , "multipart/form-data", 19) - == 0) - { + content_type = getenv(CONTENT_TYPE); + + if ( ( content_type != NULL ) && + ( strncasecmp ( content_type , "multipart/form-data", 19)) == 0 ) + { /* This is a mime request, we need to go to the mime handler */ i = rfc2388_handler (env); return (i); - } + } /* at this point its either urlencoded or some other blob */ - - if ( ( strncasecmp (getenv (CONTENT_TYPE), "application/x-www-form-urlencoded", 33) == 0 ) || - (getenv (CONTENT_TYPE) == NULL ) ) { + if ( (content_type == NULL ) || + ( strncasecmp (getenv (CONTENT_TYPE), "application/x-www-form-urlencoded", 33) == 0 ) ) + { urldecoding = 1; matchstr = "&"; } |