summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/http_request.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-02-21 19:37:00 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-02-21 19:37:00 +0000
commit9fbb540928c2584128bdd6361d60ee57f315a0f6 (patch)
treec4287ad64de116771179d5e240b8d4133caaac97 /plugins/Dropbox/src/http_request.h
parent84fb545f1ee85924b1c51971e0d69dcaa49f6fe0 (diff)
insignificant changes
git-svn-id: http://svn.miranda-ng.org/main/trunk@8203 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/http_request.h')
-rw-r--r--plugins/Dropbox/src/http_request.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h
index 43b1b311ec..81a6dcd99d 100644
--- a/plugins/Dropbox/src/http_request.h
+++ b/plugins/Dropbox/src/http_request.h
@@ -41,6 +41,48 @@ public:
headersCount++;
}
+ void AddBasicAuthHeader(LPCSTR szLogin, LPCSTR szPassword)
+ {
+ char cPair[128];
+ mir_snprintf(
+ cPair,
+ SIZEOF(cPair),
+ "%s:%s",
+ szLogin,
+ szPassword);
+
+ char *ePair = (char *)mir_base64_encode((BYTE*)cPair, strlen(cPair));
+
+ char value[128];
+ mir_snprintf(
+ value,
+ SIZEOF(value),
+ "Basic %s",
+ ePair);
+
+ mir_free(ePair);
+
+ headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount+1));
+ headers[headersCount].szName = mir_strdup("Authorization");
+ headers[headersCount].szValue = mir_strdup(value);
+ headersCount++;
+ }
+
+ void AddBearerAuthHeader(LPCSTR szValue)
+ {
+ char value[128];
+ mir_snprintf(
+ value,
+ SIZEOF(value),
+ "Bearer %s",
+ szValue);
+
+ headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount+1));
+ headers[headersCount].szName = mir_strdup("Authorization");
+ headers[headersCount].szValue = mir_strdup(value);
+ headersCount++;
+ }
+
void AddParameter(LPCSTR szName, LPCSTR szValue)
{
if (m_szUrl.Find('?') == -1)