private boolean validateNoLoopDetected ( DefaultHttpSession acceptSession ) { List < String > viaHeaders = acceptSession . getReadHeaders ( HEADER_VIA ) ; if ( viaHeaders != null && viaHeaders . stream ( ) . anyMatch ( h -> h . equals ( viaHeader ) ) ) { LOGGER . warn ( "Connection to " + getConnectURIs ( ) . iterator ( ) . next ( ) + " failed due to loop detection [" + acceptSession + "->]" ) ; acceptSession . setStatus ( HttpStatus . SERVER_LOOP_DETECTED ) ; acceptSession . close ( true ) ; return false ; } return true ; }
Helper method performing loop detection