Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: Source/platform/network/HTTPParsers.h

Issue 229053004: Allow cache reuse of some requests with Cache-Control headers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // 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.
65 enum ReflectedXSSDisposition { 65 enum ReflectedXSSDisposition {
66 ReflectedXSSUnset = 0, 66 ReflectedXSSUnset = 0,
67 AllowReflectedXSS, 67 AllowReflectedXSS,
68 ReflectedXSSInvalid, 68 ReflectedXSSInvalid,
69 FilterReflectedXSS, 69 FilterReflectedXSS,
70 BlockReflectedXSS 70 BlockReflectedXSS
71 }; 71 };
72 72
73 struct CacheControlHeader {
74 bool parsed : 1;
75 bool containsNoCache : 1;
76 bool containsNoStore : 1;
77 bool containsMustRevalidate : 1;
78 double maxAge;
79
80 CacheControlHeader()
81 : parsed(false)
82 , containsNoCache(false)
83 , containsNoStore(false)
84 , containsMustRevalidate(false)
85 , maxAge(0.0)
86 {
87 }
88 };
89
73 PLATFORM_EXPORT ContentDispositionType contentDispositionType(const String&); 90 PLATFORM_EXPORT ContentDispositionType contentDispositionType(const String&);
74 PLATFORM_EXPORT bool isValidHTTPHeaderValue(const String&); 91 PLATFORM_EXPORT bool isValidHTTPHeaderValue(const String&);
75 PLATFORM_EXPORT bool isValidHTTPToken(const String&); 92 PLATFORM_EXPORT bool isValidHTTPToken(const String&);
76 PLATFORM_EXPORT bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivM eta, double& delay, String& url); 93 PLATFORM_EXPORT bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivM eta, double& delay, String& url);
77 PLATFORM_EXPORT double parseDate(const String&); 94 PLATFORM_EXPORT double parseDate(const String&);
78 PLATFORM_EXPORT String filenameFromHTTPContentDisposition(const String&); 95 PLATFORM_EXPORT String filenameFromHTTPContentDisposition(const String&);
79 PLATFORM_EXPORT AtomicString extractMIMETypeFromMediaType(const AtomicString&); 96 PLATFORM_EXPORT AtomicString extractMIMETypeFromMediaType(const AtomicString&);
80 PLATFORM_EXPORT String extractCharsetFromMediaType(const String&); 97 PLATFORM_EXPORT String extractCharsetFromMediaType(const String&);
81 PLATFORM_EXPORT void findCharsetInMediaType(const String& mediaType, unsigned& c harsetPos, unsigned& charsetLen, unsigned start = 0); 98 PLATFORM_EXPORT void findCharsetInMediaType(const String& mediaType, unsigned& c harsetPos, unsigned& charsetLen, unsigned start = 0);
82 PLATFORM_EXPORT ReflectedXSSDisposition parseXSSProtectionHeader(const String& h eader, String& failureReason, unsigned& failurePosition, String& reportURL); 99 PLATFORM_EXPORT ReflectedXSSDisposition parseXSSProtectionHeader(const String& h eader, String& failureReason, unsigned& failurePosition, String& reportURL);
83 PLATFORM_EXPORT String extractReasonPhraseFromHTTPStatusLine(const String&); 100 PLATFORM_EXPORT String extractReasonPhraseFromHTTPStatusLine(const String&);
84 PLATFORM_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&) ; 101 PLATFORM_EXPORT XFrameOptionsDisposition parseXFrameOptionsHeader(const String&) ;
102 PLATFORM_EXPORT CacheControlHeader parseCacheControlDirectives(const AtomicStrin g& cacheControlHeader, const AtomicString& pragmaHeader);
85 103
86 // -1 could be set to one of the return parameters to indicate the value is not specified. 104 // -1 could be set to one of the return parameters to indicate the value is not specified.
87 PLATFORM_EXPORT bool parseRange(const String&, long long& rangeOffset, long long & rangeEnd, long long& rangeSuffixLength); 105 PLATFORM_EXPORT bool parseRange(const String&, long long& rangeOffset, long long & rangeEnd, long long& rangeSuffixLength);
88 106
89 PLATFORM_EXPORT ContentTypeOptionsDisposition parseContentTypeOptionsHeader(cons t String& header); 107 PLATFORM_EXPORT ContentTypeOptionsDisposition parseContentTypeOptionsHeader(cons t String& header);
90 108
91 // Parsing Complete HTTP Messages. 109 // Parsing Complete HTTP Messages.
92 enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 }; 110 enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 };
93 PLATFORM_EXPORT size_t parseHTTPRequestLine(const char* data, size_t length, Str ing& failureReason, String& method, String& url, HTTPVersion&); 111 PLATFORM_EXPORT size_t parseHTTPRequestLine(const char* data, size_t length, Str ing& failureReason, String& method, String& url, HTTPVersion&);
94 PLATFORM_EXPORT size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, AtomicString& nameStr, AtomicString& valueStr); 112 PLATFORM_EXPORT size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, AtomicString& nameStr, AtomicString& valueStr);
95 PLATFORM_EXPORT size_t parseHTTPRequestBody(const char* data, size_t length, Vec tor<unsigned char>& body); 113 PLATFORM_EXPORT size_t parseHTTPRequestBody(const char* data, size_t length, Vec tor<unsigned char>& body);
96 114
97 } 115 }
98 116
99 #endif 117 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698