summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/network/mac/ResourceHandleMac.mm')
-rw-r--r--Source/WebCore/platform/network/mac/ResourceHandleMac.mm30
1 files changed, 28 insertions, 2 deletions
diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
index 96d561d..b2a89f0 100644
--- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -886,7 +886,7 @@ String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
// Avoid MIME type sniffing if the response comes back as 304 Not Modified.
int statusCode = [r respondsToSelector:@selector(statusCode)] ? [(id)r statusCode] : 0;
if (statusCode != 304)
- [r adjustMIMETypeIfNecessary];
+ adjustMIMETypeIfNecessary([r _CFURLResponse]);
if ([m_handle->firstRequest().nsURLRequest() _propertyForKey:@"ForceHTMLMIMEType"])
[r _setMIMEType:@"text/html"];
@@ -910,9 +910,32 @@ String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
m_handle->client()->didReceiveResponse(m_handle, r);
}
+#if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)
+- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
+{
+ UNUSED_PARAM(connection);
+ LOG(Network, "Handle %p delegate connection:%p didReceiveDataArray:%p arraySize:%d", m_handle, connection, dataArray, [dataArray count]);
+
+ if (!dataArray)
+ return;
+
+ if (!m_handle || !m_handle->client())
+ return;
+
+ if (m_handle->client()->supportsDataArray())
+ m_handle->client()->didReceiveDataArray(m_handle, reinterpret_cast<CFArrayRef>(dataArray));
+ else {
+ for (NSData *data in dataArray)
+ m_handle->client()->didReceiveData(m_handle, static_cast<const char*>([data bytes]), [data length], static_cast<int>([data length]));
+ }
+ return;
+}
+#endif
+
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
{
UNUSED_PARAM(connection);
+ UNUSED_PARAM(lengthReceived);
LOG(Network, "Handle %p delegate connection:%p didReceiveData:%p lengthReceived:%lld", m_handle, connection, data, lengthReceived);
@@ -922,7 +945,10 @@ String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
// However, with today's computers and networking speeds, this won't happen in practice.
// Could be an issue with a giant local file.
CallbackGuard guard;
- m_handle->client()->didReceiveData(m_handle, (const char*)[data bytes], [data length], static_cast<int>(lengthReceived));
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=19793
+ // -1 means we do not provide any data about transfer size to inspector so it would use
+ // Content-Length headers or content size to show transfer size.
+ m_handle->client()->didReceiveData(m_handle, (const char*)[data bytes], [data length], -1);
}
- (void)connection:(NSURLConnection *)connection willStopBufferingData:(NSData *)data