Allow tunnelling Stratum through an HTTP proxy

This commit is contained in:
pooler 2014-04-15 19:59:17 +02:00
parent 9aa776cf94
commit 94fd77f3f5
2 changed files with 4 additions and 11 deletions

View file

@ -169,7 +169,6 @@ Supported schemes are: \fBhttp\fR, \fBsocks4\fR, \fBsocks5\fR.
Since libcurl 7.18.0, the following are also supported:
\fBsocks4a\fR, \fBsocks5h\fR (SOCKS5 with remote name resolving).
If no scheme is specified, the proxy is treated as an HTTP proxy.
HTTP proxies cannot be used to connect to Stratum servers.
.SH ENVIRONMENT
The following environment variables can be specified in lower case or upper case;
the lower-case version has precedence. \fBhttp_proxy\fR is an exception

14
util.c
View file

@ -379,8 +379,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
/* If X-Stratum was found, activate Stratum */
if (want_stratum && hi.stratum_url &&
!strncasecmp(hi.stratum_url, "stratum+tcp://", 14) &&
!(opt_proxy && opt_proxy_type == CURLPROXY_HTTP)) {
!strncasecmp(hi.stratum_url, "stratum+tcp://", 14)) {
have_stratum = true;
tq_push(thr_info[stratum_thr_id].q, hi.stratum_url);
hi.stratum_url = NULL;
@ -764,16 +763,11 @@ bool stratum_connect(struct stratum_ctx *sctx, const char *url)
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, sctx->curl_err_str);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
if (opt_proxy && opt_proxy_type != CURLPROXY_HTTP) {
if (opt_proxy) {
curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy);
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type);
} else if (getenv("http_proxy")) {
if (getenv("all_proxy"))
curl_easy_setopt(curl, CURLOPT_PROXY, getenv("all_proxy"));
else if (getenv("ALL_PROXY"))
curl_easy_setopt(curl, CURLOPT_PROXY, getenv("ALL_PROXY"));
else
curl_easy_setopt(curl, CURLOPT_PROXY, "");
if (opt_proxy_type == CURLPROXY_HTTP)
curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1);
}
#if LIBCURL_VERSION_NUM >= 0x070f06
curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb);