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 class CacheControlParser final : Tokenizer { 16 public: 17 explicit CacheControlParser(nsACString const &header); 18 19 MOZ_MUST_USE bool MaxAge(uint32_t *seconds); 20 MOZ_MUST_USE bool MaxStale(uint32_t *seconds); 21 MOZ_MUST_USE bool MinFresh(uint32_t *seconds); 22 bool NoCache(); 23 bool NoStore(); 24 25 private: 26 void Directive(); 27 void IgnoreDirective(); 28 MOZ_MUST_USE bool SecondsValue(uint32_t *seconds, uint32_t defaultVal = 0); 29 30 bool mMaxAgeSet; 31 uint32_t mMaxAge; 32 bool mMaxStaleSet; 33 uint32_t mMaxStale; 34 bool mMinFreshSet; 35 uint32_t mMinFresh; 36 bool mNoCache; 37 bool mNoStore; 38 }; 39 40 } // namespace net 41 } // namespace mozilla 42 43 #endif 44