]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd.cpp
Fix REMOVE maxparams
[user/henk/code/inspircd.git] / src / modules / m_httpd.cpp
index eaf6712671ccfb39b73f5996099d4255096aa1ea..bdf4e424e9a2fba01d4ff1f5104e26a8553707c6 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -48,7 +48,7 @@ class HttpServerSocket : public BufferedSocket
 
  public:
 
-       HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0)
+       HttpServerSocket(InspIRCd* SI, int newfd, const char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0)
        {
                InternalState = HTTP_SERVE_WAIT_REQUEST;
        }
@@ -172,7 +172,7 @@ class HttpServerSocket : public BufferedSocket
 
                this->Write(http_version + " "+ConvToStr(response)+" "+Response(response)+"\r\n");
 
-               time_t local = this->Instance->Time();
+               time_t local = this->ServerInstance->Time();
                struct tm *timeinfo = gmtime(&local);
                char *date = asctime(timeinfo);
                date[strlen(date) - 1] = '\0';
@@ -215,7 +215,7 @@ class HttpServerSocket : public BufferedSocket
 
                        if (reqbuffer.length() >= 8192)
                        {
-                               Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer");
+                               ServerInstance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer");
                                reqbuffer.clear();
                                return false;
                        }
@@ -321,11 +321,11 @@ class HttpServerSocket : public BufferedSocket
                        claimed = false;
                        HTTPRequest httpr(request_type,uri,&headers,this,this->GetIP(),postdata);
                        Event acl((char*)&httpr, (Module*)HttpModule, "httpd_acl");
-                       acl.Send(this->Instance);
+                       acl.Send(this->ServerInstance);
                        if (!claimed)
                        {
                                Event e((char*)&httpr, (Module*)HttpModule, "httpd_url");
-                               e.Send(this->Instance);
+                               e.Send(this->ServerInstance);
                                if (!claimed)
                                {
                                        SendHTTPError(404);
@@ -353,9 +353,12 @@ class HttpListener : public ListenSocketBase
                this->index = idx;
        }
 
-       virtual void OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip)
+       virtual void OnAcceptReady(int nfd)
        {
-               new HttpServerSocket(ServerInstance, nfd, (char *)incomingip.c_str(), index); // ugly cast courtesy of bufferedsocket
+               int port;
+               std::string incomingip;
+               irc::sockets::satoap(&client, incomingip, port);
+               new HttpServerSocket(ServerInstance, nfd, incomingip.c_str(), index);
        }
 };