Thu 18 Sep 2008 06:12:40 PM UTC, original submission:
Using visual c++ 2005 express edition on windows xp. When you execute this line:
if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )
In this constructor:
CgiEnvironment(CgiInput *input)
It throws an invalid iterator exception if there's a zero length POST.
I wrapped an if statement around the code that parses the post:
// If input is 0, use the default implementation of CgiInput
if ( input == 0 )
{
if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
}
else
if ( input->read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
fPostData = std::string( &data[0], getContentLength() );
changes to this:
if ( getContentLength() )
{
// If input is 0, use the default implementation of CgiInput
if ( input == 0 )
{
if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
}
else
if ( input->read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
fPostData = std::string( &data[0], getContentLength() );
}
FYI - Jay Sprenkle
|