aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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");