| 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
|
|
|