From 7e433e7cada4b8b1665a3a0f0dcc225be74cdf20 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 19 Jan 2014 12:03:01 +0100 Subject: [PATCH] FileRequest: set the mime type early. WebKit may use the MIME type during incremental loading, so we better set it before we start feeding the data. --- src/kits/network/libnetapi/FileRequest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kits/network/libnetapi/FileRequest.cpp b/src/kits/network/libnetapi/FileRequest.cpp index 4a3b05c88e..326b1c7e47 100644 --- a/src/kits/network/libnetapi/FileRequest.cpp +++ b/src/kits/network/libnetapi/FileRequest.cpp @@ -57,6 +57,11 @@ BFileRequest::_ProtocolLoop() if (error != B_OK) return error; + BNodeInfo info(&file); + char mimeType[B_MIME_TYPE_LENGTH + 1]; + if (info.GetType(mimeType) == B_OK) + fResult.SetContentType(mimeType); + // Send all notifications to listener, if any if (fListener != NULL) { fListener->ConnectionOpened(this); @@ -77,11 +82,6 @@ BFileRequest::_ProtocolLoop() fListener->DownloadProgress(this, size, size); } - BNodeInfo info(&file); - char mimeType[B_MIME_TYPE_LENGTH + 1]; - if (info.GetType(mimeType) == B_OK) - fResult.SetContentType(mimeType); - return B_OK; }