Skip to content

Commit 99e1391

Browse files
author
oleksiys
committed
[master] + fix issue AsyncHttpClient#1691
https://java.net/jira/browse/GRIZZLY-1691 "Support RFC 7238, HTTP Status Code "308 Permanent Redirect""
1 parent 1ed20a6 commit 99e1391

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

providers/grizzly/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</description>
1515

1616
<properties>
17-
<grizzly.version>2.3.13</grizzly.version>
17+
<grizzly.version>2.3.14</grizzly.version>
1818
<grizzly.npn.version>1.1</grizzly.npn.version>
1919
</properties>
2020

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/EventHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public final class EventHandler {
6565
HANDLER_MAP.put(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407.getStatusCode(), ProxyAuthorizationHandler.INSTANCE);
6666
HANDLER_MAP.put(HttpStatus.MOVED_PERMANENTLY_301.getStatusCode(), RedirectHandler.INSTANCE);
6767
HANDLER_MAP.put(HttpStatus.FOUND_302.getStatusCode(), RedirectHandler.INSTANCE);
68+
HANDLER_MAP.put(HttpStatus.SEE_OTHER_303.getStatusCode(), RedirectHandler.INSTANCE);
6869
HANDLER_MAP.put(HttpStatus.TEMPORARY_REDIRECT_307.getStatusCode(), RedirectHandler.INSTANCE);
70+
HANDLER_MAP.put(HttpStatus.PERMANENT_REDIRECT_308.getStatusCode(), RedirectHandler.INSTANCE);
6971
}
7072

7173
private final AsyncHttpClientConfig config;
@@ -405,7 +407,8 @@ public static boolean isRedirect(final int status) {
405407
return HttpStatus.MOVED_PERMANENTLY_301.statusMatches(status)//
406408
|| HttpStatus.FOUND_302.statusMatches(status)//
407409
|| HttpStatus.SEE_OTHER_303.statusMatches(status)//
408-
|| HttpStatus.TEMPORARY_REDIRECT_307.statusMatches(status);
410+
|| HttpStatus.TEMPORARY_REDIRECT_307.statusMatches(status)
411+
|| HttpStatus.PERMANENT_REDIRECT_308.statusMatches(status);
409412
}
410413

411414
// ----------------------------------------------------- Private Methods

providers/grizzly/src/main/java/org/asynchttpclient/providers/grizzly/statushandler/RedirectHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013 Sonatype, Inc. All rights reserved.
2+
* Copyright (c) 2013-2014 Sonatype, Inc. All rights reserved.
33
*
44
* This program is licensed to you under the Apache License Version 2.0,
55
* and you may not use this file except in compliance with the Apache License Version 2.0.
@@ -94,7 +94,8 @@ public boolean handleStatus(final HttpResponsePacket responsePacket, final HttpT
9494

9595
private boolean sendAsGet(final HttpResponsePacket response, final HttpTxContext ctx) {
9696
final int statusCode = response.getStatus();
97-
return !(statusCode < 302 || statusCode > 303) && !(statusCode == 302 && ctx.getProvider().getClientConfig().isStrict302Handling());
97+
return !(statusCode < 302 || statusCode > 303) &&
98+
!(statusCode == 302 && ctx.getProvider().getClientConfig().isStrict302Handling());
9899
}
99100

100101
} // END RedirectHandler

0 commit comments

Comments
 (0)