File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -68,24 +68,21 @@ function HttpServer(options) {
6868
6969 var before = options . before ? options . before . slice ( ) : [ ] ;
7070
71- before . push ( function ( req , res ) {
72- if ( options . httpsPort ) {
71+ if ( options . httpsPort ) {
72+ before . push ( function ( req , res ) {
7373 var hostname = req . headers . host . match ( / : / g) ? req . headers . host . slice ( 0 , req . headers . host . indexOf ( ':' ) ) : req . headers . host ;
7474 var httpsUrl = 'https://' + hostname + ':' + options . httpsPort + req . url ;
7575 res . writeHead ( 301 , { Location : httpsUrl } ) ;
7676 res . end ( ) ;
77+ } ) ;
78+ }
7779
78- if ( options . logFn ) {
79- options . logFn ( req , res ) ;
80- }
81- return ;
82- }
83-
84- if ( options . logFn ) {
80+ if ( options . logFn ) {
81+ before . push ( function ( req , res ) {
8582 options . logFn ( req , res ) ;
8683 res . emit ( 'next' ) ;
87- }
88- } ) ;
84+ } ) ;
85+ }
8986
9087 if ( options . username || options . password ) {
9188 before . push ( function ( req , res ) {
You can’t perform that action at this time.
0 commit comments