summaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-08-21 18:28:26 +0200
committerChristian Grothoff <christian@grothoff.org>2019-08-21 18:28:26 +0200
commitdbea8baaff1c84a8bb833fa5e1a4c9d0fb6a4c91 (patch)
tree33e2366daa74427574c4bb9b766df840450cea45 /src/util/util.c
parent6a373d1e568ad6b5f15c68f94223e9b488044be1 (diff)
downloadexchange-dbea8baaff1c84a8bb833fa5e1a4c9d0fb6a4c91.tar.gz
exchange-dbea8baaff1c84a8bb833fa5e1a4c9d0fb6a4c91.tar.bz2
exchange-dbea8baaff1c84a8bb833fa5e1a4c9d0fb6a4c91.zip
detect plain http server
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 51726290f..eea4c91aa 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -431,10 +431,33 @@ TALER_url_absolute_mhd (struct MHD_Connection *connection,
const char *prefix;
va_list args;
char *result;
-
+
+
if (NULL != forwarded_proto)
+ {
proto = forwarded_proto;
+ }
+ else
+ {
+ /* likely not reverse proxy, figure out if we are
+ http by asking MHD */
+ const union MHD_ConnectionInfo *ci;
+ ci = MHD_get_connection_info (connection,
+ MHD_CONNECTION_INFO_DAEMON);
+ if (NULL != ci)
+ {
+ const union MHD_DaemonInfo *di;
+
+ di = MHD_get_daemon_info (ci->daemon,
+ MHD_DAEMON_INFO_FLAGS);
+ if (NULL != di)
+ {
+ if (0 == (di->flags & MHD_USE_TLS))
+ proto = "http";
+ }
+ }
+ }
host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "Host");
forwarded_host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "X-Forwarded-Host");