Chromium Code Reviews| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 /** | 376 /** |
| 377 * Returns the output stream for the response. This is used to write | 377 * Returns the output stream for the response. This is used to write |
| 378 * the response data. When all response data has been written close | 378 * the response data. When all response data has been written close |
| 379 * the stream to indicate the end of the response. | 379 * the stream to indicate the end of the response. |
| 380 * | 380 * |
| 381 * When this is accessed for the first time the response header is | 381 * When this is accessed for the first time the response header is |
| 382 * send. Calling any methods that will change the header after | 382 * send. Calling any methods that will change the header after |
| 383 * having retrieved the output stream will throw an exception. | 383 * having retrieved the output stream will throw an exception. |
| 384 */ | 384 */ |
| 385 OutputStream get outputStream(); | 385 OutputStream get outputStream(); |
| 386 | |
| 387 /** | |
| 388 * When the HTTP protocol is upgraded use this method to get the | |
| 389 * underlying socket used for the communication. After calling | |
| 390 * [protocolUpgrade] the socket is fully detached from the HTTP | |
| 391 * server. | |
| 392 */ | |
| 393 Socket protocolUpgrade(); | |
|
Anders Johnsen
2012/04/24 12:20:47
Further comment that this can be done after the HT
Mads Ager (google)
2012/04/25 10:41:55
The name makes it sound like this is requesting a
Søren Gjesse
2012/04/25 13:57:14
Done.
Søren Gjesse
2012/04/25 13:57:14
Changed name to detachSocket.
| |
| 386 } | 394 } |
| 387 | 395 |
| 388 | 396 |
| 389 /** | 397 /** |
| 390 * HTTP client factory. | 398 * HTTP client factory. |
| 391 */ | 399 */ |
| 392 interface HttpClient default _HttpClient { | 400 interface HttpClient default _HttpClient { |
| 393 static final int DEFAULT_HTTP_PORT = 80; | 401 static final int DEFAULT_HTTP_PORT = 80; |
| 394 | 402 |
| 395 HttpClient(); | 403 HttpClient(); |
| 396 | 404 |
| 397 /** | 405 /** |
| 398 * Opens a HTTP connection. The returned [HttpClientConnection] is | 406 * Opens a HTTP connection. The returned [HttpClientConnection] is |
| 399 * used to register callbacks for asynchronous events on the HTTP | 407 * used to register callbacks for asynchronous events on the HTTP |
| 400 * connection. The "Host" header for the request will be set to the | 408 * connection. The "Host" header for the request will be set to the |
| 401 * value [host]:[port]. This can be overridden through the | 409 * value [host]:[port]. This can be overridden through the |
| 402 * HttpClientRequest interface before the request is sent. NOTE if | 410 * HttpClientRequest interface before the request is sent. NOTE if |
| 403 * [host] is an IP address this will still be set in the "Host" | 411 * [host] is an IP address this will still be set in the "Host" |
| 404 * header. | 412 * header. |
| 405 */ | 413 */ |
| 406 HttpClientConnection open(String method, String host, int port, String path); | 414 HttpClientConnection open(String method, String host, int port, String path); |
| 407 | 415 |
| 416 //WebSocketConnection openWebSocket(protocols, String host, int port, String p ath); | |
|
Anders Johnsen
2012/04/24 12:20:47
Did you mean to include this?
Søren Gjesse
2012/04/25 13:57:14
No, removed.
| |
| 417 | |
| 408 /** | 418 /** |
| 409 * Opens a HTTP connection. The returned [HttpClientConnection] is | 419 * Opens a HTTP connection. The returned [HttpClientConnection] is |
| 410 * used to register callbacks for asynchronous events on the HTTP | 420 * used to register callbacks for asynchronous events on the HTTP |
| 411 * connection. The "Host" header for the request will be set based | 421 * connection. The "Host" header for the request will be set based |
| 412 * the host and port specified in [url]. This can be overridden | 422 * the host and port specified in [url]. This can be overridden |
| 413 * through the HttpClientRequest interface before the request is | 423 * through the HttpClientRequest interface before the request is |
| 414 * sent. NOTE if the host is specified as an IP address this will | 424 * sent. NOTE if the host is specified as an IP address this will |
| 415 * still be set in the "Host" header. | 425 * still be set in the "Host" header. |
| 416 */ | 426 */ |
| 417 HttpClientConnection openUrl(String method, Uri url); | 427 HttpClientConnection openUrl(String method, Uri url); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 */ | 545 */ |
| 536 InputStream get inputStream(); | 546 InputStream get inputStream(); |
| 537 } | 547 } |
| 538 | 548 |
| 539 | 549 |
| 540 class HttpException implements Exception { | 550 class HttpException implements Exception { |
| 541 const HttpException([String this.message = ""]); | 551 const HttpException([String this.message = ""]); |
| 542 String toString() => "HttpException: $message"; | 552 String toString() => "HttpException: $message"; |
| 543 final String message; | 553 final String message; |
| 544 } | 554 } |
| OLD | NEW |