From d76c1cbd829ae2063e505dcd80c2f1b85d88d639 Mon Sep 17 00:00:00 2001 From: knarf Date: Fri, 19 Jun 2009 16:53:43 +0000 Subject: look at env(HOSTPORT) and announce this if it is there git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@240 1faa4e14-9dd3-4be0-9f0e-ffe519881164 --- src/Sockets.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Sockets.c b/src/Sockets.c index db66102..9974b1e 100644 --- a/src/Sockets.c +++ b/src/Sockets.c @@ -166,7 +166,11 @@ int HTTP_SetupServer(int port, int queue_size, int hunt) /* We do not want 'hostname' here because that can be wrong and not be overwritten */ char *myhostname = getenv("HOSTNAME"); if (!myhostname) myhostname = hostname; - snprintf(msg, 140, "HTTPD by %s on http://%s:%lu/\n", this_user, myhostname, httpport); + /* If there is an environment variable HOSTPORT, announce this instead (for ssh forwarding) */ + if (getenv("HOSTPORT")) + snprintf(msg, 140, "HTTPD by %s on http://%s:%s/\n", this_user, myhostname, getenv("HOSTPORT")); + else + snprintf(msg, 140, "HTTPD by %s on http://%s:%lu/\n", this_user, myhostname, httpport); Send_Twitter_Msg(msg); } else printf("Not announcing location via Twitter.\n"); -- cgit v1.2.3