--- cgicc-3.2.9.old/cgicc/Cgicc.cpp 2009-11-14 10:08:15.000000000 -0800 +++ cgicc-3.2.9/cgicc/Cgicc.cpp 2011-03-10 11:01:55.000000000 -0800 @@ -356,14 +356,32 @@ // Parse the data in one fell swoop for efficiency while(true) { - // Find the '=' separating the name from its value - pos = data.find_first_of('=', oldPos); + // Find the '=' separating the name from its value, also have to check for '&' as its a common misplaced delimiter but is a delimiter none the less + pos = data.find_first_of( "&=", oldPos); // If no '=', we're finished if(std::string::npos == pos) break; - // Decode the name + // pos == '&', that means whatever is in name is the only name/value + if( data.at( pos ) == '&' ) + { + const char * pszData = data.c_str() + oldPos; + while( *pszData == '&' ) // eat up extraneous '&' + { + ++pszData; ++oldPos; + } + if( oldPos >= pos ) + { // its all &'s + oldPos = ++pos; + continue; + } + // this becomes an name with an empty value + name = form_urldecode(data.substr(oldPos, pos - oldPos)); + fFormData.push_back(FormEntry(name, "" ) ); + oldPos = ++pos; + continue; + } name = form_urldecode(data.substr(oldPos, pos - oldPos)); oldPos = ++pos;