void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage) { SoupURI* soupURI = soup_message_get_uri(soupMessage); GOwnPtr<gchar> uri(soup_uri_to_string(soupURI, FALSE)); m_url = KURL(KURL(), String::fromUTF8(uri.get())); m_httpStatusCode = soupMessage->status_code; SoupMessageHeadersIter headersIter; const char* headerName; const char* headerValue; soup_message_headers_iter_init(&headersIter, soupMessage->response_headers); while (soup_message_headers_iter_next(&headersIter, &headerName, &headerValue)) m_httpHeaderFields.set(String::fromUTF8(headerName), String::fromUTF8(headerValue)); m_soupFlags = soup_message_get_flags(soupMessage); String contentType = soup_message_headers_get_one(soupMessage->response_headers, "Content-Type"); setMimeType(extractMIMETypeFromMediaType(contentType)); setTextEncodingName(extractCharsetFromMediaType(contentType)); setExpectedContentLength(soup_message_headers_get_content_length(soupMessage->response_headers)); setHTTPStatusText(soupMessage->reason_phrase); setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition"))); }
void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage) { m_url = soupURIToKURL(soup_message_get_uri(soupMessage)); m_httpStatusCode = soupMessage->status_code; setHTTPStatusText(soupMessage->reason_phrase); m_soupFlags = soup_message_get_flags(soupMessage); GTlsCertificate* certificate = 0; soup_message_get_https_status(soupMessage, &certificate, &m_tlsErrors); m_certificate = certificate; updateFromSoupMessageHeaders(soupMessage->response_headers); }
ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) : ResourceResponse() { setURL(data->m_url); setMimeType(AtomicString(data->m_mimeType)); setExpectedContentLength(data->m_expectedContentLength); setTextEncodingName(AtomicString(data->m_textEncodingName)); setSuggestedFilename(data->m_suggestedFilename); setHTTPStatusCode(data->m_httpStatusCode); setHTTPStatusText(AtomicString(data->m_httpStatusText)); m_httpHeaderFields.adopt(data->m_httpHeaders.release()); setLastModifiedDate(data->m_lastModifiedDate); setResourceLoadTiming(data->m_resourceLoadTiming.release()); m_securityInfo = data->m_securityInfo; m_hasMajorCertificateErrors = data->m_hasMajorCertificateErrors; m_securityStyle = data->m_securityStyle; m_securityDetails.protocol = data->m_securityDetails.protocol; m_securityDetails.cipher = data->m_securityDetails.cipher; m_securityDetails.keyExchange = data->m_securityDetails.keyExchange; m_securityDetails.mac = data->m_securityDetails.mac; m_securityDetails.certID = data->m_securityDetails.certID; m_httpVersion = data->m_httpVersion; m_appCacheID = data->m_appCacheID; m_appCacheManifestURL = data->m_appCacheManifestURL.copy(); m_isMultipartPayload = data->m_isMultipartPayload; m_wasFetchedViaSPDY = data->m_wasFetchedViaSPDY; m_wasNpnNegotiated = data->m_wasNpnNegotiated; m_wasAlternateProtocolAvailable = data->m_wasAlternateProtocolAvailable; m_wasFetchedViaProxy = data->m_wasFetchedViaProxy; m_wasFetchedViaServiceWorker = data->m_wasFetchedViaServiceWorker; m_wasFallbackRequiredByServiceWorker = data->m_wasFallbackRequiredByServiceWorker; m_serviceWorkerResponseType = data->m_serviceWorkerResponseType; m_originalURLViaServiceWorker = data->m_originalURLViaServiceWorker; m_responseTime = data->m_responseTime; m_remoteIPAddress = AtomicString(data->m_remoteIPAddress); m_remotePort = data->m_remotePort; m_downloadedFilePath = data->m_downloadedFilePath; m_downloadedFileHandle = data->m_downloadedFileHandle; // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support // whatever values may be present in the opaque m_extraData structure. }