From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s6LFjHfo029021 for ; Mon, 21 Jul 2014 11:45:18 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s6LFjHkp006188; Mon, 21 Jul 2014 11:45:17 -0400 (EDT) Date: Mon, 21 Jul 2014 11:45:17 -0400 (EDT) Message-Id: <201407211545.s6LFjHkp006188@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Kristaps points out that the current HTTP/1.1 draft standard X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Kristaps points out that the current HTTP/1.1 draft standard (RFC 2616) requires the Location: response-header field to be an absolute URI (14.30), and only the most recent proposed standard (RFC 7231), which is barely a month old, allows a relative Location: (7.1.2). While most modern browsers appear to support relative Location: headers, some may not, and it's maybe a bit early to rely on relative Location: headers. I'm not going back to the HTTP_HOST or SERVER_NAME CGI variables, though. While some CGI programs certainly require those, in which case both the CGI programmer and the web server admin have to be very careful to keep the system secure and reliable, man.cgi(8) does not really need them. We always know at compile time which domain we are running for, and for man.cgi(8), security and reliability are definitely much more important than flexibility. So make HTTP_HOST a compile-time definition for now. Modified Files: -------------- mdocml: cgi.c cgi.h.example man.cgi.8 Revision Data ------------- Index: man.cgi.8 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.cgi.8,v retrieving revision 1.7 retrieving revision 1.8 diff -Lman.cgi.8 -Lman.cgi.8 -u -p -r1.7 -r1.8 --- man.cgi.8 +++ man.cgi.8 @@ -189,6 +189,11 @@ element. An ASCII string to be used for the HTML .Aq TITLE element. +.It Ev HTTP_HOST +The FQDN of the (possibly virtual) host the HTTP server is running on. +This is used for +.Ic Location: +headers in HTTP 303 responses. .It Ev MAN_DIR A path to the .Nm Index: cgi.h.example =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.h.example,v retrieving revision 1.2 retrieving revision 1.3 diff -Lcgi.h.example -Lcgi.h.example -u -p -r1.2 -r1.3 --- cgi.h.example +++ cgi.h.example @@ -1,8 +1,9 @@ /* Example compile-time configuration file for man.cgi(8). */ +#define HTTP_HOST "mdocml.bsd.lv" #define MAN_DIR "/var/www/man" #define CSS_DIR "" #define CUSTOMIZE_TITLE "Manual pages with mandoc" #define CUSTOMIZE_BEGIN "

\nManual pages with " \ "mandoc\n

" -#define COMPAT_OLDURI Yes +#define COMPAT_OLDURI Yes Index: cgi.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v retrieving revision 1.77 retrieving revision 1.78 diff -Lcgi.c -Lcgi.c -u -p -r1.77 -r1.78 --- cgi.c +++ cgi.c @@ -564,8 +564,8 @@ pg_searchres(const struct req *req, stru * without any delay. */ printf("Status: 303 See Other\r\n"); - printf("Location: %s/%s/%s?", - scriptname, req->q.manpath, r[0].file); + printf("Location: http://%s%s/%s/%s?", + HTTP_HOST, scriptname, req->q.manpath, r[0].file); http_printquery(req); printf("\r\n" "Content-Type: text/html; charset=utf-8\r\n" -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv