| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 */ | 246 */ |
| 247 void remove(String name, Object value); | 247 void remove(String name, Object value); |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * Remove all values for the specified header name. Some headers | 250 * Remove all values for the specified header name. Some headers |
| 251 * have system supplied values and for these the system supplied | 251 * have system supplied values and for these the system supplied |
| 252 * values will still be added to the collection of values for the | 252 * values will still be added to the collection of values for the |
| 253 * header. | 253 * header. |
| 254 */ | 254 */ |
| 255 void removeAll(String name); | 255 void removeAll(String name); |
| 256 |
| 257 /** |
| 258 * Gets and sets the expiry date. The value of this property will |
| 259 * reflect the "Expires" header |
| 260 */ |
| 261 Date expires; |
| 262 |
| 263 /** |
| 264 * Gets and sets the host part of the "Host" header for the |
| 265 * connection. |
| 266 */ |
| 267 String host; |
| 268 |
| 269 /** |
| 270 * Gets and sets the port part of the "Host" header for the |
| 271 * connection. |
| 272 */ |
| 273 int port; |
| 256 } | 274 } |
| 257 | 275 |
| 258 | 276 |
| 259 /** | 277 /** |
| 260 * Http request delivered to the HTTP server callback. | 278 * Http request delivered to the HTTP server callback. |
| 261 */ | 279 */ |
| 262 interface HttpRequest default _HttpRequest { | 280 interface HttpRequest default _HttpRequest { |
| 263 /** | 281 /** |
| 264 * Returns the content length of the request body. If the size of | 282 * Returns the content length of the request body. If the size of |
| 265 * the request body is not known in advance this -1. | 283 * the request body is not known in advance this -1. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 */ | 340 */ |
| 323 int statusCode; | 341 int statusCode; |
| 324 | 342 |
| 325 /** | 343 /** |
| 326 * Gets and sets the reason phrase. If no reason phrase is explicitly | 344 * Gets and sets the reason phrase. If no reason phrase is explicitly |
| 327 * set a default reason phrase is provided. | 345 * set a default reason phrase is provided. |
| 328 */ | 346 */ |
| 329 String reasonPhrase; | 347 String reasonPhrase; |
| 330 | 348 |
| 331 /** | 349 /** |
| 332 * Gets and sets the expiry date. The value of this property will | |
| 333 * reflect the "Expires" header | |
| 334 */ | |
| 335 Date expires; | |
| 336 | |
| 337 /** | |
| 338 * Returns the response headers. | 350 * Returns the response headers. |
| 339 */ | 351 */ |
| 340 HttpHeaders get headers(); | 352 HttpHeaders get headers(); |
| 341 | 353 |
| 342 /** | 354 /** |
| 343 * Returns the output stream for the response. This is used to write | 355 * Returns the output stream for the response. This is used to write |
| 344 * the response data. When all response data has been written close | 356 * the response data. When all response data has been written close |
| 345 * the stream to indicate the end of the response. | 357 * the stream to indicate the end of the response. |
| 346 * | 358 * |
| 347 * When this is accessed for the first time the response header is | 359 * When this is accessed for the first time the response header is |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 */ | 458 */ |
| 447 interface HttpClientRequest default _HttpClientRequest { | 459 interface HttpClientRequest default _HttpClientRequest { |
| 448 /** | 460 /** |
| 449 * Gets and sets the content length of the request. If the size of | 461 * Gets and sets the content length of the request. If the size of |
| 450 * the request is not known in advance set content length to -1, | 462 * the request is not known in advance set content length to -1, |
| 451 * which is also the default. | 463 * which is also the default. |
| 452 */ | 464 */ |
| 453 int contentLength; | 465 int contentLength; |
| 454 | 466 |
| 455 /** | 467 /** |
| 456 * Gets and sets the " host part of the "Host" header for the | |
| 457 * connection. By default this will be set to the value of the host | |
| 458 * used when initiating the connection. | |
| 459 */ | |
| 460 String host; | |
| 461 | |
| 462 /** | |
| 463 * Gets and sets the port part of the "Host" header for the | |
| 464 * connection. By default this will be set to the value of the port | |
| 465 * used when initiating the connection. | |
| 466 */ | |
| 467 int port; | |
| 468 | |
| 469 /** | |
| 470 * Returns the request headers. | 468 * Returns the request headers. |
| 471 */ | 469 */ |
| 472 HttpHeaders get headers(); | 470 HttpHeaders get headers(); |
| 473 | 471 |
| 474 /** | 472 /** |
| 475 * Returns the output stream for the request. This is used to write | 473 * Returns the output stream for the request. This is used to write |
| 476 * the request data. When all request data has been written close | 474 * the request data. When all request data has been written close |
| 477 * the stream to indicate the end of the request. | 475 * the stream to indicate the end of the request. |
| 478 * | 476 * |
| 479 * When this is accessed for the first time the request header is | 477 * When this is accessed for the first time the request header is |
| (...skipping 18 matching lines...) Expand all Loading... |
| 498 */ | 496 */ |
| 499 String get reasonPhrase(); | 497 String get reasonPhrase(); |
| 500 | 498 |
| 501 /** | 499 /** |
| 502 * Returns the content length of the request body. If the size of | 500 * Returns the content length of the request body. If the size of |
| 503 * the request body is not known in advance this -1. | 501 * the request body is not known in advance this -1. |
| 504 */ | 502 */ |
| 505 int get contentLength(); | 503 int get contentLength(); |
| 506 | 504 |
| 507 /** | 505 /** |
| 508 * Returns the date value for the "Expires" header. Returns null if | |
| 509 * the response has no "Expires" header. Throws a HttpException if | |
| 510 * the response has an "Expires" header which is not formatted as a | |
| 511 * valid HTTP date. | |
| 512 */ | |
| 513 Date get expires(); | |
| 514 | |
| 515 /** | |
| 516 * Returns the response headers. | 506 * Returns the response headers. |
| 517 */ | 507 */ |
| 518 HttpHeaders get headers(); | 508 HttpHeaders get headers(); |
| 519 | 509 |
| 520 /** | 510 /** |
| 521 * Returns the input stream for the response. This is used to read | 511 * Returns the input stream for the response. This is used to read |
| 522 * the response data. | 512 * the response data. |
| 523 */ | 513 */ |
| 524 InputStream get inputStream(); | 514 InputStream get inputStream(); |
| 525 } | 515 } |
| 526 | 516 |
| 527 | 517 |
| 528 class HttpException implements Exception { | 518 class HttpException implements Exception { |
| 529 const HttpException([String this.message = ""]); | 519 const HttpException([String this.message = ""]); |
| 530 String toString() => "HttpException: $message"; | 520 String toString() => "HttpException: $message"; |
| 531 final String message; | 521 final String message; |
| 532 } | 522 } |
| OLD | NEW |