- Instance->Log(DEBUG,"%d bytes to read for POST",postsize);
- std::string::size_type x = headers.str().find("\r\n\r\n");
- postdata = headers.str().substr(x+5, headers.str().length());
- /* Get content length and store */
- if (postdata.length() >= postsize)
- ServeData();
+ if (!postsize)
+ {
+ InternalState = HTTP_SERVE_SEND_DATA;
+ SendHeaders(0, 400, "");
+ Timeout = new HTTPTimeout(this, Instance->SE);
+ Instance->Timers->AddTimer(Timeout);
+ }
+ else
+ {
+ Instance->Log(DEBUG,"%d bytes to read for POST",postsize);
+ std::string::size_type x = headers.str().find("\r\n\r\n");
+ postdata = headers.str().substr(x+4, headers.str().length());
+ /* Get content length and store */
+ Instance->Log(DEBUG,"Initial postdata: '%s'", postdata.c_str());
+ if (postdata.length() >= postsize)
+ ServeData();
+ }