Skip to content

Commit

Permalink
Allow tunnelling Stratum through an HTTP proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
pooler committed Apr 15, 2014
1 parent 9aa776c commit 94fd77f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion minerd.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 94fd77f

Please sign in to comment.