@@ -490,17 +490,10 @@ public boolean handleStatus(final HttpResponsePacket responsePacket,
490
490
final FilterChainContext ctx ) {
491
491
final List <String > authHeaders = listOf (responsePacket .getHeaders ()
492
492
.values (Header .WWWAuthenticate ));
493
-
494
- if (authHeaders .isEmpty ()) {
495
- throw new IllegalStateException ("401 response received, but no WWW-Authenticate header was present" );
496
- }
497
-
498
- final GrizzlyAsyncHttpProvider provider =
499
- httpTransactionContext .provider ;
500
-
493
+
501
494
Realm realm = getRealm (httpTransactionContext );
502
495
503
- if (realm == null ) {
496
+ if (authHeaders . isEmpty () || realm == null ) {
504
497
httpTransactionContext .invocationStatus = InvocationStatus .STOP ;
505
498
final AsyncHandler ah = httpTransactionContext .getAsyncHandler ();
506
499
@@ -515,6 +508,8 @@ public boolean handleStatus(final HttpResponsePacket responsePacket,
515
508
return true ;
516
509
}
517
510
511
+ final GrizzlyAsyncHttpProvider provider =
512
+ httpTransactionContext .provider ;
518
513
final Request req = httpTransactionContext .getAhcRequest ();
519
514
520
515
try {
@@ -605,17 +600,9 @@ public boolean handleStatus(final HttpResponsePacket responsePacket,
605
600
listOf (responsePacket .getHeaders ()
606
601
.values (Header .ProxyAuthenticate ));
607
602
608
- if (proxyAuthHeaders .isEmpty ()) {
609
- throw new IllegalStateException ("407 response received, but no "
610
- + "Proxy-Authenticate header was present" );
611
- }
612
-
613
- final GrizzlyAsyncHttpProvider provider =
614
- httpTransactionContext .provider ;
615
-
616
603
final ProxyServer proxyServer = httpTransactionContext .getProxyServer ();
617
604
618
- if (proxyServer == null ) {
605
+ if (proxyAuthHeaders . isEmpty () || proxyServer == null ) {
619
606
httpTransactionContext .invocationStatus = InvocationStatus .STOP ;
620
607
final AsyncHandler ah = httpTransactionContext .getAsyncHandler ();
621
608
@@ -630,6 +617,9 @@ public boolean handleStatus(final HttpResponsePacket responsePacket,
630
617
return true ;
631
618
}
632
619
620
+ final GrizzlyAsyncHttpProvider provider =
621
+ httpTransactionContext .provider ;
622
+
633
623
final Request req = httpTransactionContext .getAhcRequest ();
634
624
635
625
try {
0 commit comments