| 2349 | |
| 2350 | |
| 2351 | Future<Response> request(const Request& request, bool streamedResponse) |
| 2352 | { |
| 2353 | // We rely on the connection closing after the response. |
| 2354 | CHECK(!request.keepAlive); |
| 2355 | |
| 2356 | return http::connect(request.url) |
| 2357 | .then([=](Connection connection) { |
| 2358 | Future<Response> response = connection.send(request, streamedResponse); |
| 2359 | |
| 2360 | // This is a non Keep-Alive request which means the connection |
| 2361 | // will be closed when the response is received. Since the |
| 2362 | // 'Connection' is reference-counted, we must maintain a copy |
| 2363 | // until the disconnection occurs. |
| 2364 | connection.disconnected() |
| 2365 | .onAny([connection]() {}); |
| 2366 | |
| 2367 | return response; |
| 2368 | }); |
| 2369 | } |
| 2370 | |
| 2371 | |
| 2372 | Future<Response> get( |