| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * HTTP status codes. | 6 * HTTP status codes. |
| 7 */ | 7 */ |
| 8 interface HttpStatus { | 8 interface HttpStatus { |
| 9 static final int CONTINUE = 100; | 9 static final int CONTINUE = 100; |
| 10 static final int SWITCHING_PROTOCOLS = 101; | 10 static final int SWITCHING_PROTOCOLS = 101; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 * used to register callbacks for asynchronous events on the HTTP | 228 * used to register callbacks for asynchronous events on the HTTP |
| 229 * connection. The "Host" header for the request will be set to the | 229 * connection. The "Host" header for the request will be set to the |
| 230 * value [host]:[port]. This can be overridden through the | 230 * value [host]:[port]. This can be overridden through the |
| 231 * HttpClientRequest interface before the request is sent. NOTE if | 231 * HttpClientRequest interface before the request is sent. NOTE if |
| 232 * [host] is an IP address this will still be set in the "Host" | 232 * [host] is an IP address this will still be set in the "Host" |
| 233 * header. | 233 * header. |
| 234 */ | 234 */ |
| 235 HttpClientConnection open(String method, String host, int port, String path); | 235 HttpClientConnection open(String method, String host, int port, String path); |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * Opens a HTTP connection. The returned [HttpClientConnection] is |
| 239 * used to register callbacks for asynchronous events on the HTTP |
| 240 * connection. The "Host" header for the request will be set based |
| 241 * the host and port specified in [url]. This can be overridden |
| 242 * through the HttpClientRequest interface before the request is |
| 243 * sent. NOTE if the host is specified as an IP address this will |
| 244 * still be set in the "Host" header. |
| 245 */ |
| 246 HttpClientConnection openUrl(String method, Uri url); |
| 247 |
| 248 /** |
| 238 * Opens a HTTP connection using the GET method. See [open] for details. | 249 * Opens a HTTP connection using the GET method. See [open] for details. |
| 239 */ | 250 */ |
| 240 HttpClientConnection get(String host, int port, String path); | 251 HttpClientConnection get(String host, int port, String path); |
| 241 | 252 |
| 242 /** | 253 /** |
| 254 * Opens a HTTP connection using the GET method. See [openUrl] for details. |
| 255 */ |
| 256 HttpClientConnection getUrl(Uri url); |
| 257 |
| 258 /** |
| 243 * Opens a HTTP connection using the POST method. See [open] for details. | 259 * Opens a HTTP connection using the POST method. See [open] for details. |
| 244 */ | 260 */ |
| 245 HttpClientConnection post(String host, int port, String path); | 261 HttpClientConnection post(String host, int port, String path); |
| 246 | 262 |
| 247 /** | 263 /** |
| 264 * Opens a HTTP connection using the POST method. See [openUrl] for details. |
| 265 */ |
| 266 HttpClientConnection postUrl(Uri url); |
| 267 |
| 268 /** |
| 248 * Shutdown the HTTP client releasing all resources. | 269 * Shutdown the HTTP client releasing all resources. |
| 249 */ | 270 */ |
| 250 void shutdown(); | 271 void shutdown(); |
| 251 } | 272 } |
| 252 | 273 |
| 253 | 274 |
| 254 /** | 275 /** |
| 255 * A [HttpClientConnection] is returned by all [HttpClient] methods | 276 * A [HttpClientConnection] is returned by all [HttpClient] methods |
| 256 * that initiate a connection to an HTTP server. The handlers will be | 277 * that initiate a connection to an HTTP server. The handlers will be |
| 257 * called as the connection state progresses. | 278 * called as the connection state progresses. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 */ | 411 */ |
| 391 InputStream get inputStream(); | 412 InputStream get inputStream(); |
| 392 } | 413 } |
| 393 | 414 |
| 394 | 415 |
| 395 class HttpException implements Exception { | 416 class HttpException implements Exception { |
| 396 const HttpException([String this.message = ""]); | 417 const HttpException([String this.message = ""]); |
| 397 String toString() => "HttpException: $message"; | 418 String toString() => "HttpException: $message"; |
| 398 final String message; | 419 final String message; |
| 399 } | 420 } |
| OLD | NEW |