Index: sdk/lib/io/http_impl.dart |
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart |
index 5672bb52e6387313be3751a8b85e23d96570dbf7..c20047976499a04e562d540df2142b0fa2f07a2a 100644 |
--- a/sdk/lib/io/http_impl.dart |
+++ b/sdk/lib/io/http_impl.dart |
@@ -1286,10 +1286,16 @@ class _HttpClientResponse |
String get reasonPhrase => _reasonPhrase; |
bool get isRedirect { |
- return statusCode == HttpStatus.MOVED_PERMANENTLY || |
- statusCode == HttpStatus.FOUND || |
- statusCode == HttpStatus.SEE_OTHER || |
- statusCode == HttpStatus.TEMPORARY_REDIRECT; |
+ var method = _connection._request._method; |
+ if (method == "GET" || method == "HEAD") { |
+ return statusCode == HttpStatus.MOVED_PERMANENTLY || |
+ statusCode == HttpStatus.FOUND || |
+ statusCode == HttpStatus.SEE_OTHER || |
+ statusCode == HttpStatus.TEMPORARY_REDIRECT; |
+ } else if (method == "POST") { |
+ return statusCode == HttpStatus.SEE_OTHER; |
+ } |
+ return false; |
} |
List<Cookie> get cookies { |
@@ -1346,7 +1352,12 @@ class _HttpClientResponse |
} |
// Drain body and redirect. |
inputStream.onData = inputStream.read; |
- _connection.redirect(); |
+ if (_statusCode == HttpStatus.SEE_OTHER && |
+ _connection._method == "POST") { |
+ _connection.redirect("GET"); |
+ } else { |
+ _connection.redirect(); |
+ } |
} else { |
throw new RedirectLimitExceededException(_connection._redirects); |
} |