Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set sw=2 ts=8 et tw=80 : */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef CacheControlParser_h__
8 : #define CacheControlParser_h__
9 :
10 : #include "mozilla/Tokenizer.h"
11 :
12 : namespace mozilla {
13 : namespace net {
14 :
15 10 : class CacheControlParser final : Tokenizer
16 : {
17 : public:
18 : explicit CacheControlParser(nsACString const &header);
19 :
20 : MOZ_MUST_USE bool MaxAge(uint32_t *seconds);
21 : MOZ_MUST_USE bool MaxStale(uint32_t *seconds);
22 : MOZ_MUST_USE bool MinFresh(uint32_t *seconds);
23 : bool NoCache();
24 : bool NoStore();
25 :
26 : private:
27 : void Directive();
28 : void IgnoreDirective();
29 : MOZ_MUST_USE bool SecondsValue(uint32_t *seconds, uint32_t defaultVal = 0);
30 :
31 : bool mMaxAgeSet;
32 : uint32_t mMaxAge;
33 : bool mMaxStaleSet;
34 : uint32_t mMaxStale;
35 : bool mMinFreshSet;
36 : uint32_t mMinFresh;
37 : bool mNoCache;
38 : bool mNoStore;
39 : };
40 :
41 : } // net
42 : } // mozilla
43 :
44 : #endif
|