+ WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, http_status_str((http_status)response)));
+
+ rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT", true));
+ rheaders.CreateHeader("Server", INSPIRCD_BRANCH);
+ rheaders.SetHeader("Content-Length", ConvToStr(size));
+
+ if (size)
+ rheaders.CreateHeader("Content-Type", "text/html");
+ else
+ rheaders.RemoveHeader("Content-Type");
+
+ /* Supporting Connection: keep-alive causes a whole world of hurt synchronizing timeouts,
+ * so remove it, its not essential for what we need.
+ */
+ rheaders.SetHeader("Connection", "Close");
+
+ WriteData(rheaders.GetFormattedHeaders());
+ WriteData("\r\n");
+ }
+
+ void OnDataReady() CXX11_OVERRIDE
+ {
+ if (parser.upgrade || HTTP_PARSER_ERRNO(&parser))
+ return;
+ http_parser_execute(&parser, &parser_settings, recvq.data(), recvq.size());
+ if (parser.upgrade)
+ SendHTTPError(status_code ? status_code : 400);
+ else if (HTTP_PARSER_ERRNO(&parser))
+ SendHTTPError(status_code ? status_code : 400, http_errno_description((http_errno)parser.http_errno));
+ }
+
+ void ServeData()
+ {
+ ModResult MOD_RESULT;
+ std::string method = http_method_str(static_cast<http_method>(parser.method));
+ HTTPRequestURI parsed;
+ ParseURI(uri, parsed);
+ HTTPRequest acl(method, parsed, &headers, this, ip, body);
+ FIRST_MOD_RESULT_CUSTOM(*aclevprov, HTTPACLEventListener, OnHTTPACLCheck, MOD_RESULT, (acl));
+ if (MOD_RESULT != MOD_RES_DENY)