source: squid-ssl/trunk/fuentes/src/HttpHdrCc.cci @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 1.2 KB
Line 
1/*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 65    HTTP Cache Control Header */
10
11#include "Debug.h"
12#include "defines.h"
13
14bool
15HttpHdrCc::isSet(http_hdr_cc_type id) const
16{
17    assert(id>=CC_PUBLIC && id < CC_ENUM_END);
18    return EBIT_TEST(mask,id);
19}
20
21void
22HttpHdrCc::setMask(http_hdr_cc_type id, bool newval)
23{
24    if (newval)
25        EBIT_SET(mask,id);
26    else
27        EBIT_CLR(mask,id);
28}
29
30/// set a data member to a new value, and set the corresponding mask-bit.
31/// if setting is false, then the mask-bit is cleared.
32void
33HttpHdrCc::setValue(int32_t &value, int32_t new_value, http_hdr_cc_type hdr, bool setting)
34{
35    if (setting) {
36        if (new_value < 0) {
37            debugs(65,3,HERE << "rejecting negative-value Cache-Control directive " << hdr
38                   << " value " << new_value );
39            return;
40        }
41    } else {
42        new_value=-1; //rely on the convention that "unknown" is -1
43    }
44
45    value=new_value;
46    setMask(hdr,setting);
47}
48
Note: See TracBrowser for help on using the repository browser.