* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
/** This class is used to handle HTTP socket timeouts
*/
-class HttpServerTimeout : public InspTimer
+class HttpServerTimeout : public Timer
{
private:
/** HttpServerSocket we are attached to
/** A socket used for HTTP transport
*/
-class HttpServerSocket : public InspSocket
+class HttpServerSocket : public BufferedSocket
{
FileReader* index;
HttpState InternalState;
public:
- HttpServerSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : InspSocket(SI, host, port, listening, maxtime), index(index_page), postsize(0)
+ HttpServerSocket(InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, FileReader* index_page) : BufferedSocket(SI, shost, iport, listening, maxtime), index(index_page), postsize(0)
{
InternalState = HTTP_LISTEN;
Timeout = NULL;
}
- HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : InspSocket(SI, newfd, ip), index(ind), postsize(0), keepalive(false), DataSinceLastTick(false)
+ HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0), keepalive(false), DataSinceLastTick(false)
{
InternalState = HTTP_SERVE_WAIT_REQUEST;
Timeout = new HttpServerTimeout(this, Instance->SE);
virtual bool OnDataReady()
{
- char* data = this->Read();
+ const char* data = this->Read();
/* Check that the data read is a valid pointer and it has some content */
if (!data || !*data)
if (reqbuffer.length() >= 8192)
{
- Instance->Log(DEBUG, "m_httpd dropped connection due to an oversized request buffer");
+ Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer");
reqbuffer.clear();
return false;
}
}
}
- void Page(std::stringstream* n, int response, HTTPHeaders *headers)
+ void Page(std::stringstream* n, int response, HTTPHeaders *hheaders)
{
- SendHeaders(n->str().length(), response, *headers);
+ SendHeaders(n->str().length(), response, *hheaders);
this->Write(n->str());
if (!keepalive)
}
};
-HttpServerTimeout::HttpServerTimeout(HttpServerSocket* sock, SocketEngine* engine) : InspTimer(15, time(NULL), true), s(sock), SE(engine)
+HttpServerTimeout::HttpServerTimeout(HttpServerSocket* sock, SocketEngine* engine) : Timer(15, time(NULL), true), s(sock), SE(engine)
{
}
{
ReadConfig();
HttpModule = this;
+ Implementation eventlist[] = { I_OnRequest };
+ ServerInstance->Modules->Attach(eventlist, this, 1);
}
- char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
claimed = true;
HTTPDocument* doc = (HTTPDocument*)request->GetData();
return NULL;
}
- void Implements(char* List)
- {
- List[I_OnRequest] = 1;
- }
virtual ~ModuleHttpServer()
{
httpsocks[i]->Close();
delete httpsocks[i]->GetIndex();
}
- ServerInstance->InspSocketCull();
+ ServerInstance->BufferedSocketCull();
}
virtual Version GetVersion()