| Differences between
and this patch
- a/WebCore/ChangeLog +14 lines
Lines 1-3 a/WebCore/ChangeLog_sec1
1
2010-03-30  Dawit Alemayehu  <adawit@kde.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Replaced the 'shouldTreatAsAttachment' function with a more generic 
6
        function that returns the content disposition type.
7
8
        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
9
10
        * platform/network/HTTPParsers.cpp:
11
        (WebCore::contentDispositionType):
12
        * platform/network/HTTPParsers.h:
13
        (WebCore::):
14
1
2010-03-29  Janne Koskinen  <janne.p.koskinen@digia.com>
15
2010-03-29  Janne Koskinen  <janne.p.koskinen@digia.com>
2
16
3
        Reviewed by Simon Hausmann.
17
        Reviewed by Simon Hausmann.
- a/WebCore/platform/network/HTTPParsers.cpp -10 / +8 lines
Lines 72-107 static inline bool skipToken(const String& str, int& pos, const char* token) a/WebCore/platform/network/HTTPParsers.cpp_sec1
72
    return true;
72
    return true;
73
}
73
}
74
74
75
bool shouldTreatAsAttachment(const ResourceResponseBase& response)
75
ContentDispositionType contentDispositionType(const String& contentDisposition)
76
{
76
{   
77
    const String& contentDisposition = response.httpHeaderField("Content-Disposition");
78
    
79
    if (contentDisposition.isEmpty())
77
    if (contentDisposition.isEmpty())
80
        return false;
78
        return ContentDispositionNone;
81
79
82
    // Some broken sites just send
80
    // Some broken sites just send
83
    // Content-Disposition: ; filename="file"
81
    // Content-Disposition: ; filename="file"
84
    // screen those out here.
82
    // screen those out here.
85
    if (contentDisposition.startsWith(";"))
83
    if (contentDisposition.startsWith(";"))
86
        return false;
84
        return ContentDispositionNone;
87
85
88
    if (contentDisposition.startsWith("inline", false))
86
    if (contentDisposition.startsWith("inline", false))
89
        return false;
87
        return ContentDispositionInline;
90
88
91
    // Some broken sites just send
89
    // Some broken sites just send
92
    // Content-Disposition: filename="file"
90
    // Content-Disposition: filename="file"
93
    // without a disposition token... screen those out.
91
    // without a disposition token... screen those out.
94
    if (contentDisposition.startsWith("filename", false))
92
    if (contentDisposition.startsWith("filename", false))
95
        return false;
93
        return ContentDispositionNone;
96
94
97
    // Also in use is Content-Disposition: name="file"
95
    // Also in use is Content-Disposition: name="file"
98
    if (contentDisposition.startsWith("name", false))
96
    if (contentDisposition.startsWith("name", false))
99
        return false;
97
        return ContentDispositionNone;
100
98
101
    // We have a content-disposition of "attachment" or unknown.
99
    // We have a content-disposition of "attachment" or unknown.
102
    // RFC 2183, section 2.8 says that an unknown disposition
100
    // RFC 2183, section 2.8 says that an unknown disposition
103
    // value should be treated as "attachment"
101
    // value should be treated as "attachment"
104
    return true;  
102
    return ContentDispositionAttachment;  
105
}
103
}
106
104
107
bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url)
105
bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url)
- a/WebCore/platform/network/HTTPParsers.h -2 / +8 lines
Lines 41-48 enum XSSProtectionDisposition { a/WebCore/platform/network/HTTPParsers.h_sec1
41
    XSSProtectionBlockEnabled
41
    XSSProtectionBlockEnabled
42
};
42
};
43
43
44
44
typedef enum {
45
bool shouldTreatAsAttachment(const ResourceResponseBase& response);
45
    ContentDispositionNone,
46
    ContentDispositionInline,
47
    ContentDispositionAttachment,
48
    ContentDispositionOther
49
} ContentDispositionType;
50
51
ContentDispositionType contentDispositionType(const String&);
46
bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
52
bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
47
double parseDate(const String&);
53
double parseDate(const String&);
48
String filenameFromHTTPContentDisposition(const String&); 
54
String filenameFromHTTPContentDisposition(const String&); 
- a/WebKit/chromium/ChangeLog +12 lines
Lines 1-3 a/WebKit/chromium/ChangeLog_sec1
1
2010-03-30  Dawit Alemayehu  <adawit@kde.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Updated the WebCore::shouldTreatAsAttachement function call with the
6
        new more generic replacement WebCore::contentDispositionType.
7
8
        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
9
10
        * src/FrameLoaderClientImpl.cpp:
11
        (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType):
12
1
2010-03-29  Dawit Alemayehu  <adawit@kde.org>
13
2010-03-29  Dawit Alemayehu  <adawit@kde.org>
2
14
3
        Reviewed by Simon Hausmann.
15
        Reviewed by Simon Hausmann.
- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp -1 / +1 lines
Lines 843-849 void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType( a/WebKit/chromium/src/FrameLoaderClientImpl.cpp_sec1
843
    if (statusCode == 204 || statusCode == 205) {
843
    if (statusCode == 204 || statusCode == 205) {
844
        // The server does not want us to replace the page contents.
844
        // The server does not want us to replace the page contents.
845
        action = PolicyIgnore;
845
        action = PolicyIgnore;
846
    } else if (WebCore::shouldTreatAsAttachment(response)) {
846
    } else if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) {
847
        // The server wants us to download instead of replacing the page contents.
847
        // The server wants us to download instead of replacing the page contents.
848
        // Downloading is handled by the embedder, but we still get the initial
848
        // Downloading is handled by the embedder, but we still get the initial
849
        // response so that we can ignore it and clean up properly.
849
        // response so that we can ignore it and clean up properly.
- a/WebKit/qt/ChangeLog +12 lines
Lines 1-3 a/WebKit/qt/ChangeLog_sec1
1
2010-03-30  Dawit Alemayehu  <adawit@kde.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Updated the WebCore::shouldTreatAsAttachement function call with the
6
        new more generic replacement WebCore::contentDispositionType.
7
8
        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
9
10
        * WebCoreSupport/FrameLoaderClientQt.cpp:
11
        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType):
12
1
2010-03-26  Kenneth Rohde Christiansen  <kenneth@webkit.org>
13
2010-03-26  Kenneth Rohde Christiansen  <kenneth@webkit.org>
2
14
3
        Reviewed by Antti Koivisto.
15
        Reviewed by Antti Koivisto.
- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp -2 / +3 lines
Lines 967-974 WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage() a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp_sec1
967
void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&)
967
void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&)
968
{
968
{
969
    // we need to call directly here
969
    // we need to call directly here
970
    if (WebCore::shouldTreatAsAttachment(m_frame->loader()->activeDocumentLoader()->response()))
970
    const ResourceResponse& response = m_frame->loader()->activeDocumentLoader()->response();
971
        callPolicyFunction(function, PolicyDownload);    
971
    if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment)
972
        callPolicyFunction(function, PolicyDownload);
972
    else if (canShowMIMEType(MIMEType))
973
    else if (canShowMIMEType(MIMEType))
973
        callPolicyFunction(function, PolicyUse);
974
        callPolicyFunction(function, PolicyUse);
974
    else
975
    else

Return to Bug 36827