diff --git a/UI/remote-text.cpp b/UI/remote-text.cpp index 9c9cda3db..8e0cbb007 100644 --- a/UI/remote-text.cpp +++ b/UI/remote-text.cpp @@ -61,6 +61,9 @@ void RemoteTextThread::run() contentTypeString.c_str()); } + for (std::string &h : extraHeaders) + header = curl_slist_append(header, h.c_str()); + curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str()); curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, header); diff --git a/UI/remote-text.hpp b/UI/remote-text.hpp index e93734bde..d5663e1d3 100644 --- a/UI/remote-text.hpp +++ b/UI/remote-text.hpp @@ -28,6 +28,8 @@ class RemoteTextThread : public QThread { std::string contentType; std::string postData; + std::vector extraHeaders; + int timeoutSec = 0; void run() override; @@ -46,6 +48,19 @@ public: postData (postData_), timeoutSec (timeoutSec_) {} + + inline RemoteTextThread( + std::string url_, + std::vector &&extraHeaders_, + std::string contentType_ = std::string(), + std::string postData_ = std::string(), + int timeoutSec_ = 0) + : url (url_), + contentType (contentType_), + postData (postData_), + extraHeaders (std::move(extraHeaders_)), + timeoutSec (timeoutSec_) + {} }; bool GetRemoteFile(