]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/httpclient.h
Argh, i give up
[user/henk/code/inspircd.git] / src / modules / httpclient.h
index c5e84261f770b30e54e5ff80cc0e743761113f29..ed258c6afbe55e10490e39bc9e37bb1cdbd8cf3c 100644 (file)
@@ -23,6 +23,7 @@ typedef std::map<std::string,std::string> HeaderMap;
 
 const char* HTTP_CLIENT_RESPONSE = "HTTPCLIENT_RESPONSE";
 const char* HTTP_CLIENT_REQUEST = "HTTPCLIENT_REQUEST";
+const char* HTTP_CLIENT_ERROR = "HTTPCLIENT_ERROR";
 
 /** This class represents an outgoing HTTP request
  */
@@ -67,6 +68,26 @@ class HTTPClientRequest : public Request
        }
 };
 
+class HTTPClientError : public Request
+{
+ protected:
+       friend class HTTPSocket;
+       std::string url;
+       int response;
+       std::string responsestr;
+       HeaderMap Headers;
+ public:
+       HTTPClientError(Module* src, Module* target, const std::string &url, int response)
+               : Request(src, target, HTTP_CLIENT_ERROR), url(url), response(response)
+       {
+       }
+
+       const std::string &GetURL()
+       {
+               return url;
+       }
+};
+
 class HTTPClientResponse : public Request
 {
  protected:
@@ -112,6 +133,12 @@ class HTTPClientResponse : public Request
                str = responsestr;
                return response;
        }
+
+       void SetResponse(const std::string &str)
+       {
+               responsestr = str;
+               response = atoi(responsestr.c_str());
+       }
        
        std::string GetHeader(const std::string &header)
        {