summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authortastytea2020-01-09 11:23:15 +0100
committertastytea2020-01-09 11:23:15 +0100
commite4a5b8e9cea7016cf188372e8f04ae0cafe33d1e (patch)
treeddd3819845a7b5c6c474f27d81e04a302ab962e4 /include
parent8482f51aff11ec550fbd3d21fd96663d08f19fbe (diff)
downloadmastodonpp-e4a5b8e9cea7016cf188372e8f04ae0cafe33d1e.tar
mastodonpp-e4a5b8e9cea7016cf188372e8f04ae0cafe33d1e.tar.gz
mastodonpp-e4a5b8e9cea7016cf188372e8f04ae0cafe33d1e.zip
Move set_proxy() to Instance.
Diffstat (limited to 'include')
-rw-r--r--include/connection.hpp7
-rw-r--r--include/instance.hpp24
2 files changed, 24 insertions, 7 deletions
diff --git a/include/connection.hpp b/include/connection.hpp
index e2735b8..b32acea 100644
--- a/include/connection.hpp
+++ b/include/connection.hpp
@@ -99,13 +99,6 @@ public:
return get(endpoint, {});
}
- /*! @copydoc CURLWrapper::set_proxy(string_view)
- *
- * Sets also the proxy for the Instance you used to initialize this
- * Connection.
- */
- void set_proxy(string_view proxy);
-
/*!
* @brief Copy new stream contents and delete the “original”.
*
diff --git a/include/instance.hpp b/include/instance.hpp
index 28f8f27..5af177c 100644
--- a/include/instance.hpp
+++ b/include/instance.hpp
@@ -95,11 +95,35 @@ public:
[[nodiscard]]
uint64_t get_max_chars();
+ /*! @copydoc CURLWrapper::set_proxy(string_view)
+ *
+ * Sets also the proxy for all Connection%s that are initialized with this
+ * Instance afterwards.
+ */
+ void set_proxy(const string_view proxy)
+ {
+ _proxy = proxy;
+ CURLWrapper::set_proxy(proxy);
+ }
+
+ /*!
+ * @brief Returns the proxy string that was previously set.
+ *
+ * Does not return the proxy if it was set from an environment variable.
+ *
+ * @since 0.1.0
+ */
+ string_view get_proxy() const
+ {
+ return _proxy;
+ }
+
private:
const string _hostname;
const string _baseuri;
string _access_token;
uint64_t _max_chars;
+ string _proxy;
};
} // namespace mastodonpp