summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-09 00:34:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-09 00:34:33 +0100
commitbefe35f2765b654c42fdbdab292aaf26e1dc7b0b (patch)
treec13718571f5cc4ac094ab0697175cea61d8c787e
parentRefactor to support using VariableCurlHelper to inject its properties into an... (diff)
downloadproject2-befe35f2765b654c42fdbdab292aaf26e1dc7b0b.tar.bz2
project2-befe35f2765b654c42fdbdab292aaf26e1dc7b0b.tar.xz
project2-befe35f2765b654c42fdbdab292aaf26e1dc7b0b.zip
Remove unnecessary wrappers, adhocutil provides suitable ones
-rw-r--r--project2/url/curlHelper.cpp24
-rw-r--r--project2/url/curlHelper.h3
2 files changed, 6 insertions, 21 deletions
diff --git a/project2/url/curlHelper.cpp b/project2/url/curlHelper.cpp
index a4ca4d7..d6ca64b 100644
--- a/project2/url/curlHelper.cpp
+++ b/project2/url/curlHelper.cpp
@@ -63,12 +63,12 @@ void
VariableCurlHelper::setCurlOpts(AdHoc::Net::CurlHandle * c, ExecContext * ec) const
{
CurlHelper::setCurlOpts(c, ec);
- setopt_s(c, CURLOPT_USERAGENT, userAgent(ec));
- setopt_s(c, CURLOPT_PROXY, proxy(ec));
- setopt_s(c, CURLOPT_REFERER, referer(ec));
- setopt_s(c, CURLOPT_COOKIEFILE, cookieJar(ec));
- setopt_s(c, CURLOPT_COOKIEJAR, cookieJar(ec));
- setopt_l(c, CURLOPT_TIMEOUT_MS, timeout(ec));
+ c->setopt<const char *>(CURLOPT_USERAGENT, userAgent(ec));
+ c->setopt<const char *>(CURLOPT_PROXY, proxy(ec));
+ c->setopt<const char *>(CURLOPT_REFERER, referer(ec));
+ c->setopt<const char *>(CURLOPT_COOKIEFILE, cookieJar(ec));
+ c->setopt<const char *>(CURLOPT_COOKIEJAR, cookieJar(ec));
+ c->setopt<long>(CURLOPT_TIMEOUT_MS, timeout(ec));
}
void
@@ -99,18 +99,6 @@ Curl::setSendHandler(const SendHandler & h)
setopt(CURLOPT_READFUNCTION, &curlSendHelperHandle);
}
-void
-VariableCurlHelper::setopt_s(AdHoc::Net::CurlHandle * c, CURLoption o, const char * v)
-{
- c->setopt(o, v);
-}
-
-void
-VariableCurlHelper::setopt_l(AdHoc::Net::CurlHandle * c, CURLoption o, int64_t v)
-{
- c->setopt(o, (long)v);
-}
-
std::string
VariableCurlHelper::getUrl(ExecContext * ec) const
{
diff --git a/project2/url/curlHelper.h b/project2/url/curlHelper.h
index 95b24a6..ad73a31 100644
--- a/project2/url/curlHelper.h
+++ b/project2/url/curlHelper.h
@@ -49,9 +49,6 @@ class VariableCurlHelper : public CurlHelper {
virtual std::string getUrl(ExecContext *) const override;
private:
- static void setopt_s(AdHoc::Net::CurlHandle *, CURLoption, const char *);
- static void setopt_l(AdHoc::Net::CurlHandle *, CURLoption, int64_t);
-
const Variable userAgent;
const Variable cookieJar;
const Variable proxy;