Bug 28312 - [CURL] Crash in download handler for local files
Summary: [CURL] Crash in download handler for local files
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: Curl
Depends on:
Blocks:
 
Reported: 2009-08-14 12:39 PDT by Brent Fulgham
Modified: 2009-08-14 16:09 PDT (History)
0 users

See Also:


Attachments
Correct crash due to improper handling of local files. (3.69 KB, patch)
2009-08-14 12:45 PDT, Brent Fulgham
kevino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2009-08-14 12:39:14 PDT
When the CURL backend handle the 'download' of a local file, it does not perform the normal header processing for data received over the network.  This means that the URL is not set properly, and the 'didReceiveResponse' processing is never performed.

This was the cause of an earlier bug in the write callback, as evidenced by the following comment:

    // since the code in headerCallback will not have run for local files
    // the code to set the URL and fire didReceiveResponse is never run,
    // which means the ResourceLoader's response does not contain the URL.
    // Run the code here for local files to resolve the issue.
    // TODO: See if there is a better approach for handling this.

I have resolved the current error in the same fashion, by dealing with this special case and manually firing the 'didReceiveResponse'.  This specialized handling is now in its own function which cleans things up a bit.

The current bug was demonstrated by LayoutTests/fast/encoding/char-encoding-mac.html.
Comment 1 Brent Fulgham 2009-08-14 12:45:49 PDT
Created attachment 34868 [details]
Correct crash due to improper handling of local files.
Comment 2 Brent Fulgham 2009-08-14 13:16:33 PDT
The problem here is actually in the POST handler.  The proper fix seems to be
to add the 'didReceiveResponse' to the readCallback handler.
Comment 3 Brent Fulgham 2009-08-14 15:02:48 PDT
Further testing indicates the original patch actually was correct.
Comment 4 Brent Fulgham 2009-08-14 16:09:10 PDT
Landed in http://trac.webkit.org/changeset/47299.