@@ -342,12 +342,12 @@ module.exports = class CachePolicy {
342
342
}
343
343
344
344
_serverDate ( ) {
345
- const dateValue = Date . parse ( this . _resHeaders . date ) ;
346
- if ( isFinite ( dateValue ) ) {
345
+ const serverDate = Date . parse ( this . _resHeaders . date ) ;
346
+ if ( isFinite ( serverDate ) ) {
347
347
const maxClockDrift = 8 * 3600 * 1000 ;
348
- const clockDrift = Math . abs ( this . _responseTime - dateValue ) ;
348
+ const clockDrift = Math . abs ( this . _responseTime - serverDate ) ;
349
349
if ( clockDrift < maxClockDrift ) {
350
- return dateValue ;
350
+ return serverDate ;
351
351
}
352
352
}
353
353
return this . _responseTime ;
@@ -419,22 +419,22 @@ module.exports = class CachePolicy {
419
419
420
420
const defaultMinTtl = this . _rescc . immutable ? this . _immutableMinTtl : 0 ;
421
421
422
- const dateValue = this . _serverDate ( ) ;
422
+ const serverDate = this . _serverDate ( ) ;
423
423
if ( this . _resHeaders . expires ) {
424
424
const expires = Date . parse ( this . _resHeaders . expires ) ;
425
425
// A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired").
426
- if ( Number . isNaN ( expires ) || expires < dateValue ) {
426
+ if ( Number . isNaN ( expires ) || expires < serverDate ) {
427
427
return 0 ;
428
428
}
429
- return Math . max ( defaultMinTtl , ( expires - dateValue ) / 1000 ) ;
429
+ return Math . max ( defaultMinTtl , ( expires - serverDate ) / 1000 ) ;
430
430
}
431
431
432
432
if ( this . _resHeaders [ 'last-modified' ] ) {
433
433
const lastModified = Date . parse ( this . _resHeaders [ 'last-modified' ] ) ;
434
- if ( isFinite ( lastModified ) && dateValue > lastModified ) {
434
+ if ( isFinite ( lastModified ) && serverDate > lastModified ) {
435
435
return Math . max (
436
436
defaultMinTtl ,
437
- ( ( dateValue - lastModified ) / 1000 ) * this . _cacheHeuristic
437
+ ( ( serverDate - lastModified ) / 1000 ) * this . _cacheHeuristic
438
438
) ;
439
439
}
440
440
}
0 commit comments