Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Unified Diff: sdk/lib/io/http.dart

Issue 11783034: Re-implement support for client redirects. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2_io/dart
Patch Set: Review fixes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 4ce0eaed3cb99c1a98458f26b240c39fbb02129a..e13a90e549eccdb56d27718f6bb6209f3df97bf9 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -845,52 +845,6 @@ abstract class HttpClientConnection {
// TODO(ajohnsen): Move these methods to the right place (request or response)
/**
- * Set this property to [:true:] if this connection should
- * automatically follow redirects. The default is [:true:].
- *
- * Automatic redirect will only happen for "GET" and "HEAD" requests
- * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:]
- * (301), [:HttpStatus.FOUND:] (302),
- * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
- * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
- * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For
- * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen
- * for "POST" requests with the method changed to "GET" when
- * following the redirect.
- *
- * All headers added to the request will be added to the redirection
- * request(s). However, any body send with the request will not be
- * part of the redirection request(s).
- */
- bool followRedirects;
-
- /**
- * Set this property to the maximum number of redirects to follow
- * when [followRedirects] is [:true:]. If this number is exceeded the
- * [onError] callback will be called with a [RedirectLimitExceeded]
- * exception. The default value is 5.
- */
- int maxRedirects;
-
- /**
- * Returns the series of redirects this connection has been through.
- */
- List<RedirectInfo> get redirects;
-
- /**
- * Redirect this connection to a new URL. The default value for
- * [method] is the method for the current request. The default value
- * for [url] is the value of the [:HttpHeaders.LOCATION:] header of
- * the current response. All body data must have been read from the
- * current response before calling [redirect].
- *
- * All headers added to the request will be added to the redirection
- * request(s). However, any body send with the request will not be
- * part of the redirection request(s).
- */
- void redirect([String method, Uri url]);
-
- /**
* Detach the underlying socket from the HTTP client. When the
* socket is detached the HTTP client will no longer perform any
* operations on it.
@@ -955,6 +909,34 @@ abstract class HttpClientRequest
* Close the request for input. Returns the value of [response].
*/
Future<HttpClientResponse> close();
+
+ /**
+ * Set this property to [:true:] if this request should
+ * automatically follow redirects. The default is [:true:].
+ *
+ * Automatic redirect will only happen for "GET" and "HEAD" requests
+ * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:]
+ * (301), [:HttpStatus.FOUND:] (302),
+ * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
+ * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
+ * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For
+ * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen
+ * for "POST" requests with the method changed to "GET" when
+ * following the redirect.
+ *
+ * All headers added to the request will be added to the redirection
+ * request(s). However, any body send with the request will not be
+ * part of the redirection request(s).
+ */
+ bool followRedirects;
+
+ /**
+ * Set this property to the maximum number of redirects to follow
+ * when [followRedirects] is [:true:]. If this number is exceeded the
+ * [onError] callback will be called with a [RedirectLimitExceeded]
+ * exception. The default value is 5.
+ */
+ int maxRedirects;
}
@@ -995,6 +977,34 @@ abstract class HttpClientResponse implements Stream<List<int>> {
bool get isRedirect;
/**
+ * Returns the series of redirects this connection has been through. The
+ * list will be empty if no redirects was followed. [redirects] will be
+ * updated both in the case of an automatic and a manual redirect.
+ */
+ List<RedirectInfo> get redirects;
+
+ /**
+ * Redirect this connection to a new URL. The default value for
+ * [method] is the method for the current request. The default value
+ * for [url] is the value of the [:HttpHeaders.LOCATION:] header of
+ * the current response. All body data must have been read from the
+ * current response before calling [redirect].
+ *
+ * All headers added to the request will be added to the redirection
+ * request(s). However, any body send with the request will not be
+ * part of the redirection request(s).
+ *
+ * If [followLoops] is set to [true], redirect will follow the redirect,
+ * even if was already visited. Default value is [false].
+ *
+ * [redirect] will ignore [maxRedirects] and always perform the redirect.
+ */
+ Future<HttpClientResponse> redirect([String method,
+ Uri url,
+ bool followLoops]);
+
+
+ /**
* Returns the response headers.
*/
HttpHeaders get headers;
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698