Commit d398b403 authored by Kyle J. McKay's avatar Kyle J. McKay

file.c: compute correct base URL when not absolute

When a server makes use of the PATH_INFO feature in a CGI,
the returned pages may often have a <base href="..." /> tag
specifying the URL of the CGI itself as the base.

However, to avoid hard-coding the scheme and host into such
a base href, the href value will often omit the scheme, host
and port.

Make sure that when parsing any such base href value that
any omitted components are taken from the current URL rather
than taken as being from a bare, absolute file:/// URL.
Signed-off-by: 's avatarKyle J. McKay <>
parent 1ac245bd
......@@ -5993,7 +5993,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
if (!buf->baseURL)
buf->baseURL = New(ParsedURL);
parseURL(p, buf->baseURL, NULL);
parseURL2(p, buf->baseURL, &buf->currentURL);
#if defined(USE_M17N) || defined(USE_IMAGE)
base = buf->baseURL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment