summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src/steam_request.cpp')
-rw-r--r--protocols/Steam/src/steam_request.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/protocols/Steam/src/steam_request.cpp b/protocols/Steam/src/steam_request.cpp
index b4ddec0a65..5b23361c32 100644
--- a/protocols/Steam/src/steam_request.cpp
+++ b/protocols/Steam/src/steam_request.cpp
@@ -3,7 +3,7 @@
bool CSteamProto::SendRequest(HttpRequest *request)
{
NETLIBHTTPREQUEST *pResp = Netlib_HttpTransaction(m_hNetlibUser, request);
- HttpResponse response(request, pResp);
+ HttpResponse response(pResp);
delete request;
return response.IsSuccess();
}
@@ -11,7 +11,7 @@ bool CSteamProto::SendRequest(HttpRequest *request)
bool CSteamProto::SendRequest(HttpRequest *request, HttpCallback callback, void *param)
{
NETLIBHTTPREQUEST *pResp = Netlib_HttpTransaction(m_hNetlibUser, (NETLIBHTTPREQUEST*)request);
- HttpResponse response(request, pResp);
+ HttpResponse response(pResp);
if (callback)
(this->*callback)(response, param);
delete request;
@@ -21,11 +21,36 @@ bool CSteamProto::SendRequest(HttpRequest *request, HttpCallback callback, void
bool CSteamProto::SendRequest(HttpRequest *request, JsonCallback callback, void *param)
{
NETLIBHTTPREQUEST *pResp = Netlib_HttpTransaction(m_hNetlibUser, (NETLIBHTTPREQUEST*)request);
- HttpResponse response(request, pResp);
+ HttpResponse response(pResp);
if (callback) {
- JSONNode root = JSONNode::parse(response.Content);
+ JSONNode root = JSONNode::parse(response.data());
(this->*callback)(root, param);
}
delete request;
return response.IsSuccess();
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// HttpRequest
+
+HttpRequest::HttpRequest(int iRequestType, const char *szUrl)
+{
+ requestType = iRequestType;
+ timeout = 30000;
+ if (szUrl)
+ m_szUrl = szUrl;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// HttpResponse
+
+LIST<NETLIBHTTPHEADER> HttpResponse::Headers() const
+{
+ LIST<NETLIBHTTPHEADER> ret(10);
+
+ if (m_response)
+ for (int i = 0; i < m_response->headersCount; i++)
+ ret.insert(&m_response->headers[i]);
+
+ return ret;
+}