Changeset 27188 in webkit


Ignore:
Timestamp:
Oct 28, 2007 1:23:11 PM (17 years ago)
Author:
alp
Message:

http://bugs.webkit.org/show_bug.cgi?id=15701
The curl http backend does not deal properly with redirects

Implement http redirect support.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r27187 r27188  
     12007-10-28  Alp Toker  <alp@atoker.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=15701
     6        The curl http backend does not deal properly with redirects
     7
     8        Implement http redirect support.
     9
     10        * platform/network/curl/ResourceHandleManager.cpp:
     11        (WebCore::headerCallback):
     12
    1132007-10-28  Kevin Ollivier  <kevino@theolliviers.com>
    214
  • trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp

    r24372 r27188  
    114114    unsigned int totalSize = size * nmemb;
    115115    ResourceHandleClient* client = d->client();
    116     if (!client) {
    117         return totalSize;
    118     }
    119 
    120    
     116
    121117    String header(static_cast<const char*>(ptr), totalSize);
    122118
     
    145141        d->m_response.setSuggestedFilename(filenameFromHTTPContentDisposition(d->m_response.httpHeaderField("Content-Disposition")));
    146142
    147         client->didReceiveResponse(job, d->m_response);
     143        // HTTP redirection
     144        if (httpCode >= 300 && httpCode < 400) {
     145            String location = d->m_response.httpHeaderField("location");
     146            if (!location.isEmpty()) {
     147                KURL newURL = KURL(job->request().url(), location.deprecatedString());
     148
     149                ResourceRequest redirectedRequest = job->request();
     150                redirectedRequest.setURL(newURL);
     151                if (client)
     152                    client->willSendRequest(job, redirectedRequest, d->m_response);
     153
     154                d->m_request.setURL(newURL);
     155
     156                return totalSize;
     157            }
     158        }
     159
     160        if (client)
     161            client->didReceiveResponse(job, d->m_response);
    148162    } else {
    149163        int splitPos = header.find(":");
Note: See TracChangeset for help on using the changeset viewer.