File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -100,10 +100,13 @@ function Server (opts) {
100100 self . http . on ( 'error' , function ( err ) { self . _onError ( err ) } )
101101 self . http . on ( 'listening' , onListening )
102102
103- // Add default http request handler if user does not add one on same tick
103+ // Add default http request handler on next tick to give user the chance to add
104+ // their own handler first. Handle requests untouched by user's handler.
104105 process . nextTick ( function ( ) {
105- if ( self . http . listenerCount ( 'request' ) > 0 ) return
106106 self . http . on ( 'request' , function ( req , res ) {
107+ if ( res . headersSent ) return
108+ // For websocket trackers, we only need to handle the UPGRADE http method.
109+ // Return 404 for all other request types.
107110 res . statusCode = 404
108111 res . end ( '404 Not Found' )
109112 } )
You can’t perform that action at this time.
0 commit comments