Bug 104307 - [curl] Incorrect stripping of query from file URL
Summary: [curl] Incorrect stripping of query from file URL
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2012-12-06 14:43 PST by Mike Enright
Modified: 2013-05-30 08:12 PDT (History)
4 users (show)

See Also:

proposed patch (1.69 KB, patch)
2013-05-30 06:56 PDT, Peter Gal
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Enright 2012-12-06 14:43:46 PST
CURL: Incorrect stripping of query from file URL:

A URL of 
Turns into 

Before being passed to CURL.

The cause is in ResourceHandleManager.cpp ResourceHandleManager::initializeHandle. When kurl.isLocalFile() is true, the query string is obtained and then:

int queryIndex = url.find(query);
if (queryIndex != -1)
    url = url.left(queryIndex - 1);

The fix is to change the find to reverseFind.

I have seen that the CURL code is not popular, but it is still in SVN. 

I looked briefly for equivalent logic in the Soup code but I didn't find query strings being stripped, just fragment identifiers.
Comment 1 Peter Gal 2013-05-30 06:56:58 PDT
Created attachment 203351 [details]
proposed patch

This is a more robust solution than doing a reverseFind.

For example:

the reverseFind would end up something with:

but with this patch it'll be:
Comment 2 WebKit Commit Bot 2013-05-30 08:12:46 PDT
Comment on attachment 203351 [details]
proposed patch

Clearing flags on attachment: 203351

Committed r150964: <http://trac.webkit.org/changeset/150964>
Comment 3 WebKit Commit Bot 2013-05-30 08:12:48 PDT
All reviewed patches have been landed.  Closing bug.