source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Kristaps points out that the current HTTP/1.1 draft standard
@ 2014-07-21 15:45 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-07-21 15:45 UTC (permalink / raw)
  To: source

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 "<H2>\nManual pages with " \
 	"<A HREF=\"http://mdocml.bsd.lv/\">mandoc</A>\n</H2>"
-#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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-21 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 15:45 mdocml: Kristaps points out that the current HTTP/1.1 draft standard schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).