Hi Ryan,
Yes the approach you are doing right now might be the best but doesn't actually cancel the underlying request. We realize that request cancellation is an essential feature and actually have it implemented and read for our 1.5 release at the end of this month.
Basically we have added an optional parameter to the http_client::request methods that takes a cancellation_token. Then you have the ability to attempt to cancel a request at any point in time before it completes.
For now I don't think there is too much more you can do and will just have to wait a few more weeks. Hope this isn't too much of an inconvenience for the next few weeks.
Steve
Yes the approach you are doing right now might be the best but doesn't actually cancel the underlying request. We realize that request cancellation is an essential feature and actually have it implemented and read for our 1.5 release at the end of this month.
Basically we have added an optional parameter to the http_client::request methods that takes a cancellation_token. Then you have the ability to attempt to cancel a request at any point in time before it completes.
/// <summary>
/// Asynchronously sends an HTTP request.
/// </summary>
/// <param name="request">Request to send.</param>
/// <param name="token">Cancellation token for cancellation of this request operation.</param>
/// <returns>An asynchronous operation that is completed once a response from the request is received.</returns>
_ASYNCRTIMP pplx::task<http_response> request(http_request request, pplx::cancellation_token token = pplx::cancellation_token::none());
Once you have this you can then use http_request::set_response_stream to pass in your file stream for maximum efficiency. Then if you want to cancel at any point you can easily do so and no more data will be written to the file.For now I don't think there is too much more you can do and will just have to wait a few more weeks. Hope this isn't too much of an inconvenience for the next few weeks.
Steve