Only set ResourceHandlerWrapper values if we plan to continue, if we Cancel they would be ignored

This commit is contained in:
amaitland
2015-06-15 19:03:35 +10:00
parent 63cc978ce6
commit 35d31bd533
+10 -10
View File
@@ -36,16 +36,6 @@ namespace CefSharp
void ResourceHandlerWrapper::ProcessRequestCallback(IResourceHandlerResponse^ response, bool cancel)
{
_mime_type = StringUtils::ToNative(response->MimeType);
_stream = response->ResponseStream;
_statusCode = response->StatusCode;
_statusText = StringUtils::ToNative(response->StatusText);
_redirectUrl = StringUtils::ToNative(response->RedirectUrl);
_contentLength = response->ContentLength;
_closeStream = response->CloseStream;
_headers = TypeConversion::ToNative(response->ResponseHeaders);
// If CEF has canceled the initial request, throw away a response that comes afterwards.
if (_callback != nullptr)
{
@@ -55,6 +45,16 @@ namespace CefSharp
}
else
{
_mime_type = StringUtils::ToNative(response->MimeType);
_stream = response->ResponseStream;
_statusCode = response->StatusCode;
_statusText = StringUtils::ToNative(response->StatusText);
_redirectUrl = StringUtils::ToNative(response->RedirectUrl);
_contentLength = response->ContentLength;
_closeStream = response->CloseStream;
_headers = TypeConversion::ToNative(response->ResponseHeaders);
_callback->Continue();
}
}