aboutsummaryrefslogtreecommitdiff
path: root/cpu-miner.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-03-24 14:09:49 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-03-24 14:09:49 -0400
commit69529c38594f7bd56b50b9effed5a45125ccba3e (patch)
tree9d6f786ebb89f16385dd68216329ca7267b25652 /cpu-miner.c
parent991a358dc9d5935a7cca96e68156e0aa595056b4 (diff)
Support full URL, in X-Long-Polling header
Diffstat (limited to 'cpu-miner.c')
-rw-r--r--cpu-miner.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/cpu-miner.c b/cpu-miner.c
index 7c941fd..369e966 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -635,15 +635,25 @@ static void *longpoll_thread(void *userdata)
hdr_path = tq_pop(mythr->q, NULL);
if (!hdr_path)
goto out;
- copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path;
- if (rpc_url[strlen(rpc_url) - 1] != '/')
- need_slash = true;
- lp_url = malloc(strlen(rpc_url) + strlen(copy_start) + 2);
- if (!lp_url)
- goto out;
+ /* full URL */
+ if (strstr(hdr_path, "://")) {
+ lp_url = hdr_path;
+ hdr_path = NULL;
+ }
+
+ /* absolute path, on current server */
+ else {
+ copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path;
+ if (rpc_url[strlen(rpc_url) - 1] != '/')
+ need_slash = true;
+
+ lp_url = malloc(strlen(rpc_url) + strlen(copy_start) + 2);
+ if (!lp_url)
+ goto out;
- sprintf(lp_url, "%s%s%s", rpc_url, need_slash ? "/" : "", copy_start);
+ sprintf(lp_url, "%s%s%s", rpc_url, need_slash ? "/" : "", copy_start);
+ }
applog(LOG_INFO, "Long-polling activated for %s", lp_url);