shithub: riscv

Download patch

ref: 78c7cd0c010c1c90dbc3358c2710bddaed379ce9
parent: 341b64b5bd0af48ec4bb7b11a54c953c52b22d03
author: Alex Musolino <[email protected]>
date: Wed Jun 5 12:04:50 EDT 2019

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.

--- a/rc/bin/rc-httpd/handlers/dir-index
+++ b/rc/bin/rc-httpd/handlers/dir-index
@@ -10,7 +10,6 @@
 	error 503
 	exit
 }
-do_log 200
 builtin cd $full_path
 if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
 	ifile=index.htm*
@@ -30,6 +29,7 @@
 case date
 	lso=-t
 }
+do_log 200
 echo 'HTTP/1.1 200 OK'^$cr
 emit_extra_headers
 echo 'Content-type: text/html'^$cr