aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2009-06-19 16:53:43 +0000
committerknarf <knarf@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2009-06-19 16:53:43 +0000
commitd76c1cbd829ae2063e505dcd80c2f1b85d88d639 (patch)
treeabcb4a48e005b69f25080d55ed206c0fd0247615
parent81898e66fa3c74033aab6cb84e4455ed862edc39 (diff)
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
-rw-r--r--src/Sockets.c6
1 files changed, 5 insertions, 1 deletions
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");