private async Task <HttpResponseMessage> FinishSendAsyncUnbuffered(
Task <HttpResponseMessage> sendTask,
HttpRequestMessage request,
CancellationTokenSource cts,
bool disposeCts)
{
HttpClient httpClient = this;
HttpResponseMessage httpResponseMessage;
try
{
HttpResponseMessage response = await sendTask.ConfigureAwait(false);
if (response == null)
{
throw new InvalidOperationException(SR.net_http_handler_noresponse);
}
if (NetEventSource.IsEnabled)
{
NetEventSource.ClientSendCompleted(httpClient, response, request);
}
httpResponseMessage = response;
}
catch (Exception ex)
{
httpClient.HandleFinishSendAsyncError(ex, cts);
throw;
}
finally
{
httpClient.HandleFinishSendAsyncCleanup(cts, disposeCts);
}
return(httpResponseMessage);
}