| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Apple Inc. All Rights Reserved. | 4 * Copyright (C) 2011 Apple Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef HTTPParsers_h | 31 #ifndef HTTPParsers_h |
| 32 #define HTTPParsers_h | 32 #define HTTPParsers_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" |
| 34 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 35 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
| 36 | 37 |
| 37 namespace WebCore { | 38 namespace WebCore { |
| 38 | 39 |
| 39 class HTTPHeaderMap; | 40 class HTTPHeaderMap; |
| 40 class ResourceResponseBase; | 41 class ResourceResponseBase; |
| 41 | 42 |
| 42 typedef enum { | 43 typedef enum { |
| 43 ContentDispositionNone, | 44 ContentDispositionNone, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 62 | 63 |
| 63 // Be sure to update the behavior of XSSAuditor::combineXSSProtectionHeaderAndCS
P whenever you change this enum's content or ordering. | 64 // Be sure to update the behavior of XSSAuditor::combineXSSProtectionHeaderAndCS
P whenever you change this enum's content or ordering. |
| 64 enum ReflectedXSSDisposition { | 65 enum ReflectedXSSDisposition { |
| 65 ReflectedXSSUnset = 0, | 66 ReflectedXSSUnset = 0, |
| 66 AllowReflectedXSS, | 67 AllowReflectedXSS, |
| 67 ReflectedXSSInvalid, | 68 ReflectedXSSInvalid, |
| 68 FilterReflectedXSS, | 69 FilterReflectedXSS, |
| 69 BlockReflectedXSS | 70 BlockReflectedXSS |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 ContentDispositionType contentDispositionType(const String&); | 73 PLATFORM_EXPORT ContentDispositionType contentDispositionType(const String&); |
| 73 bool isValidHTTPHeaderValue(const String&); | 74 PLATFORM_EXPORT bool isValidHTTPHeaderValue(const String&); |
| 74 bool isValidHTTPToken(const String&); | 75 PLATFORM_EXPORT bool isValidHTTPToken(const String&); |
| 75 bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& del
ay, String& url); | 76 PLATFORM_EXPORT bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivM
eta, double& delay, String& url); |
| 76 double parseDate(const String&); | 77 PLATFORM_EXPORT double parseDate(const String&); |
| 77 String filenameFromHTTPContentDisposition(const String&); | 78 PLATFORM_EXPORT String filenameFromHTTPContentDisposition(const String&); |
| 78 String extractMIMETypeFromMediaType(const String&); | 79 PLATFORM_EXPORT String extractMIMETypeFromMediaType(const String&); |
| 79 String extractCharsetFromMediaType(const String&); | 80 PLATFORM_EXPORT String extractCharsetFromMediaType(const String&); |
| 80 void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, u
nsigned int& charsetLen, unsigned int start = 0); | 81 PLATFORM_EXPORT void findCharsetInMediaType(const String& mediaType, unsigned& c
harsetPos, unsigned& charsetLen, unsigned start = 0); |
| 81 ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& f
ailureReason, unsigned& failurePosition, String& reportURL); | 82 PLATFORM_EXPORT ReflectedXSSDisposition parseXSSProtectionHeader(const String& h
eader, String& failureReason, unsigned& failurePosition, String& reportURL); |
| 82 String extractReasonPhraseFromHTTPStatusLine(const String&); | 83 PLATFORM_EXPORT String extractReasonPhraseFromHTTPStatusLine(const String&); |
| 83 XFrameOptionsDisposition parseXFrameOptionsHeader(const String&); | 84 PLATFORM_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&)
; |
| 84 | 85 |
| 85 // -1 could be set to one of the return parameters to indicate the value is not
specified. | 86 // -1 could be set to one of the return parameters to indicate the value is not
specified. |
| 86 bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long
long& rangeSuffixLength); | 87 PLATFORM_EXPORT bool parseRange(const String&, long long& rangeOffset, long long
& rangeEnd, long long& rangeSuffixLength); |
| 87 | 88 |
| 88 ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header
); | 89 PLATFORM_EXPORT ContentTypeOptionsDisposition parseContentTypeOptionsHeader(cons
t String& header); |
| 89 | 90 |
| 90 // Parsing Complete HTTP Messages. | 91 // Parsing Complete HTTP Messages. |
| 91 enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 }; | 92 enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 }; |
| 92 size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReas
on, String& method, String& url, HTTPVersion&); | 93 PLATFORM_EXPORT size_t parseHTTPRequestLine(const char* data, size_t length, Str
ing& failureReason, String& method, String& url, HTTPVersion&); |
| 93 size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, A
tomicString& nameStr, String& valueStr); | 94 PLATFORM_EXPORT size_t parseHTTPHeader(const char* data, size_t length, String&
failureReason, AtomicString& nameStr, String& valueStr); |
| 94 size_t parseHTTPRequestBody(const char* data, size_t length, Vector<unsigned cha
r>& body); | 95 PLATFORM_EXPORT size_t parseHTTPRequestBody(const char* data, size_t length, Vec
tor<unsigned char>& body); |
| 95 | 96 |
| 96 } | 97 } |
| 97 | 98 |
| 98 #endif | 99 #endif |
| OLD | NEW |