diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-03-08 21:19:21 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-03-08 22:41:03 +0000 |
commit | c3d93684368c82c0d7f969997264c121cbaafabd (patch) | |
tree | 85b37e5b9f82ac70b660857b0828fdf4f9cca685 /service/apiImpl.cpp | |
parent | Split the builds into the usual domain, api and service components (diff) | |
download | mirrorsearch-c3d93684368c82c0d7f969997264c121cbaafabd.tar.bz2 mirrorsearch-c3d93684368c82c0d7f969997264c121cbaafabd.tar.xz mirrorsearch-c3d93684368c82c0d7f969997264c121cbaafabd.zip |
Allow configuring referrer and useragent, also set a collection of other handy headers
Diffstat (limited to 'service/apiImpl.cpp')
-rw-r--r-- | service/apiImpl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/service/apiImpl.cpp b/service/apiImpl.cpp index ab86d98..9795769 100644 --- a/service/apiImpl.cpp +++ b/service/apiImpl.cpp @@ -86,6 +86,17 @@ namespace MirrorSearch { return size; }; CESSO(curl, CURLOPT_WRITEDATA, &cb); + if (ss->referrer) { + CESSO(curl, CURLOPT_REFERER, ss->referrer->c_str()); + } + if (ss->useragent) { + CESSO(curl, CURLOPT_USERAGENT, ss->useragent->c_str()); + } + CESSO(curl, CURLOPT_TIMEOUT, 5L); + // Enables compression + CESSO(curl, CURLOPT_ACCEPT_ENCODING, ""); + CESSO(curl, CURLOPT_HTTP_CONTENT_DECODING, 1L); + CESSO(curl, CURLOPT_TCP_FASTOPEN, 1L); if (curl_easy_perform(curl.get()) != CURLE_OK) { curlErrorHandler<Read>(failingFunction((void*)&curl_easy_perform), errbuf, url); } |