Skip to content

Commit 9635a76

Browse files
committed
Merge branch 'ohmyarch-oauth1_proxy' into development
2 parents de8671b + 1b190fc commit 9635a76

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Release/include/cpprest/oauth1.h

100644100755
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define _CASA_OAUTH1_H
2929

3030
#include "cpprest/http_msg.h"
31+
#include "cpprest/details/web_utilities.h"
3132

3233
namespace web
3334
{
@@ -479,6 +480,24 @@ class oauth1_config
479480
/// </summary>
480481
void clear_parameters() { m_parameters_to_sign.clear(); }
481482

483+
/// <summary>
484+
/// Get the web proxy object
485+
/// </summary>
486+
/// <returns>A reference to the web proxy object.</returns>
487+
const web_proxy& proxy() const
488+
{
489+
return m_proxy;
490+
}
491+
492+
/// <summary>
493+
/// Set the web proxy object that will be used by token_from_code and token_from_refresh
494+
/// </summary>
495+
/// <param name="proxy">A reference to the web proxy object.</param>
496+
void set_proxy(const web_proxy& proxy)
497+
{
498+
m_proxy = proxy;
499+
}
500+
482501
private:
483502
friend class web::http::client::http_client_config;
484503
friend class web::http::oauth1::details::oauth1_handler;
@@ -532,6 +551,8 @@ class oauth1_config
532551

533552
std::map<utility::string_t, utility::string_t> m_parameters_to_sign;
534553

554+
web::web_proxy m_proxy;
555+
535556
utility::nonce_generator m_nonce_generator;
536557
bool m_is_authorization_completed;
537558
};

Release/src/http/oauth/oauth1.cpp

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
using namespace utility;
3131
using web::http::client::http_client;
32+
using web::http::client::http_client_config;
3233
using web::http::oauth1::details::oauth1_state;
3334
using web::http::oauth1::details::oauth1_strings;
3435

@@ -281,7 +282,13 @@ pplx::task<void> oauth1_config::_request_token(oauth1_state state, bool is_temp_
281282
req._set_base_uri(endpoint);
282283

283284
_authenticate_request(req, std::move(state));
284-
http_client client(endpoint);
285+
286+
// configure proxy
287+
http_client_config config;
288+
config.set_proxy(m_proxy);
289+
290+
http_client client(endpoint, config);
291+
285292
return client.request(req)
286293
.then([](http_response resp)
287294
{

0 commit comments

Comments
 (0)