tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CacheControlParser.h (1338B)


      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  [[nodiscard]] bool MaxAge(uint32_t* seconds);
     20  [[nodiscard]] bool MaxStale(uint32_t* seconds);
     21  [[nodiscard]] bool MinFresh(uint32_t* seconds);
     22  [[nodiscard]] bool StaleWhileRevalidate(uint32_t* seconds);
     23  bool NoCache();
     24  bool NoStore();
     25  bool Public();
     26  bool Private();
     27  bool Immutable();
     28 
     29 private:
     30  void Directive();
     31  void IgnoreDirective();
     32  [[nodiscard]] bool SecondsValue(uint32_t* seconds, uint32_t defaultVal = 0);
     33 
     34  bool mMaxAgeSet;
     35  uint32_t mMaxAge;
     36  bool mMaxStaleSet;
     37  uint32_t mMaxStale;
     38  bool mMinFreshSet;
     39  uint32_t mMinFresh;
     40  bool mStaleWhileRevalidateSet;
     41  uint32_t mStaleWhileRevalidate;
     42  bool mNoCache;
     43  bool mNoStore;
     44  bool mPublic;
     45  bool mPrivate;
     46  bool mImmutable;
     47 };
     48 
     49 }  // namespace net
     50 }  // namespace mozilla
     51 
     52 #endif