#ifndef HTTPParsers_h
#define HTTPParsers_h
#include "platform/PlatformExport.h"
#include "wtf/Forward.h"
#include "wtf/Vector.h"
namespace WebCore {
class HTTPHeaderMap;
class ResourceResponseBase;
typedef enum {
ContentDispositionNone,
ContentDispositionInline,
ContentDispositionAttachment,
ContentDispositionOther
} ContentDispositionType;
enum ContentTypeOptionsDisposition {
ContentTypeOptionsNone,
ContentTypeOptionsNosniff
};
enum XFrameOptionsDisposition {
XFrameOptionsNone,
XFrameOptionsDeny,
XFrameOptionsSameOrigin,
XFrameOptionsAllowAll,
XFrameOptionsInvalid,
XFrameOptionsConflict
};
enum ReflectedXSSDisposition {
ReflectedXSSUnset = 0,
AllowReflectedXSS,
ReflectedXSSInvalid,
FilterReflectedXSS,
BlockReflectedXSS
};
PLATFORM_EXPORT ContentDispositionType contentDispositionType(const String&);
PLATFORM_EXPORT bool isValidHTTPHeaderValue(const String&);
PLATFORM_EXPORT bool isValidHTTPToken(const String&);
PLATFORM_EXPORT bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
PLATFORM_EXPORT double parseDate(const String&);
PLATFORM_EXPORT String filenameFromHTTPContentDisposition(const String&);
PLATFORM_EXPORT AtomicString extractMIMETypeFromMediaType(const AtomicString&);
PLATFORM_EXPORT String extractCharsetFromMediaType(const String&);
PLATFORM_EXPORT void findCharsetInMediaType(const String& mediaType, unsigned& charsetPos, unsigned& charsetLen, unsigned start = 0);
PLATFORM_EXPORT ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL);
PLATFORM_EXPORT String extractReasonPhraseFromHTTPStatusLine(const String&);
PLATFORM_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&);
PLATFORM_EXPORT bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
PLATFORM_EXPORT ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header);
enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 };
PLATFORM_EXPORT size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReason, String& method, String& url, HTTPVersion&);
PLATFORM_EXPORT size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, AtomicString& nameStr, AtomicString& valueStr);
PLATFORM_EXPORT size_t parseHTTPRequestBody(const char* data, size_t length, Vector<unsigned char>& body);
}
#endif