|
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) |