detect plain http server

This commit is contained in:
Christian Grothoff 2019-08-21 18:28:26 +02:00
parent 6a373d1e56
commit dbea8baaff
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -432,9 +432,32 @@ TALER_url_absolute_mhd (struct MHD_Connection *connection,
va_list args; va_list args;
char *result; char *result;
if (NULL != forwarded_proto)
proto = forwarded_proto;
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"); host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "Host");
forwarded_host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "X-Forwarded-Host"); forwarded_host = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "X-Forwarded-Host");