27 using namespace Protocol;
31 Block buffer(transceiver->requestWrite(
sizeof(Header)+
sizeof(EndRequest)));
33 Header& header=*(Header*)buffer.
data;
36 header.setRequestId(
id.fcgiId);
37 header.setContentLength(
sizeof(EndRequest));
38 header.setPaddingLength(0);
40 EndRequest& body=*(EndRequest*)(buffer.data+
sizeof(Header));
44 transceiver->secureWrite(
sizeof(Header)+
sizeof(EndRequest),
id, killCon);
51 using namespace Protocol;
58 Block buffer(transceiver->requestWrite(
sizeof(Header)+
sizeof(EndRequest)));
60 Header& header=*(Header*)buffer.
data;
63 header.setRequestId(
id.fcgiId);
64 header.setContentLength(
sizeof(EndRequest));
65 header.setPaddingLength(0);
67 EndRequest& body=*(EndRequest*)(buffer.data+
sizeof(Header));
71 transceiver->secureWrite(
sizeof(Header)+
sizeof(EndRequest),
id, killCon);
76 boost::lock_guard<boost::mutex> lock(messages);
77 m_message=messages.front();
83 const Header& header=*(Header*)message().data.get();
84 const char* body=message().data.get()+
sizeof(Header);
85 switch(header.getType())
90 if(header.getContentLength()==0)
92 if(m_maxPostSize && environment().contentLength > m_maxPostSize)
94 bigPostErrorHandler();
101 m_environment.fill(body, header.getContentLength());
108 if(header.getContentLength()==0)
113 const char multipart[] =
"multipart/form-data";
114 const char urlEncoded[] =
"application/x-www-form-urlencoded";
116 if(
sizeof(multipart)-1 == m_environment.contentType.size() && equal(multipart, multipart+
sizeof(multipart)-1, m_environment.contentType.begin()))
117 m_environment.parsePostsMultipart();
119 else if(
sizeof(urlEncoded)-1 == m_environment.contentType.size() && equal(urlEncoded, urlEncoded+
sizeof(urlEncoded)-1, m_environment.contentType.begin()))
120 m_environment.parsePostsUrlEncoded();
126 m_environment.clearPostBuffer();
136 if(!m_environment.fillPostBuffer(body, header.getContentLength()))
138 bigPostErrorHandler();
143 inHandler(header.getContentLength());
159 catch(
const std::exception& e)
173 "Status: 500 Internal Server Error\n"\
174 "Content-Type: text/html; charset=ISO-8859-1\r\n\r\n"\
178 "<title>500 Internal Server Error</title>"\
181 "<h1>500 Internal Server Error</h1>"\
185 err <<
'"' << error.what() <<
'"' <<
" from \"http://" << environment().host << environment().requestUri <<
"\" with a " << environment().requestMethod <<
" request method.";
193 "Status: 413 Request Entity Too Large\n"\
194 "Content-Type: text/html; charset=ISO-8859-1\r\n\r\n"\
198 "<title>413 Request Entity Too Large</title>"\
201 "<h1>413 Request Entity Too Large</h1>"\