@@ -243,9 +243,8 @@ private boolean applyIoExceptionFiltersAndReplayRequest(ChannelHandlerContext ct
243
243
private boolean redirect (Request request , NettyResponseFuture <?> future , HttpResponse response , final ChannelHandlerContext ctx ) throws Exception {
244
244
245
245
io .netty .handler .codec .http .HttpResponseStatus status = response .getStatus ();
246
- // int statusCode = response.getStatus().code();
247
246
boolean redirectEnabled = request .isRedirectOverrideSet () ? request .isRedirectEnabled () : config .isRedirectEnabled ();
248
- boolean isRedirectStatus = status == MOVED_PERMANENTLY || status == FOUND || status == SEE_OTHER || status == TEMPORARY_REDIRECT ;
247
+ boolean isRedirectStatus = status . equals ( MOVED_PERMANENTLY ) || status . equals ( FOUND ) || status . equals ( SEE_OTHER ) || status . equals ( TEMPORARY_REDIRECT ) ;
249
248
if (redirectEnabled && isRedirectStatus ) {
250
249
251
250
if (future .incrementAndGetCurrentRedirectCount () < config .getMaxRedirects ()) {
@@ -262,7 +261,7 @@ private boolean redirect(Request request, NettyResponseFuture<?> future, HttpRes
262
261
}
263
262
264
263
// FIXME why not do that for 301 and 307 too?
265
- if ((status == FOUND || status == SEE_OTHER ) && !(status == FOUND && config .isStrict302Handling ())) {
264
+ if ((status . equals ( FOUND ) || status . equals ( SEE_OTHER )) && !(status . equals ( FOUND ) && config .isStrict302Handling ())) {
266
265
nBuilder .setMethod (HttpMethod .GET .name ());
267
266
}
268
267
@@ -757,7 +756,7 @@ public void handle(ChannelHandlerContext ctx, NettyResponseFuture future, Object
757
756
if (redirect (request , future , response , ctx ))
758
757
return ;
759
758
760
- boolean validStatus = response .getStatus () == SWITCHING_PROTOCOLS ;
759
+ boolean validStatus = response .getStatus (). equals ( SWITCHING_PROTOCOLS ) ;
761
760
boolean validUpgrade = response .headers ().get (HttpHeaders .Names .UPGRADE ) != null ;
762
761
String c = response .headers ().get (HttpHeaders .Names .CONNECTION );
763
762
if (c == null ) {
0 commit comments