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

Unified Diff: runtime/bin/http.dart

Issue 9616004: Add handling of the HTTP header "Host" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 40bbc7a3c5cb75ee0e194a0ba21c9940de19677a..3a707414efd2ce355c3bb16e56b301c9ef44b64e 100644
--- a/runtime/bin/http.dart
+++ b/runtime/bin/http.dart
@@ -184,6 +184,11 @@ interface HttpResponse default _HttpResponse {
void setHeader(String name, String value);
/**
+ * Returns the response headers.
+ */
+ Map<String, String> get headers();
+
+ /**
* 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.
@@ -208,22 +213,28 @@ interface HttpResponse default _HttpResponse {
* HTTP client factory.
*/
interface HttpClient default _HttpClient {
+ static final int DEFAULT_HTTP_PORT = 80;
+
HttpClient();
/**
* Opens a HTTP connection. The returned [HttpClientConnection] is
- * used to register handlers for asynchronous events on a Http
- * connection.
+ * used to register callbacks for asynchronous events on the HTTP
+ * connection. The "Host" header for the request will be set to the
+ * value [host]:[port]. This can be overridden through the
+ * HttpClientRequest interface before the request is sent. NOTE if
+ * [host] is an IP address this will still be set in the "Host"
+ * header.
*/
HttpClientConnection open(String method, String host, int port, String path);
/**
- * Opens a HTTP connection using the GET method.
+ * Opens a HTTP connection using the GET method. See [open] for details.
*/
HttpClientConnection get(String host, int port, String path);
/**
- * Opens a HTTP connection using the POST method.
+ * Opens a HTTP connection using the POST method. See [open] for details.
*/
HttpClientConnection post(String host, int port, String path);
@@ -283,6 +294,20 @@ interface HttpClientRequest default _HttpClientRequest {
bool keepAlive;
/**
+ * Gets and sets the " host part of the "Host" header for the
+ * connection. By default this will be set to the value of the host
+ * used when initiating the connection.
+ */
+ String host;
+
+ /**
+ * Gets and sets the port part of the "Host" header for the
+ * connection. By default this will be set to the value of the port
+ * used when initiating the connection.
+ */
+ int port;
+
+ /**
* Sets a header on the request. NOTE: If the same header name is
* set more than once only the last value set will be part of the
* request.
@@ -290,6 +315,11 @@ interface HttpClientRequest default _HttpClientRequest {
void setHeader(String name, String value);
/**
+ * Returns the request headers.
+ */
+ Map<String, String> get headers();
+
+ /**
* 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.
@@ -338,7 +368,7 @@ interface HttpClientResponse default _HttpClientResponse {
/**
* Returns the response headers.
*/
- Map get headers();
+ Map<String, String> get headers();
/**
* Returns the input stream for the response. This is used to read
« 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