diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-07 17:16:30 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-07 17:16:30 +0000 |
commit | 34f4ee851c1822696612dadd4a46194f9ed28987 (patch) | |
tree | effb1d9c11522e558c7266f51454eccb1c07c7e5 /src/modules/m_http_client.cpp | |
parent | bc341bfc390154919652271047cbea9b4a14426b (diff) |
Make this use the newer format of class Request (this module was still using the old cast-data-to-char*-and-use-getdata-method)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6245 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_http_client.cpp')
-rw-r--r-- | src/modules/m_http_client.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index 962ecfc17..9004b202b 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -98,21 +98,18 @@ class ModuleHTTPClient : public Module { List[I_OnRequest] = 1; } - - char *OnRequest(Request *req) + + char* OnRequest(Request *req) { - HTTPClientRequest *httpreq = (HTTPClientRequest *) req->GetData(); - HTTPSocket *sock = new HTTPSocket(ServerInstance, this); - sock->DoRequest(httpreq); - // No return value + HTTPClientRequest *httpreq = (HTTPClientRequest *)req; + if (!strcmp(httpreq->GetId(), HTTP_CLIENT_REQUEST)) + { + HTTPSocket *sock = new HTTPSocket(ServerInstance, this); + sock->DoRequest(httpreq); + // No return value + } return NULL; } - - void SendReply(Module *to, HTTPClientResponse *data) - { - Request req((char *) data, this, to); - req.Send(); - } }; HTTPSocket::HTTPSocket(InspIRCd *Instance, ModuleHTTPClient *Mod) @@ -283,7 +280,7 @@ bool HTTPSocket::OnDataReady() { // HTTP reply (HTTP/1.1 200 msg) data += 9; - response = new HTTPClientResponse(url.url, atoi(data), data + 4); + response = new HTTPClientResponse((Module*)Mod, req->GetSource() , url.url, atoi(data), data + 4); this->status = HTTP_HEADERS; continue; } @@ -314,7 +311,8 @@ void HTTPSocket::OnClose() } Server->Log(DEBUG, "Got file from HTTP successfully"); response->data = data; - Mod->SendReply(req->GetSrc(), response); + response->Send(); + delete response; } class ModuleHTTPClientFactory : public ModuleFactory |