@@ -59,7 +59,7 @@ const {
5959 kIncomingMessage,
6060 _checkIsHttpToken : checkIsHttpToken ,
6161} = require ( '_http_common' ) ;
62- const { kServerResponse } = require ( '_http_server' ) ;
62+ const { kServerResponse, Server : HttpServer , httpServerPreClose , setupConnectionsTracking } = require ( '_http_server' ) ;
6363const JSStreamSocket = require ( 'internal/js_stream_socket' ) ;
6464
6565const {
@@ -3180,6 +3180,11 @@ class Http2SecureServer extends TLSServer {
31803180 this [ kOptions ] = options ;
31813181 this . timeout = 0 ;
31823182 this . on ( 'newListener' , setupCompat ) ;
3183+ if ( options . allowHTTP1 === true ) {
3184+ this . headersTimeout = 60_000 ; // Minimum between 60 seconds or requestTimeout
3185+ this . requestTimeout = 300_000 ; // 5 minutes
3186+ this . on ( 'listening' , setupConnectionsTracking ) ;
3187+ }
31833188 if ( typeof requestListener === 'function' )
31843189 this . on ( 'request' , requestListener ) ;
31853190 this . on ( 'tlsClientError' , onErrorSecureServerSession ) ;
@@ -3199,6 +3204,19 @@ class Http2SecureServer extends TLSServer {
31993204 validateSettings ( settings ) ;
32003205 this [ kOptions ] . settings = { ...this [ kOptions ] . settings , ...settings } ;
32013206 }
3207+
3208+ close ( ) {
3209+ if ( this [ kOptions ] . allowHTTP1 === true ) {
3210+ httpServerPreClose ( this ) ;
3211+ }
3212+ ReflectApply ( TLSServer . prototype . close , this , arguments ) ;
3213+ }
3214+
3215+ closeIdleConnections ( ) {
3216+ if ( this [ kOptions ] . allowHTTP1 === true ) {
3217+ ReflectApply ( HttpServer . prototype . closeIdleConnections , this , arguments ) ;
3218+ }
3219+ }
32023220}
32033221
32043222class Http2Server extends NETServer {
0 commit comments