]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/icap/Config.cc
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / adaptation / icap / Config.cc
1 /*
2 * Copyright (C) 1996-2014 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 #include "squid.h"
10 #include "adaptation/icap/Config.h"
11 #include "adaptation/icap/ServiceRep.h"
12 #include "ConfigParser.h"
13 #include "HttpReply.h"
14 #include "HttpRequest.h"
15 #include "SquidConfig.h"
16 #include "Store.h"
17 #include "wordlist.h"
18
19 Adaptation::Icap::Config Adaptation::Icap::TheConfig;
20
21 Adaptation::Icap::Config::Config() :
22 preview_enable(0), preview_size(0), allow206_enable(0),
23 connect_timeout_raw(0), io_timeout_raw(0), reuse_connections(0),
24 client_username_header(NULL), client_username_encode(0), repeat(NULL),
25 repeat_limit(0)
26 {
27 }
28
29 Adaptation::Icap::Config::~Config()
30 {
31 // no need to free client_username_header, it's done in cf_parser.cci:free_all
32 }
33
34 Adaptation::ServicePointer
35 Adaptation::Icap::Config::createService(const ServiceConfigPointer &cfg)
36 {
37 return new Adaptation::Icap::ServiceRep(cfg);
38 }
39
40 time_t Adaptation::Icap::Config::connect_timeout(bool bypassable) const
41 {
42 if (connect_timeout_raw > 0)
43 return connect_timeout_raw; // explicitly configured
44
45 return bypassable ? ::Config.Timeout.peer_connect : ::Config.Timeout.connect;
46 }
47
48 time_t Adaptation::Icap::Config::io_timeout(bool) const
49 {
50 if (io_timeout_raw > 0)
51 return io_timeout_raw; // explicitly configured
52 // TODO: provide a different default for an ICAP transaction that
53 // can still be bypassed
54 return ::Config.Timeout.read;
55 }