[webkit-dev] handling location field in curl implementation
Mark Rowe
mrowe at apple.com
Mon Jul 21 08:28:51 PDT 2008
Hi,
Patches should be submitted via Bugzilla at http://bugs.webkit.org/.
See <http://webkit.org/coding/contributing.html> for a little more info.
Kind regards,
Mark
On Jul 21, 2008, at 5:26 AM, Louis JANG wrote:
> Hi everybody,
>
> I'm using webkit with curl and I saw unmatched mime type was passed to
> resourceRequest parameter of
> FrameLoaderClient::dispatchDecidePolicyForMIMEType(). its url was
> "ftp://<ftpserver>/path.zip" and mime type was "text/html". I think
> mimetype should be empty for ftp resonse.
>
> I've investigated and found that the url was set from location
> fileld of
> http response, and the mimetype was set by http response itself.
>
> So, I moved some code not to set mimetype and other if it should
> redirect to other url.
>
> I'm not sure it is proper way to solve this issue. any opinion would
> be
> appreciated.
>
> Thanks in advance,
> Louis JANG
>
> diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp
> b/WebCore/platform/network/curl/ResourceHandleManager.cpp
> index c14bb98..ba047a9 100644
> --- a/WebCore/platform/network/curl/ResourceHandleManager.cpp
> +++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp
> @@ -157,21 +157,8 @@ static size_t headerCallback(char* ptr, size_t
> size, size_t nmemb, void* data)
> CURL* h = d->m_handle;
> CURLcode err;
>
> - double contentLength = 0;
> - err = curl_easy_getinfo(h,
> CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength);
> - d->m_response.setExpectedContentLength(static_cast<long
> long int>(contentLength));
> -
> - const char* hdr;
> - err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr);
> - d->m_response.setUrl(KURL(hdr));
> -
> long httpCode = 0;
> err = curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode);
> - d->m_response.setHTTPStatusCode(httpCode);
> -
> - d->m_response.setMimeType(extractMIMETypeFromMediaType(d-
> >m_response.httpHeaderField("Content-Type")));
> - d-
> >m_response.setTextEncodingName(extractCharsetFromMediaType(d-
> >m_response.httpHeaderField("Content-Type")));
> - d-
> >
> m_response.setSuggestedFilename(filenameFromHTTPContentDisposition(d-
> >m_response.httpHeaderField("Content-Disposition")));
>
> // HTTP redirection
> if (httpCode >= 300 && httpCode < 400) {
> @@ -190,6 +177,19 @@ static size_t headerCallback(char* ptr, size_t
> size, size_t nmemb, void* data)
> }
> }
>
> + double contentLength = 0;
> + err = curl_easy_getinfo(h,
> CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength);
> + d->m_response.setExpectedContentLength(static_cast<long
> long int>(contentLength));
> +
> + const char* hdr;
> + err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr);
> + d->m_response.setUrl(KURL(hdr));
> +
> + d->m_response.setHTTPStatusCode(httpCode);
> + d->m_response.setMimeType(extractMIMETypeFromMediaType(d-
> >m_response.httpHeaderField("Content-Type")));
> + d-
> >m_response.setTextEncodingName(extractCharsetFromMediaType(d-
> >m_response.httpHeaderField("Content-Type")));
> + d-
> >
> m_response.setSuggestedFilename(filenameFromHTTPContentDisposition(d-
> >m_response.httpHeaderField("Content-Disposition")));
> +
> if (client)
> client->didReceiveResponse(job, d->m_response);
> d->m_response.setResponseFired(true);
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
More information about the webkit-dev
mailing list