summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/http_request.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-26 17:49:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-26 17:49:34 +0300
commit0bbad6b41fa7e5530d996194873e424962a54bac (patch)
treedaf0179865bb07a4ae0ba1723e7ec2cf43f69474 /protocols/Steam/src/http_request.h
parent5ebba85de37a0aaaa0732fe6307fcf8de9010fea (diff)
Steam:
- final fix for UI dialogs; - major fix for CSteamProto::SetStatus method, not to launch the worker thread in parallel; - code cleaning; - version bump
Diffstat (limited to 'protocols/Steam/src/http_request.h')
-rw-r--r--protocols/Steam/src/http_request.h102
1 files changed, 51 insertions, 51 deletions
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index b7c715ea92..ffc46d8625 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -277,57 +277,7 @@ enum HttpMethod
HttpPost
};
-class HttpResponse
-{
- friend class HttpRequest;
-
-private:
- NETLIBHTTPREQUEST *m_response;
-
-public:
- HttpRequest *Request;
- HttpHeaders Headers;
- HttpContent Content;
-
- HttpResponse(HttpRequest *request, NETLIBHTTPREQUEST *response) :
- Request(request),
- m_response(response),
- Headers(response),
- Content(response)
- {
- }
-
- ~HttpResponse()
- {
- Netlib_FreeHttpRequest(m_response);
- }
-
- bool operator!() const
- {
- return !m_response || !m_response->pData;
- }
-
- operator bool() const
- {
- return m_response && m_response->pData;
- }
-
- bool IsSuccess() const
- {
- return m_response &&
- m_response->resultCode >= HTTP_CODE_OK &&
- m_response->resultCode <= HTTP_CODE_MULTI_STATUS;
- }
-
- int GetStatusCode() const
- {
- return m_response
- ? m_response->resultCode
- : 0;
- }
-};
-
-class HttpRequest : protected NETLIBHTTPREQUEST, public MZeroedObject
+class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject
{
friend class HttpUri;
friend class HttpHeaders;
@@ -382,4 +332,54 @@ public:
}
};
+class HttpResponse
+{
+ friend class HttpRequest;
+
+private:
+ NETLIBHTTPREQUEST *m_response;
+
+public:
+ HttpRequest *Request;
+ HttpHeaders Headers;
+ HttpContent Content;
+
+ HttpResponse(HttpRequest *request, NETLIBHTTPREQUEST *response) :
+ Request(request),
+ m_response(response),
+ Headers(response),
+ Content(response)
+ {
+ }
+
+ ~HttpResponse()
+ {
+ Netlib_FreeHttpRequest(m_response);
+ }
+
+ bool operator!() const
+ {
+ return !m_response || !m_response->pData;
+ }
+
+ operator bool() const
+ {
+ return m_response && m_response->pData;
+ }
+
+ bool IsSuccess() const
+ {
+ return m_response &&
+ m_response->resultCode >= HTTP_CODE_OK &&
+ m_response->resultCode <= HTTP_CODE_MULTI_STATUS;
+ }
+
+ int GetStatusCode() const
+ {
+ if (m_response)
+ return m_response->resultCode;
+ return Request ? Request->resultCode : 0;
+ }
+};
+
#endif //_HTTP_REQUEST_H_ \ No newline at end of file