summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/http_request.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-03-22 21:07:19 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-03-22 21:07:19 +0000
commitd2a83c7d22df33abd1678756fd4caba432700860 (patch)
treee1e2dc51a300c3af8fb9877f97a34db094ea2653 /protocols/SkypeWeb/src/http_request.h
parenta9edb12c2cc13a74f16c0a61deaeaa8780f13f4e (diff)
SkypeWeb:
- refactored HttpRequest 2 - status changing support (patch from MikalaiR) git-svn-id: http://svn.miranda-ng.org/main/trunk@12478 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/http_request.h')
-rw-r--r--protocols/SkypeWeb/src/http_request.h81
1 files changed, 75 insertions, 6 deletions
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h
index 28b34c075d..5d34d04e3f 100644
--- a/protocols/SkypeWeb/src/http_request.h
+++ b/protocols/SkypeWeb/src/http_request.h
@@ -171,19 +171,14 @@ protected:
HttpRequest() : Headers(*this)
{
cbSize = sizeof(NETLIBHTTPREQUEST);
+ flags = NLHRF_HTTP11 | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
}
HttpRequest(int httpMethod, LPCSTR urlFormat, va_list args)
: Headers(*this)
{
- this->HttpRequest::HttpRequest();
-
requestType = httpMethod;
- flags = NLHRF_HTTP11 | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
-
Url.content.AppendFormatV(urlFormat, args);
- if (Url.content.Find("://") == -1)
- Url.content.Insert(0, flags & NLHRF_SSL ? "https://" : "http://");
}
public:
@@ -213,6 +208,8 @@ public:
NETLIBHTTPREQUEST * Send(HANDLE hConnection)
{
+ if (Url.content.Find("://") == -1)
+ Url.content.Insert(0, flags & NLHRF_SSL ? "https://" : "http://");
szUrl = Url.ToString();
pData = Body.ToString();
@@ -226,4 +223,76 @@ public:
}
};
+class HttpGetRequest : public HttpRequest
+{
+public:
+ HttpGetRequest(LPCSTR urlFormat, ...)
+ {
+ va_list args;
+ va_start(args, urlFormat);
+ this->HttpRequest::HttpRequest(REQUEST_GET, urlFormat, args);
+ va_end(args);
+ }
+};
+
+class HttpPostRequest : public HttpRequest
+{
+public:
+ HttpPostRequest(LPCSTR urlFormat, ...)
+ {
+ va_list args;
+ va_start(args, urlFormat);
+ this->HttpRequest::HttpRequest(REQUEST_POST, urlFormat, args);
+ va_end(args);
+
+ Headers << CHAR_VALUE("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+ }
+};
+
+class HttpsRequest : public HttpRequest
+{
+protected:
+ HttpsRequest() : HttpRequest()
+ {
+ flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
+ }
+
+public:
+ HttpsRequest(int type, LPCSTR urlFormat, ...)
+ {
+ va_list args;
+ va_start(args, urlFormat);
+ this->HttpRequest::HttpRequest(type, urlFormat, args);
+ va_end(args);
+
+ flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
+ }
+};
+
+class HttpsGetRequest : public HttpsRequest
+{
+public:
+ HttpsGetRequest(LPCSTR urlFormat, ...)
+ {
+ va_list args;
+ va_start(args, urlFormat);
+ this->HttpRequest::HttpRequest(REQUEST_GET, urlFormat, args);
+ va_end(args);
+ }
+};
+
+class HttpsPostRequest : public HttpsRequest
+{
+public:
+ HttpsPostRequest(LPCSTR urlFormat, ...)
+ {
+ va_list args;
+ va_start(args, urlFormat);
+ this->HttpsRequest::HttpsRequest(REQUEST_POST, urlFormat, args);
+ va_end(args);
+
+ Headers << CHAR_VALUE("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
+ }
+};
+
#endif //_HTTP_REQUEST_H_ \ No newline at end of file