@@ -100,32 +100,28 @@ class Server {
100100 if ( etag === null && lastModified === null )
101101 break conditional;
102102
103- if ( req . headers . has ( "if-match" ) && ! this . getETags ( req . headers . get ( "if-match" ) ! )
104- . filter ( t => ! t . startsWith ( "W/" ) )
105- . includes ( etag ! ) )
106- return this . errors . _get ( ServerErrorRegistry . ErrorCodes . PRECONDITION_FAILED , req ) . _send ( res , this , req ) ;
107-
108- if ( req . headers . has ( "if-unmodified-since" )
109- && (
110- lastModified === null
111- || lastModified . getTime ( ) > new Date ( req . headers . get ( "if-unmodified-since" ) ! ) . getTime ( )
112- ) )
113- return this . errors . _get ( ServerErrorRegistry . ErrorCodes . PRECONDITION_FAILED , req ) . _send ( res , this , req ) ;
114-
115- if ( (
116- etag !== null
117- && (
118- req . headers . has ( "if-none-match" )
119- && this . getETags ( req . headers . get ( "if-none-match" ) ! ) . includes ( etag ! )
120- )
121- )
122- || (
123- lastModified !== null
124- && (
125- req . headers . has ( "if-modified-since" )
126- && new Date ( req . headers . get ( "if-modified-since" ) ! ) . getTime ( ) >= lastModified . getTime ( )
127- )
128- ) ) return new EmptyResponse ( responseHeaders , 304 ) . _send ( res , this , req ) ;
103+ if ( req . headers . has ( "if-match" ) ) {
104+ if ( ! this . getETags ( req . headers . get ( "if-match" ) ! )
105+ . filter ( t => ! t . startsWith ( "W/" ) )
106+ . includes ( etag ! ) )
107+ return this . errors . _get ( ServerErrorRegistry . ErrorCodes . PRECONDITION_FAILED , req ) . _send ( res , this , req ) ;
108+ }
109+ else if ( req . headers . has ( "if-unmodified-since" ) ) {
110+ if ( lastModified === null
111+ || lastModified . getTime ( ) > new Date ( req . headers . get ( "if-unmodified-since" ) ! ) . getTime ( ) )
112+ return this . errors . _get ( ServerErrorRegistry . ErrorCodes . PRECONDITION_FAILED , req ) . _send ( res , this , req ) ;
113+ }
114+
115+ if ( req . headers . has ( "if-none-match" ) ) {
116+ if ( this . getETags ( req . headers . get ( "if-none-match" ) ! )
117+ . includes ( etag ! ) )
118+ return new EmptyResponse ( responseHeaders , 304 ) . _send ( res , this , req ) ;
119+ }
120+ else if ( req . headers . has ( "if-modified-since" ) ) {
121+ if ( lastModified !== null
122+ && lastModified . getTime ( ) <= new Date ( req . headers . get ( "if-modified-since" ) ! ) . getTime ( ) )
123+ return new EmptyResponse ( responseHeaders , 304 ) . _send ( res , this , req ) ;
124+ }
129125 }
130126 response . _send ( res , this , req ) ;
131127 }
0 commit comments