本文整理汇总了C#中EasyRequest.EnsureResponseMessagePublished方法的典型用法代码示例。如果您正苦于以下问题:C# EasyRequest.EnsureResponseMessagePublished方法的具体用法?C# EasyRequest.EnsureResponseMessagePublished怎么用?C# EasyRequest.EnsureResponseMessagePublished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRequest
的用法示例。
在下文中一共展示了EasyRequest.EnsureResponseMessagePublished方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinishRequest
private void FinishRequest(EasyRequest completedOperation, int messageResult)
{
VerboseTrace("messageResult: " + messageResult, easy: completedOperation);
if (completedOperation._responseMessage.StatusCode != HttpStatusCode.Unauthorized && completedOperation._handler.PreAuthenticate)
{
ulong availedAuth;
if (Interop.libcurl.curl_easy_getinfo(completedOperation._easyHandle, CURLINFO.CURLINFO_HTTPAUTH_AVAIL, out availedAuth) == CURLcode.CURLE_OK)
{
// TODO: fix locking in AddCredentialToCache
completedOperation._handler.AddCredentialToCache(
completedOperation._requestMessage.RequestUri, availedAuth, completedOperation._networkCredential);
}
// Ignore errors: no need to fail for the sake of putting the credentials into the cache
}
switch (messageResult)
{
case CURLcode.CURLE_OK:
completedOperation.EnsureResponseMessagePublished();
break;
default:
completedOperation.FailRequest(CreateHttpRequestException(new CurlException(messageResult, isMulti: false)));
break;
}
// At this point, we've completed processing the entire request, either due to error
// or due to completing the entire response.
completedOperation.Cleanup();
}
示例2: FinishRequest
private void FinishRequest(EasyRequest completedOperation, CURLcode messageResult)
{
VerboseTrace("messageResult: " + messageResult, easy: completedOperation);
if (completedOperation._responseMessage.StatusCode != HttpStatusCode.Unauthorized)
{
if (completedOperation._handler.PreAuthenticate)
{
long authAvailable;
if (Interop.Http.EasyGetInfoLong(completedOperation._easyHandle, CURLINFO.CURLINFO_HTTPAUTH_AVAIL, out authAvailable) == CURLcode.CURLE_OK)
{
completedOperation._handler.AddCredentialToCache(
completedOperation._requestMessage.RequestUri, (CURLAUTH)authAvailable, completedOperation._networkCredential);
}
// Ignore errors: no need to fail for the sake of putting the credentials into the cache
}
completedOperation._handler.AddResponseCookies(
completedOperation._requestMessage.RequestUri, completedOperation._responseMessage);
}
// Complete or fail the request
try
{
bool unsupportedProtocolRedirect = messageResult == CURLcode.CURLE_UNSUPPORTED_PROTOCOL && completedOperation._isRedirect;
if (!unsupportedProtocolRedirect)
{
ThrowIfCURLEError(messageResult);
}
completedOperation.EnsureResponseMessagePublished();
}
catch (Exception exc)
{
completedOperation.FailRequest(exc);
}
// At this point, we've completed processing the entire request, either due to error
// or due to completing the entire response.
completedOperation.Cleanup();
}