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

Unified Diff: runtime/bin/http.dart

Issue 10414076: Support for cookies in the HTTP library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | runtime/bin/http_impl.dart » ('j') | runtime/bin/http_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http.dart
diff --git a/runtime/bin/http.dart b/runtime/bin/http.dart
index 3314b1c6e601839875cbf9589e401700abad376d..8b919ff216350f179ee8885b4679700e655cc062 100644
--- a/runtime/bin/http.dart
+++ b/runtime/bin/http.dart
@@ -277,6 +277,14 @@ interface HttpHeaders default _HttpHeaders {
void forEach(void f(String name, List<String> values));
/**
+ * Indicate that for the header named [name] don't apply the folding
Mads Ager (google) 2012/05/23 13:31:05 I found this comment hard to read. Maybe something
Søren Gjesse 2012/05/24 11:34:21 Done.
+ * of multiple header values into a single header field by
+ * separating values with comma. By default no folding is set for
+ * the Set-Cookie header.
+ */
+ void noFolding(String name);
+
+ /**
* Gets and sets the date. The value of this property will
* reflect the "Date" header
*/
@@ -368,7 +376,6 @@ interface HeaderValue default _HeaderValue {
* value; parameter1=value1; parameter2=value2
*/
String toString();
-
}
@@ -419,6 +426,75 @@ interface ContentType extends HeaderValue default _ContentType {
/**
+ * Representation of a cookie. For cookies received by the server as
+ * Cookie header values only [:name:] and [:value:] fields will be
+ * set. When building a cookie for the Set-Cookie header in the server
+ * and when receiving cookies by the client as Set-Cookie header all
Mads Ager (google) 2012/05/23 13:31:05 by the client -> in the client? as Set-Cookie hea
Søren Gjesse 2012/05/24 11:34:21 Done.
+ * fields can be used.
+ */
+interface Cookie default _Cookie {
+ /**
+ * Creates a new cookie optionally setting the name and value.
+ */
+ Cookie([String name, String value]);
+
+ /**
+ * Creates a new cookie by parsing a header value from a Set-Cookie
+ * header.
+ */
+ Cookie.fromSetCookieValue(String value);
+
+ /**
+ * Gets and sets the name.
+ */
+ String name;
+
+ /**
+ * Gets and sets the name.
Mads Ager (google) 2012/05/23 13:31:05 the value
Søren Gjesse 2012/05/24 11:34:21 Done.
+ */
+ String value;
+
+ /**
+ * Gets and sets the expiry date.
+ */
+ Date expires;
+
+ /**
+ * Gets and sets the max age. A value of [:0:] means delete cookie
+ * now.
+ */
+ int maxAge;
+
+ /**
+ * Gets and sets the domain.
+ */
+ String domain;
+
+ /**
+ * Gets and sets the path.
+ */
+ String path;
+
+ /**
+ * Gets and sets whether this cookie is secure.
+ */
+ bool secure;
+
+ /**
+ * Gets and sets whether this cookie is HTTP only.
+ */
+
Mads Ager (google) 2012/05/23 13:31:05 Remove empty line.
Søren Gjesse 2012/05/24 11:34:21 Done.
+ bool httpOnly;
+
+ /**
+ * Returns the formatted string representation of the cookie for
Mads Ager (google) 2012/05/23 13:31:05 Returns the formatted string representation of the
Søren Gjesse 2012/05/24 11:34:21 Done.
+ * setting the Cookie or Set-Cookie headers
+ */
+ String toString();
+}
+
+
+/**
* Http request delivered to the HTTP server callback.
*/
interface HttpRequest default _HttpRequest {
@@ -464,6 +540,11 @@ interface HttpRequest default _HttpRequest {
HttpHeaders get headers();
/**
+ * Returns the cookies in the request (from the Cookie header).
+ */
+ List<Cookie> get cookies();
+
+ /**
* Returns the input stream for the request. This is used to read
* the request data.
*/
@@ -514,6 +595,11 @@ interface HttpResponse default _HttpResponse {
HttpHeaders get headers();
/**
+ * Cookies to set in the client (in the Set-Cookie header).
+ */
+ List<Cookie> get cookies();
+
+ /**
* Returns the output stream for the response. This is used to write
* the response data. When all response data has been written close
* the stream to indicate the end of the response.
@@ -684,6 +770,11 @@ interface HttpClientRequest default _HttpClientRequest {
HttpHeaders get headers();
/**
+ * Cookies to present to the server (in the Cookie header).
+ */
+ List<Cookie> get cookies();
+
+ /**
* Returns the output stream for the request. This is used to write
* the request data. When all request data has been written close
* the stream to indicate the end of the request.
@@ -730,6 +821,11 @@ interface HttpClientResponse default _HttpClientResponse {
HttpHeaders get headers();
/**
+ * Cookies set by the server (from the Set-Cookie header).
+ */
+ List<Cookie> get cookies();
+
+ /**
* Returns the input stream for the response. This is used to read
* the response data.
*/
« no previous file with comments | « no previous file | runtime/bin/http_impl.dart » ('j') | runtime/bin/http_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698