X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/5aff007d8fcfb4c6cc3c3627ae15f45562db7a0d..b0b15b7ced28b3c6ddfcd4b0a7e46ee6432a243c:/lib/url.c diff --git a/lib/url.c b/lib/url.c index 6d19911..b777282 100644 --- a/lib/url.c +++ b/lib/url.c @@ -21,13 +21,9 @@ * @brief URL support functions */ -#include -#include "types.h" +#include "common.h" -#include -#include #include -#include #include "mem.h" #include "log.h" @@ -44,6 +40,10 @@ char *infer_url(void) { const char *scheme = "http", *server, *script, *e, *request_uri; char *url; int port; + + /* mod_ssl sets HTTPS=on if the scheme is https */ + if((e = getenv("HTTPS")) && !strcmp(e, "on")) + scheme = "https"; /* Figure out the server. 'MUST' be set and we don't cope if it * is not. */