diff options
Diffstat (limited to 'src/haserl.c')
-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 = "&"; } |