Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
static void restartedCallback(SoupMessage* msg, gpointer data)
{
    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
    if (!handle)
        return;
    ResourceHandleInternal* d = handle->getInternal();
    if (d->m_cancelled)
        return;

    GOwnPtr<char> uri(soup_uri_to_string(soup_message_get_uri(msg), false));
    String location = String::fromUTF8(uri.get());
    KURL newURL = KURL(handle->firstRequest().url(), location);

    ResourceRequest request = handle->firstRequest();
    ResourceResponse response;
    request.setURL(newURL);
    request.setHTTPMethod(msg->method);
    fillResponseFromMessage(msg, &response);

    // Should not set Referer after a redirect from a secure resource to non-secure one.
    if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https")) {
        request.clearHTTPReferrer();
        soup_message_headers_remove(msg->request_headers, "Referer");
    }

    if (d->client())
        d->client()->willSendRequest(handle, request, response);

    if (d->m_cancelled)
        return;

    // Update the first party in case the base URL changed with the redirect
    String firstPartyString = request.firstPartyForCookies().string();
    if (!firstPartyString.isEmpty()) {
        GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
        soup_message_set_first_party(d->m_soupMessage.get(), firstParty.get());
    }
}
// Called each time the message is going to be sent again except the first time.
// It's used mostly to let webkit know about redirects.
Called each time the message is going to be sent again except the first time.
It's used mostly to let webkit know about redirects.
Called each time the message is going to be sent again except the first time . It ' s used mostly to let webkit know about redirects .
static void restartedCallback(SoupMessage* msg, gpointer data)
{
    ResourceHandle* handle = static_cast<ResourceHandle*>(data);
    if (!handle)
        return;
    ResourceHandleInternal* d = handle->getInternal();
    if (d->m_cancelled)
        return;
    GOwnPtr<char> uri(soup_uri_to_string(soup_message_get_uri(msg), false));
    String location = String::fromUTF8(uri.get());
    KURL newURL = KURL(handle->firstRequest().url(), location);
    ResourceRequest request = handle->firstRequest();
    ResourceResponse response;
    request.setURL(newURL);
    request.setHTTPMethod(msg->method);
    fillResponseFromMessage(msg, &response);
    if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https")) {
        request.clearHTTPReferrer();
        soup_message_headers_remove(msg->request_headers, "Referer");
    }
    if (d->client())
        d->client()->willSendRequest(handle, request, response);
    if (d->m_cancelled)
        return;
    String firstPartyString = request.firstPartyForCookies().string();
    if (!firstPartyString.isEmpty()) {
        GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
        soup_message_set_first_party(d->m_soupMessage.get(), firstParty.get());
    }
}
static void restartedCallback ( SoupMessage * msg , gpointer data ) { ResourceHandle * handle = static_cast < ResourceHandle * > ( data ) ; if ( ! handle ) return ; ResourceHandleInternal * d = handle -> getInternal ( ) ; if ( d -> m_cancelled ) return ; GOwnPtr < char > uri ( soup_uri_to_string ( soup_message_get_uri ( msg ) , false ) ) ; String location = String :: fromUTF8 ( uri . get ( ) ) ; KURL newURL = KURL ( handle -> firstRequest ( ) . url ( ) , location ) ; ResourceRequest request = handle -> firstRequest ( ) ; ResourceResponse response ; request . setURL ( newURL ) ; request . setHTTPMethod ( msg -> method ) ; fillResponseFromMessage ( msg , & response ) ; if ( ! request . url ( ) . protocolIs ( " " ) && protocolIs ( request . httpReferrer ( ) , " " ) ) { request . clearHTTPReferrer ( ) ; soup_message_headers_remove ( msg -> request_headers , " " ) ; } if ( d -> client ( ) ) d -> client ( ) -> willSendRequest ( handle , request , response ) ; if ( d -> m_cancelled ) return ; String firstPartyString = request . firstPartyForCookies ( ) . string ( ) ; if ( ! firstPartyString . isEmpty ( ) ) { GOwnPtr < SoupURI > firstParty ( soup_uri_new ( firstPartyString . utf8 ( ) . data ( ) ) ) ; soup_message_set_first_party ( d -> m_soupMessage . get ( ) , firstParty . get ( ) ) ; } }
Called each time the message is going to be sent again except the first time.
Called each time the message is going to be sent again except the first time .
// Should not set Referer after a redirect from a secure resource to non-secure one. // Update the first party in case the base URL changed with the redirect