| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #library("http"); | 5 #library("http"); |
| 6 #source("http_impl.dart"); | 6 #source("http_impl.dart"); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * HTTP status codes. | 9 * HTTP status codes. |
| 10 */ | 10 */ |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * HTTP client factory. | 200 * HTTP client factory. |
| 201 */ | 201 */ |
| 202 interface HTTPClient factory HTTPClientImplementation { | 202 interface HTTPClient factory HTTPClientImplementation { |
| 203 HTTPClient(); | 203 HTTPClient(); |
| 204 | 204 |
| 205 /** | 205 /** |
| 206 * Open a HTTP connection. | 206 * Open a HTTP connection. The [openHandler] is called with an |
| 207 * HTTPClientRequest when the connection has been successfully |
| 208 * opened. |
| 207 */ | 209 */ |
| 208 HTTPClientRequest open(String method, String host, int port, String path); | 210 void open(String method, String host, int port, String path); |
| 209 | 211 |
| 210 /** | 212 /** |
| 211 * Shutdown the HTTP client releasing all resources. | 213 * Shutdown the HTTP client releasing all resources. |
| 212 */ | 214 */ |
| 213 void shutdown(); | 215 void shutdown(); |
| 216 |
| 217 /** |
| 218 * Set the open handler that is called on successful open operations. |
| 219 */ |
| 220 void set openHandler(void handler(HTTPClientRequest request)); |
| 214 } | 221 } |
| 215 | 222 |
| 216 | 223 |
| 217 /** | 224 /** |
| 218 * HTTP request for a client connection. | 225 * HTTP request for a client connection. |
| 219 */ | 226 */ |
| 220 interface HTTPClientRequest factory HTTPClientRequestImplementation { | 227 interface HTTPClientRequest factory HTTPClientRequestImplementation { |
| 221 /** | 228 /** |
| 222 * Gets and sets the content length of the request. If the size of | 229 * Gets and sets the content length of the request. If the size of |
| 223 * the request is not known in advance set content length to -1, | 230 * the request is not known in advance set content length to -1, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } else { | 392 } else { |
| 386 value = queryString.substring(currentPosition, position); | 393 value = queryString.substring(currentPosition, position); |
| 387 currentPosition = position + 1; | 394 currentPosition = position + 1; |
| 388 } | 395 } |
| 389 result[HTTPUtil.decodeUrlEncodedString(name)] = | 396 result[HTTPUtil.decodeUrlEncodedString(name)] = |
| 390 HTTPUtil.decodeUrlEncodedString(value); | 397 HTTPUtil.decodeUrlEncodedString(value); |
| 391 } | 398 } |
| 392 return result; | 399 return result; |
| 393 } | 400 } |
| 394 } | 401 } |
| OLD | NEW |