- if ((InternalState == HTTP_SERVE_WAIT_REQUEST) && (request_type == "POST"))
- {
- /* Do we need to fetch postdata? */
- postdata.clear();
- InternalState = HTTP_SERVE_RECV_POSTDATA;
- std::string header_item;
- while (headers >> header_item)
- {
- if (header_item == "Content-Length:")
- {
- headers >> header_item;
- postsize = atoi(header_item.c_str());
- }
- }
- if (!postsize)
- {
- InternalState = HTTP_SERVE_SEND_DATA;
- SendHeaders(0, 400, "");
- Timeout = new HttpServerTimeout(this, Instance->SE);
- Instance->Timers->AddTimer(Timeout);
- }
- else
- {
- 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 */
- if (postdata.length() >= postsize)
- ServeData();
- }
- }
- else if (InternalState == HTTP_SERVE_RECV_POSTDATA)