]> git.lizzy.rs Git - plan9front.git/commitdiff
rc-httpd(8): avoid duplicate log output in dir-index handler
authorAlex Musolino <alex@musolino.id.au>
Wed, 5 Jun 2019 06:34:50 +0000 (16:04 +0930)
committerAlex Musolino <alex@musolino.id.au>
Wed, 5 Jun 2019 06:34:50 +0000 (16:04 +0930)
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.

rc/bin/rc-httpd/handlers/dir-index

index 31e5b02362fd1a045dd2da997f316f469a752376..8abf6f8facd5501abf87c18fdbdd6479c204a765 100755 (executable)
@@ -10,7 +10,6 @@ if(! test -r $full_path -x $full_path){
        error 503
        exit
 }
-do_log 200
 builtin cd $full_path
 if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
        ifile=index.htm*
@@ -30,6 +29,7 @@ case size
 case date
        lso=-t
 }
+do_log 200
 echo 'HTTP/1.1 200 OK'^$cr
 emit_extra_headers
 echo 'Content-type: text/html'^$cr