changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: rc-httpd(8): avoid duplicate log output in dir-index handler

changeset 7262: f0621f169310
parent 7261: 5151baad508e
child 7263: b703b47e2940
child 7268: cbd1f567e273
author: Alex Musolino <alex@musolino.id.au>
date: Wed, 05 Jun 2019 16:04:50 +0930
files: rc/bin/rc-httpd/handlers/dir-index
description: rc-httpd(8): avoid duplicate log output in dir-index handler

Delay calling do_log until just before emitting the response. This avoids
calling do_log before potentially handing control to the static-index
handler, which also calls do_log.
     1.1--- a/rc/bin/rc-httpd/handlers/dir-index
     1.2+++ b/rc/bin/rc-httpd/handlers/dir-index
     1.3@@ -10,7 +10,6 @@ if(! test -r $full_path -x $full_path){
     1.4 	error 503
     1.5 	exit
     1.6 }
     1.7-do_log 200
     1.8 builtin cd $full_path
     1.9 if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
    1.10 	ifile=index.htm*
    1.11@@ -30,6 +29,7 @@ case size
    1.12 case date
    1.13 	lso=-t
    1.14 }
    1.15+do_log 200
    1.16 echo 'HTTP/1.1 200 OK'^$cr
    1.17 emit_extra_headers
    1.18 echo 'Content-type: text/html'^$cr