| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 * Http request delivered to the HTTP server callback. | 103 * Http request delivered to the HTTP server callback. |
| 104 */ | 104 */ |
| 105 interface HttpRequest default _HttpRequest { | 105 interface HttpRequest default _HttpRequest { |
| 106 /** | 106 /** |
| 107 * Returns the content length of the request body. If the size of | 107 * Returns the content length of the request body. If the size of |
| 108 * the request body is not known in advance this -1. | 108 * the request body is not known in advance this -1. |
| 109 */ | 109 */ |
| 110 int get contentLength(); | 110 int get contentLength(); |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Returns the keep alive state of the connection. | |
| 114 */ | |
| 115 bool get keepAlive(); | |
| 116 | |
| 117 /** | |
| 118 * Returns the method for the request. | 113 * Returns the method for the request. |
| 119 */ | 114 */ |
| 120 String get method(); | 115 String get method(); |
| 121 | 116 |
| 122 /** | 117 /** |
| 123 * Returns the URI for the request. | 118 * Returns the URI for the request. |
| 124 */ | 119 */ |
| 125 String get uri(); | 120 String get uri(); |
| 126 | 121 |
| 127 /** | 122 /** |
| (...skipping 29 matching lines...) Expand all Loading... |
| 157 */ | 152 */ |
| 158 interface HttpResponse default _HttpResponse { | 153 interface HttpResponse default _HttpResponse { |
| 159 /** | 154 /** |
| 160 * Gets and sets the content length of the response. If the size of | 155 * Gets and sets the content length of the response. If the size of |
| 161 * the response is not known in advance set the content length to | 156 * the response is not known in advance set the content length to |
| 162 * -1 - which is also the default if not set. | 157 * -1 - which is also the default if not set. |
| 163 */ | 158 */ |
| 164 int contentLength; | 159 int contentLength; |
| 165 | 160 |
| 166 /** | 161 /** |
| 167 * Gets and sets the keep alive state of the connection. If the | |
| 168 * associated request have a keep alive state of false setting keep | |
| 169 * alive to true will have no effect. | |
| 170 */ | |
| 171 bool keepAlive; | |
| 172 | |
| 173 /** | |
| 174 * Gets and sets the status code. Any integer value is accepted, but | 162 * Gets and sets the status code. Any integer value is accepted, but |
| 175 * for the official HTTP status codes use the fields from | 163 * for the official HTTP status codes use the fields from |
| 176 * [HttpStatus]. | 164 * [HttpStatus]. |
| 177 */ | 165 */ |
| 178 int statusCode; | 166 int statusCode; |
| 179 | 167 |
| 180 /** | 168 /** |
| 181 * Gets and sets the reason phrase. If no reason phrase is explicitly | 169 * Gets and sets the reason phrase. If no reason phrase is explicitly |
| 182 * set a default reason phrase is provided. | 170 * set a default reason phrase is provided. |
| 183 */ | 171 */ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 */ | 296 */ |
| 309 interface HttpClientRequest default _HttpClientRequest { | 297 interface HttpClientRequest default _HttpClientRequest { |
| 310 /** | 298 /** |
| 311 * Gets and sets the content length of the request. If the size of | 299 * Gets and sets the content length of the request. If the size of |
| 312 * the request is not known in advance set content length to -1, | 300 * the request is not known in advance set content length to -1, |
| 313 * which is also the default. | 301 * which is also the default. |
| 314 */ | 302 */ |
| 315 int contentLength; | 303 int contentLength; |
| 316 | 304 |
| 317 /** | 305 /** |
| 318 * Gets and sets the keep alive state of the connection. | |
| 319 */ | |
| 320 bool keepAlive; | |
| 321 | |
| 322 /** | |
| 323 * Gets and sets the " host part of the "Host" header for the | 306 * Gets and sets the " host part of the "Host" header for the |
| 324 * connection. By default this will be set to the value of the host | 307 * connection. By default this will be set to the value of the host |
| 325 * used when initiating the connection. | 308 * used when initiating the connection. |
| 326 */ | 309 */ |
| 327 String host; | 310 String host; |
| 328 | 311 |
| 329 /** | 312 /** |
| 330 * Gets and sets the port part of the "Host" header for the | 313 * Gets and sets the port part of the "Host" header for the |
| 331 * connection. By default this will be set to the value of the port | 314 * connection. By default this will be set to the value of the port |
| 332 * used when initiating the connection. | 315 * used when initiating the connection. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 */ | 355 */ |
| 373 String get reasonPhrase(); | 356 String get reasonPhrase(); |
| 374 | 357 |
| 375 /** | 358 /** |
| 376 * Returns the content length of the request body. If the size of | 359 * Returns the content length of the request body. If the size of |
| 377 * the request body is not known in advance this -1. | 360 * the request body is not known in advance this -1. |
| 378 */ | 361 */ |
| 379 int get contentLength(); | 362 int get contentLength(); |
| 380 | 363 |
| 381 /** | 364 /** |
| 382 * Returns the keep alive state of the connection. | |
| 383 */ | |
| 384 bool get keepAlive(); | |
| 385 | |
| 386 /** | |
| 387 * Returns the date value for the "Expires" header. Returns null if | 365 * Returns the date value for the "Expires" header. Returns null if |
| 388 * the response has no "Expires" header. Throws a HttpException if | 366 * the response has no "Expires" header. Throws a HttpException if |
| 389 * the response has an "Expires" header which is not formatted as a | 367 * the response has an "Expires" header which is not formatted as a |
| 390 * valid HTTP date. | 368 * valid HTTP date. |
| 391 */ | 369 */ |
| 392 Date get expires(); | 370 Date get expires(); |
| 393 | 371 |
| 394 /** | 372 /** |
| 395 * Returns the response headers. | 373 * Returns the response headers. |
| 396 */ | 374 */ |
| 397 Map<String, String> get headers(); | 375 Map<String, String> get headers(); |
| 398 | 376 |
| 399 /** | 377 /** |
| 400 * Returns the input stream for the response. This is used to read | 378 * Returns the input stream for the response. This is used to read |
| 401 * the response data. | 379 * the response data. |
| 402 */ | 380 */ |
| 403 InputStream get inputStream(); | 381 InputStream get inputStream(); |
| 404 } | 382 } |
| 405 | 383 |
| 406 | 384 |
| 407 class HttpException implements Exception { | 385 class HttpException implements Exception { |
| 408 const HttpException([String this.message = ""]); | 386 const HttpException([String this.message = ""]); |
| 409 String toString() => "HttpException: $message"; | 387 String toString() => "HttpException: $message"; |
| 410 final String message; | 388 final String message; |
| 411 } | 389 } |
| OLD | NEW |