X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fmodules%2Fm_httpd.cpp;h=3d47ed0427969e84364be7d6d3a0ddca145e2459;hb=6322067c9073a83ee7e9b12bc0c868a5507f1d87;hp=dc6a7f4185ab7b0074cb42825a9adcd5434e63f3;hpb=5a673b22fc50ccc9a47616c8ba8a7fab8faf1d51;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index dc6a7f418..3d47ed042 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -164,11 +164,12 @@ class HttpSocket : public InspSocket } } - void SendHeaders(unsigned long size, int response) + void SendHeaders(unsigned long size, int response, std::string &extraheaders) { struct tm *timeinfo = localtime(&TIME); this->Write("HTTP/1.1 "+ConvToStr(response)+" "+Response(response)+"\r\nDate: "); this->Write(asctime(timeinfo)); + this->Write(extraheaders); this->Write("Server: InspIRCd/m_httpd.so/1.1\r\nContent-Length: "+ConvToStr(size)+ "\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n"); } @@ -202,7 +203,7 @@ class HttpSocket : public InspSocket { if ((request_type == "GET") && (uri == "/")) { - SendHeaders(index->ContentSize(),200); + SendHeaders(index->ContentSize(), 200, ""); this->Write(index->Contents()); } else @@ -214,7 +215,7 @@ class HttpSocket : public InspSocket if (!claimed) { - SendHeaders(0, 404); + SendHeaders(0, 404, ""); log(DEBUG,"Page not claimed, 404"); } } @@ -233,10 +234,10 @@ class HttpSocket : public InspSocket } } - void Page(std::stringstream* n, int response) + void Page(std::stringstream* n, int response, std::string& extraheaders) { log(DEBUG,"Sending page"); - SendHeaders(n->str().length(),response); + SendHeaders(n->str().length(), response, extraheaders); this->Write(n->str()); } }; @@ -291,7 +292,7 @@ class ModuleHttp : public Module claimed = true; HTTPDocument* doc = (HTTPDocument*)request->GetData(); HttpSocket* sock = (HttpSocket*)doc->sock; - sock->Page(doc->GetDocument(), doc->GetResponseCode()); + sock->Page(doc->GetDocument(), doc->GetResponseCode(), doc->GetExtraHeaders()); return NULL; }