summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 22:44:50 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 22:44:50 +0000
commit6aa31577af5f0605e9611287ace4703cbc90fbe2 (patch)
tree88454ae9f0e23c241c51c487e6018c166539d0ac /src
parentb9d5841f8f8660860e2f6d1669056be01960bfd7 (diff)
Dir for storing http stuff in.
Updates to make m_http not do sucky things. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4317 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_http.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/modules/m_http.cpp b/src/modules/m_http.cpp
index 9699b76a1..ef3d89520 100644
--- a/src/modules/m_http.cpp
+++ b/src/modules/m_http.cpp
@@ -49,7 +49,7 @@ class HttpSocket : public InspSocket
InternalState = HTTP_LISTEN;
}
- HttpSocket(int newfd, char* ip) : InspSocket(newfd, ip)
+ HttpSocket(int newfd, char* ip, FileReader* ind) : InspSocket(newfd, ip), index(ind)
{
InternalState = HTTP_SERVE_WAIT_REQUEST;
}
@@ -58,7 +58,7 @@ class HttpSocket : public InspSocket
{
if (InternalState == HTTP_LISTEN)
{
- HttpSocket* s = new HttpSocket(newsock, ip);
+ HttpSocket* s = new HttpSocket(newsock, ip, index);
Srv->AddSocket(s);
}
return true;
@@ -73,7 +73,8 @@ class HttpSocket : public InspSocket
struct tm *timeinfo = localtime(&TIME);
this->Write("HTTP/1.1 200 OK\r\nDate: ");
this->Write(asctime(timeinfo));
- this->Write("Server: InspIRCd/m_http.so/1.1\r\nContent-Length: "+ConvToStr(index->FileSize())+"\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n");
+ this->Write("Server: InspIRCd/m_http.so/1.1\r\nContent-Length: "+ConvToStr(index->ContentSize())+
+ "\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n");
}
virtual bool OnDataReady()
@@ -84,7 +85,7 @@ class HttpSocket : public InspSocket
{
headers << data;
- if (headers.str().find("\r\n\r\n"))
+ if (headers.str().find("\r\n\r\n") != std::string::npos)
{
/* Headers are complete */
InternalState = HTTP_SERVE_SEND_DATA;
@@ -92,14 +93,7 @@ class HttpSocket : public InspSocket
this->Write(index->Contents());
- /* This clever hax makes InspSocket think its
- * in a connecting state, and time out 2 seconds
- * from now. Most apache servers do this if the
- * client doesnt close the connection as its
- * supposed to.
- */
- this->timeout_end = TIME + 2;
- this->SetState(I_CONNECTING);
+ return false;
}
return true;
}