]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/icap/Config.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / icap / Config.cc
CommitLineData
774c051c 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
774c051c 3 *
bbc27441
AJ
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.
774c051c 7 */
8
582c2af2 9#include "squid.h"
26cc52cb
AR
10#include "adaptation/icap/Config.h"
11#include "adaptation/icap/ServiceRep.h"
602d9612 12#include "ConfigParser.h"
7514268e 13#include "HttpReply.h"
602d9612 14#include "HttpRequest.h"
4d5904f7 15#include "SquidConfig.h"
602d9612 16#include "Store.h"
c913a563 17#include "wordlist.h"
774c051c 18
26cc52cb 19Adaptation::Icap::Config Adaptation::Icap::TheConfig;
774c051c 20
c9568681 21Adaptation::Icap::Config::Config() :
f53969cc
SM
22 default_options_ttl(0),
23 preview_enable(0), preview_size(0), allow206_enable(0),
24 connect_timeout_raw(0), io_timeout_raw(0), reuse_connections(0),
25 client_username_header(NULL), client_username_encode(0), repeat(NULL),
26 repeat_limit(0)
774c051c 27{
774c051c 28}
29
26cc52cb 30Adaptation::Icap::Config::~Config()
774c051c 31{
c9568681 32 // no need to free client_username_header, it's done in cf_parser.cci:free_all
774c051c 33}
34
64bdef96 35Adaptation::ServicePointer
6666da11 36Adaptation::Icap::Config::createService(const ServiceConfigPointer &cfg)
774c051c 37{
76fc7e57 38 return new Adaptation::Icap::ServiceRep(cfg);
774c051c 39}
ec1245f8 40
26cc52cb 41time_t Adaptation::Icap::Config::connect_timeout(bool bypassable) const
ec1245f8 42{
43 if (connect_timeout_raw > 0)
44 return connect_timeout_raw; // explicitly configured
45
64bdef96 46 return bypassable ? ::Config.Timeout.peer_connect : ::Config.Timeout.connect;
ec1245f8 47}
48
26cc52cb 49time_t Adaptation::Icap::Config::io_timeout(bool) const
ec1245f8 50{
51 if (io_timeout_raw > 0)
52 return io_timeout_raw; // explicitly configured
26ac0430 53 // TODO: provide a different default for an ICAP transaction that
ec1245f8 54 // can still be bypassed
26ac0430 55 return ::Config.Timeout.read;
ee6f6484 56}
f53969cc 57