private static Headers combine ( Headers cachedHeaders , Headers networkHeaders ) { Headers . Builder result = new Headers . Builder ( ) ; for ( int i = 0 , size = cachedHeaders . size ( ) ; i < size ; i ++ ) { String fieldName = cachedHeaders . name ( i ) ; String value = cachedHeaders . value ( i ) ; if ( "Warning" . equalsIgnoreCase ( fieldName ) && value . startsWith ( "1" ) ) { continue ; // Drop 100-level freshness warnings. } if ( isContentSpecificHeader ( fieldName ) || ! isEndToEnd ( fieldName ) || networkHeaders . get ( fieldName ) == null ) { addHeaderLenient ( result , fieldName , value ) ; } } for ( int i = 0 , size = networkHeaders . size ( ) ; i < size ; i ++ ) { String fieldName = networkHeaders . name ( i ) ; if ( ! isContentSpecificHeader ( fieldName ) && isEndToEnd ( fieldName ) ) { addHeaderLenient ( result , fieldName , networkHeaders . value ( i ) ) ; } } return result . build ( ) ; }
Combines cached headers with a network headers as defined by RFC 7234 4 . 3 . 4 .