4 * DEBUG: section 3 Configuration File Parsing
5 * AUTHOR: Harvest Derived
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
38 #include "acl/Gadgets.h"
39 #include "acl/MethodData.h"
41 #include "adaptation/Config.h"
44 #include "adaptation/icap/Config.h"
47 #include "adaptation/ecap/Config.h"
49 #include "auth/Config.h"
50 #include "auth/Scheme.h"
51 #include "CacheManager.h"
52 #include "ConfigParser.h"
53 #include "eui/Config.h"
55 #include "esi/Parser.h"
57 #include "HttpRequestMethod.h"
58 #include "ident/Config.h"
59 #include "ip/IpIntercept.h"
60 #include "log/Config.h"
63 #include "ProtoPort.h"
69 #include "StoreFileSystem.h"
79 static void parse_adaptation_service_set_type();
80 static void parse_adaptation_service_chain_type();
81 static void parse_adaptation_access_type();
85 static void parse_icap_service_type(Adaptation::Icap::Config
*);
86 static void dump_icap_service_type(StoreEntry
*, const char *, const Adaptation::Icap::Config
&);
87 static void free_icap_service_type(Adaptation::Icap::Config
*);
88 static void parse_icap_class_type();
89 static void parse_icap_access_type();
93 static void parse_ecap_service_type(Adaptation::Ecap::Config
*);
94 static void dump_ecap_service_type(StoreEntry
*, const char *, const Adaptation::Ecap::Config
&);
95 static void free_ecap_service_type(Adaptation::Ecap::Config
*);
100 static const char *const T_SECOND_STR
= "second";
101 static const char *const T_MINUTE_STR
= "minute";
102 static const char *const T_HOUR_STR
= "hour";
103 static const char *const T_DAY_STR
= "day";
104 static const char *const T_WEEK_STR
= "week";
105 static const char *const T_FORTNIGHT_STR
= "fortnight";
106 static const char *const T_MONTH_STR
= "month";
107 static const char *const T_YEAR_STR
= "year";
108 static const char *const T_DECADE_STR
= "decade";
110 static const char *const B_BYTES_STR
= "bytes";
111 static const char *const B_KBYTES_STR
= "KB";
112 static const char *const B_MBYTES_STR
= "MB";
113 static const char *const B_GBYTES_STR
= "GB";
115 static const char *const list_sep
= ", \t\n\r";
117 static void parse_logformat(logformat
** logformat_definitions
);
118 static void parse_access_log(customlog
** customlog_definitions
);
119 static int check_null_access_log(customlog
*customlog_definitions
);
121 static void dump_logformat(StoreEntry
* entry
, const char *name
, logformat
* definitions
);
122 static void dump_access_log(StoreEntry
* entry
, const char *name
, customlog
* definitions
);
123 static void free_logformat(logformat
** definitions
);
124 static void free_access_log(customlog
** definitions
);
126 static void update_maxobjsize(void);
127 static void configDoConfigure(void);
128 static void parse_refreshpattern(refresh_t
**);
129 static int parseTimeUnits(const char *unit
);
130 static void parseTimeLine(time_t * tptr
, const char *units
);
131 static void parse_ushort(u_short
* var
);
132 static void parse_string(char **);
133 static void default_all(void);
134 static void defaults_if_none(void);
135 static int parse_line(char *);
136 static void parseBytesLine(size_t * bptr
, const char *units
);
137 static size_t parseBytesUnits(const char *unit
);
138 static void free_all(void);
139 void requirePathnameExists(const char *name
, const char *path
);
140 static OBJH dump_config
;
142 static void dump_http_header_access(StoreEntry
* entry
, const char *name
, header_mangler header
[]);
143 static void parse_http_header_access(header_mangler header
[]);
144 static void free_http_header_access(header_mangler header
[]);
145 static void dump_http_header_replace(StoreEntry
* entry
, const char *name
, header_mangler header
[]);
146 static void parse_http_header_replace(header_mangler
* header
);
147 static void free_http_header_replace(header_mangler
* header
);
149 static void parse_denyinfo(acl_deny_info_list
** var
);
150 static void dump_denyinfo(StoreEntry
* entry
, const char *name
, acl_deny_info_list
* var
);
151 static void free_denyinfo(acl_deny_info_list
** var
);
154 static void parse_IpAddress_list(IpAddress_list
**);
155 static void dump_IpAddress_list(StoreEntry
*, const char *, const IpAddress_list
*);
156 static void free_IpAddress_list(IpAddress_list
**);
158 static int check_null_IpAddress_list(const IpAddress_list
*);
159 #endif /* CURRENTLY_UNUSED */
160 #endif /* USE_WCCPv2 */
162 static void parse_http_port_list(http_port_list
**);
163 static void dump_http_port_list(StoreEntry
*, const char *, const http_port_list
*);
164 static void free_http_port_list(http_port_list
**);
167 static void parse_https_port_list(https_port_list
**);
168 static void dump_https_port_list(StoreEntry
*, const char *, const https_port_list
*);
169 static void free_https_port_list(https_port_list
**);
171 static int check_null_https_port_list(const https_port_list
*);
175 static void parse_b_size_t(size_t * var
);
176 static void parse_b_int64_t(int64_t * var
);
178 static int parseOneConfigFile(const char *file_name
, unsigned int depth
);
181 * LegacyParser is a parser for legacy code that uses the global
182 * approach. This is static so that it is only exposed to cache_cf.
183 * Other modules needing access to a ConfigParser should have it
184 * provided to them in their parserFOO methods.
186 static ConfigParser LegacyParser
= ConfigParser();
191 LegacyParser
.destruct();
195 update_maxobjsize(void)
200 for (i
= 0; i
< Config
.cacheSwap
.n_configured
; i
++) {
201 assert (Config
.cacheSwap
.swapDirs
[i
].getRaw());
203 if (dynamic_cast<SwapDir
*>(Config
.cacheSwap
.swapDirs
[i
].getRaw())->
205 ms
= dynamic_cast<SwapDir
*>(Config
.cacheSwap
.swapDirs
[i
].getRaw())->max_objsize
;
207 store_maxobjsize
= ms
;
211 SetConfigFilename(char const *file_name
, bool is_pipe
)
213 cfg_filename
= file_name
;
218 cfg_filename
= file_name
+ 1;
219 else if ((token
= strrchr(cfg_filename
, '/')))
220 cfg_filename
= token
+ 1;
224 skip_ws(const char* s
)
233 parseManyConfigFiles(char* files
, int depth
)
236 char* saveptr
= NULL
;
241 memset(&globbuf
, 0, sizeof(globbuf
));
242 for (path
= strwordtok(files
, &saveptr
); path
; path
= strwordtok(NULL
, &saveptr
)) {
243 if (glob(path
, globbuf
.gl_pathc
? GLOB_APPEND
: 0, NULL
, &globbuf
) != 0) {
244 fatalf("Unable to find configuration file: %s: %s",
248 for (i
= 0; i
< (int)globbuf
.gl_pathc
; i
++) {
249 error_count
+= parseOneConfigFile(globbuf
.gl_pathv
[i
], depth
);
253 char* file
= strwordtok(files
, &saveptr
);
254 while (file
!= NULL
) {
255 error_count
+= parseOneConfigFile(file
, depth
);
256 file
= strwordtok(NULL
, &saveptr
);
258 #endif /* HAVE_GLOB */
263 ReplaceSubstr(char*& str
, int& len
, unsigned substrIdx
, unsigned substrLen
, const char* newSubstr
)
266 assert(newSubstr
!= NULL
);
268 unsigned newSubstrLen
= strlen(newSubstr
);
269 if (newSubstrLen
> substrLen
)
270 str
= (char*)realloc(str
, len
- substrLen
+ newSubstrLen
+ 1);
272 // move tail part including zero
273 memmove(str
+ substrIdx
+ newSubstrLen
, str
+ substrIdx
+ substrLen
, len
- substrIdx
- substrLen
+ 1);
274 // copy new substring in place
275 memcpy(str
+ substrIdx
, newSubstr
, newSubstrLen
);
281 SubstituteMacro(char*& line
, int& len
, const char* macroName
, const char* substStr
)
283 assert(line
!= NULL
);
284 assert(macroName
!= NULL
);
285 assert(substStr
!= NULL
);
286 unsigned macroNameLen
= strlen(macroName
);
287 while (const char* macroPos
= strstr(line
, macroName
)) // we would replace all occurrences
288 ReplaceSubstr(line
, len
, macroPos
- line
, macroNameLen
, substStr
);
292 ProcessMacros(char*& line
, int& len
)
294 SubstituteMacro(line
, len
, "${process_name}", KidName
);
295 SubstituteMacro(line
, len
, "${process_number}", xitoa(KidIdentifier
));
299 trim_trailing_ws(char* str
)
302 unsigned i
= strlen(str
);
303 while ((i
> 0) && xisspace(str
[i
- 1]))
309 FindStatement(const char* line
, const char* statement
)
311 assert(line
!= NULL
);
312 assert(statement
!= NULL
);
314 const char* str
= skip_ws(line
);
315 unsigned len
= strlen(statement
);
316 if (strncmp(str
, statement
, len
) == 0) {
320 else if (xisspace(*str
))
328 StrToInt(const char* str
, long& number
)
333 number
= strtol(str
, &end
, 0);
335 return (end
!= str
) && (*end
== '\0'); // returns true if string contains nothing except number
339 EvalBoolExpr(const char* expr
)
341 assert(expr
!= NULL
);
342 if (strcmp(expr
, "true") == 0) {
344 } else if (strcmp(expr
, "false") == 0) {
346 } else if (const char* equation
= strchr(expr
, '=')) {
347 const char* rvalue
= skip_ws(equation
+ 1);
348 char* lvalue
= (char*)xmalloc(equation
- expr
+ 1);
349 xstrncpy(lvalue
, expr
, equation
- expr
+ 1);
350 trim_trailing_ws(lvalue
);
353 if (!StrToInt(lvalue
, number1
))
354 fatalf("String is not a integer number: '%s'\n", lvalue
);
356 if (!StrToInt(rvalue
, number2
))
357 fatalf("String is not a integer number: '%s'\n", rvalue
);
360 return number1
== number2
;
362 fatalf("Unable to evaluate expression '%s'\n", expr
);
363 return false; // this place cannot be reached
367 parseOneConfigFile(const char *file_name
, unsigned int depth
)
370 const char *orig_cfg_filename
= cfg_filename
;
371 const int orig_config_lineno
= config_lineno
;
373 char *tmp_line
= NULL
;
374 int tmp_line_len
= 0;
378 debugs(3, 1, "Processing Configuration File: " << file_name
<< " (depth " << depth
<< ")");
380 fatalf("WARNING: can't include %s: includes are nested too deeply (>16)!\n", file_name
);
384 if (file_name
[0] == '!' || file_name
[0] == '|') {
385 fp
= popen(file_name
+ 1, "r");
388 fp
= fopen(file_name
, "r");
392 fatalf("Unable to open configuration file: %s: %s", file_name
, xstrerror());
396 setmode(fileno(fp
), O_TEXT
);
400 SetConfigFilename(file_name
, bool(is_pipe
));
402 memset(config_input_line
, '\0', BUFSIZ
);
406 Vector
<bool> if_states
;
407 while (fgets(config_input_line
, BUFSIZ
, fp
)) {
410 if ((token
= strchr(config_input_line
, '\n')))
413 if ((token
= strchr(config_input_line
, '\r')))
416 if (strncmp(config_input_line
, "#line ", 6) == 0) {
417 static char new_file_name
[1024];
419 static char new_lineno
;
420 token
= config_input_line
+ 6;
421 new_lineno
= strtol(token
, &file
, 0) - 1;
424 continue; /* Not a valid #line directive, may be a comment */
426 while (*file
&& xisspace((unsigned char) *file
))
431 continue; /* Not a valid #line directive, may be a comment */
433 xstrncpy(new_file_name
, file
+ 1, sizeof(new_file_name
));
435 if ((token
= strchr(new_file_name
, '"')))
438 cfg_filename
= new_file_name
;
441 config_lineno
= new_lineno
;
444 if (config_input_line
[0] == '#')
447 if (config_input_line
[0] == '\0')
450 const char* append
= tmp_line_len
? skip_ws(config_input_line
) : config_input_line
;
452 size_t append_len
= strlen(append
);
454 tmp_line
= (char*)xrealloc(tmp_line
, tmp_line_len
+ append_len
+ 1);
456 strcpy(tmp_line
+ tmp_line_len
, append
);
458 tmp_line_len
+= append_len
;
460 if (tmp_line
[tmp_line_len
-1] == '\\') {
461 debugs(3, 5, "parseConfigFile: tmp_line='" << tmp_line
<< "'");
462 tmp_line
[--tmp_line_len
] = '\0';
466 trim_trailing_ws(tmp_line
);
467 ProcessMacros(tmp_line
, tmp_line_len
);
468 debugs(3, 5, "Processing: '" << tmp_line
<< "'");
470 if (const char* expr
= FindStatement(tmp_line
, "if")) {
471 if_states
.push_back(EvalBoolExpr(expr
)); // store last if-statement meaning
472 } else if (FindStatement(tmp_line
, "endif")) {
473 if (!if_states
.empty())
474 if_states
.pop_back(); // remove last if-statement meaning
476 fatalf("'endif' without 'if'\n");
477 } else if (FindStatement(tmp_line
, "else")) {
478 if (!if_states
.empty())
479 if_states
.back() = !if_states
.back();
481 fatalf("'else' without 'if'\n");
482 } else if (if_states
.empty() || if_states
.back()) { // test last if-statement meaning if present
483 /* Handle includes here */
484 if (tmp_line_len
>= 9 && strncmp(tmp_line
, "include", 7) == 0 && xisspace(tmp_line
[7])) {
485 err_count
+= parseManyConfigFiles(tmp_line
+ 8, depth
+ 1);
486 } else if (!parse_line(tmp_line
)) {
487 debugs(3, 0, HERE
<< cfg_filename
<< ":" << config_lineno
<< " unrecognized: '" << tmp_line
<< "'");
496 if (!if_states
.empty())
497 fatalf("if-statement without 'endif'\n");
500 int ret
= pclose(fp
);
503 fatalf("parseConfigFile: '%s' failed with exit code %d\n", file_name
, ret
);
508 cfg_filename
= orig_cfg_filename
;
509 config_lineno
= orig_config_lineno
;
515 parseConfigFile(const char *file_name
)
518 CacheManager
*manager
=CacheManager::GetInstance();
522 ACLMethodData::ThePurgeCount
= 0;
525 err_count
= parseOneConfigFile(file_name
, 0);
530 * We must call configDoConfigure() before leave_suid() because
531 * configDoConfigure() is where we turn username strings into
536 if (!Config
.chroot_dir
) {
538 setUmask(Config
.umask
);
539 _db_init(Debug::cache_log
, Debug::debugOptions
);
543 if (opt_send_signal
== -1) {
544 manager
->registerAction("config",
545 "Current Squid Configuration",
555 configDoConfigure(void)
557 memset(&Config2
, '\0', sizeof(SquidConfig2
));
558 /* init memory as early as possible */
562 if (Config
.cacheSwap
.swapDirs
== NULL
) {
563 /* Memory-only cache probably in effect. */
564 /* turn off the cache rebuild delays... */
565 StoreController::store_dirs_rebuilding
= 0;
568 if (Debug::rotateNumber
< 0) {
569 Debug::rotateNumber
= Config
.Log
.rotateNumber
;
572 #if SIZEOF_OFF_T <= 4
573 if (Config
.Store
.maxObjectSize
> 0x7FFF0000) {
574 debugs(3, 0, "WARNING: This Squid binary can not handle files larger than 2GB. Limiting maximum_object_size to just below 2GB");
575 Config
.Store
.maxObjectSize
= 0x7FFF0000;
578 if (0 == Store::Root().maxSize())
579 /* people might want a zero-sized cache on purpose */
581 else if (Store::Root().maxSize() < (Config
.memMaxSize
>> 10))
582 /* This is bogus. folk with NULL caches will want this */
583 debugs(3, 0, "WARNING cache_mem is larger than total disk cache space!");
585 if (Config
.Announce
.period
> 0) {
586 Config
.onoff
.announce
= 1;
587 } else if (Config
.Announce
.period
< 1) {
588 Config
.Announce
.period
= 86400 * 365; /* one year */
589 Config
.onoff
.announce
= 0;
592 if (Config
.onoff
.httpd_suppress_version_string
)
593 visible_appname_string
= (char *)appname_string
;
595 visible_appname_string
= (char const *)APP_FULLNAME
;
599 if (Config
.dnsChildren
.n_max
< 1)
600 fatal("No dnsservers allocated");
604 if (Config
.Program
.redirect
) {
605 if (Config
.redirectChildren
.n_max
< 1) {
606 Config
.redirectChildren
.n_max
= 0;
607 wordlistDestroy(&Config
.Program
.redirect
);
611 if (Config
.appendDomain
)
612 if (*Config
.appendDomain
!= '.')
613 fatal("append_domain must begin with a '.'");
615 if (Config
.errHtmlText
== NULL
)
616 Config
.errHtmlText
= xstrdup(null_string
);
620 snprintf(ThisCache
, sizeof(ThisCache
), "%s (%s)",
622 visible_appname_string
);
625 * the extra space is for loop detection in client_side.c -- we search
626 * for substrings in the Via header.
628 snprintf(ThisCache2
, sizeof(ThisCache
), " %s (%s)",
630 visible_appname_string
);
632 if (!Config
.udpMaxHitObjsz
|| Config
.udpMaxHitObjsz
> SQUID_UDP_SO_SNDBUF
)
633 Config
.udpMaxHitObjsz
= SQUID_UDP_SO_SNDBUF
;
635 if (Config
.appendDomain
)
636 Config
.appendDomainLen
= strlen(Config
.appendDomain
);
638 Config
.appendDomainLen
= 0;
640 if (Config
.retry
.maxtries
> 10)
641 fatal("maximum_single_addr_tries cannot be larger than 10");
643 if (Config
.retry
.maxtries
< 1) {
644 debugs(3, 0, "WARNING: resetting 'maximum_single_addr_tries to 1");
645 Config
.retry
.maxtries
= 1;
648 requirePathnameExists("MIME Config Table", Config
.mimeTablePathname
);
651 requirePathnameExists("cache_dns_program", Config
.Program
.dnsserver
);
655 requirePathnameExists("unlinkd_program", Config
.Program
.unlinkd
);
657 requirePathnameExists("logfile_daemon", Log::TheConfig
.logfile_daemon
);
658 if (Config
.Program
.redirect
)
659 requirePathnameExists("redirect_program", Config
.Program
.redirect
->key
);
661 requirePathnameExists("Icon Directory", Config
.icons
.directory
);
663 if (Config
.errorDirectory
)
664 requirePathnameExists("Error Directory", Config
.errorDirectory
);
671 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
672 if (!R
->flags
.override_expire
)
675 debugs(22, 1, "WARNING: use of 'override-expire' in 'refresh_pattern' violates HTTP");
680 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
681 if (!R
->flags
.override_lastmod
)
684 debugs(22, 1, "WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP");
689 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
690 if (!R
->flags
.reload_into_ims
)
693 debugs(22, 1, "WARNING: use of 'reload-into-ims' in 'refresh_pattern' violates HTTP");
698 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
699 if (!R
->flags
.ignore_reload
)
702 debugs(22, 1, "WARNING: use of 'ignore-reload' in 'refresh_pattern' violates HTTP");
707 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
708 if (!R
->flags
.ignore_no_cache
)
711 debugs(22, 1, "WARNING: use of 'ignore-no-cache' in 'refresh_pattern' violates HTTP");
716 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
717 if (!R
->flags
.ignore_no_store
)
720 debugs(22, 1, "WARNING: use of 'ignore-no-store' in 'refresh_pattern' violates HTTP");
725 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
726 if (!R
->flags
.ignore_must_revalidate
)
728 debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP");
732 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
733 if (!R
->flags
.ignore_private
)
736 debugs(22, 1, "WARNING: use of 'ignore-private' in 'refresh_pattern' violates HTTP");
741 for (R
= Config
.Refresh
; R
; R
= R
->next
) {
742 if (!R
->flags
.ignore_auth
)
745 debugs(22, 1, "WARNING: use of 'ignore-auth' in 'refresh_pattern' violates HTTP");
753 Config
.onoff
.via
= 1;
756 if (!Config
.onoff
.via
)
757 debugs(22, 1, "WARNING: HTTP requires the use of Via");
761 // we enable runtime PURGE checks if there is at least one PURGE method ACL
762 // TODO: replace with a dedicated "purge" ACL option?
763 Config2
.onoff
.enable_purge
= (ACLMethodData::ThePurgeCount
> 0);
765 Config2
.onoff
.mangle_request_headers
= httpReqHdrManglersConfigured();
767 if (geteuid() == 0) {
768 if (NULL
!= Config
.effectiveUser
) {
770 struct passwd
*pwd
= getpwnam(Config
.effectiveUser
);
774 * Andres Kroonmaa <andre@online.ee>:
775 * Some getpwnam() implementations (Solaris?) require
776 * an available FD < 256 for opening a FILE* to the
779 * This should be safe at startup, but might still fail
780 * during reconfigure.
782 fatalf("getpwnam failed to find userid for effective user '%s'",
783 Config
.effectiveUser
);
787 Config2
.effectiveUserID
= pwd
->pw_uid
;
789 Config2
.effectiveGroupID
= pwd
->pw_gid
;
793 if (pwd
->pw_dir
&& *pwd
->pw_dir
) {
795 char *env_str
= (char *)xcalloc((len
= strlen(pwd
->pw_dir
) + 6), 1);
796 snprintf(env_str
, len
, "HOME=%s", pwd
->pw_dir
);
804 Config2
.effectiveUserID
= geteuid();
805 Config2
.effectiveGroupID
= getegid();
808 if (NULL
!= Config
.effectiveGroup
) {
810 struct group
*grp
= getgrnam(Config
.effectiveGroup
);
813 fatalf("getgrnam failed to find groupid for effective group '%s'",
814 Config
.effectiveGroup
);
818 Config2
.effectiveGroupID
= grp
->gr_gid
;
821 HttpRequestMethod::Configure(Config
);
824 debugs(3, 1, "Initializing https proxy context");
826 Config
.ssl_client
.sslContext
= sslCreateClientContext(Config
.ssl_client
.cert
, Config
.ssl_client
.key
, Config
.ssl_client
.version
, Config
.ssl_client
.cipher
, Config
.ssl_client
.options
, Config
.ssl_client
.flags
, Config
.ssl_client
.cafile
, Config
.ssl_client
.capath
, Config
.ssl_client
.crlfile
);
832 for (p
= Config
.peers
; p
!= NULL
; p
= p
->next
) {
834 debugs(3, 1, "Initializing cache_peer " << p
->name
<< " SSL context");
835 p
->sslContext
= sslCreateClientContext(p
->sslcert
, p
->sslkey
, p
->sslversion
, p
->sslcipher
, p
->ssloptions
, p
->sslflags
, p
->sslcafile
, p
->sslcapath
, p
->sslcrlfile
);
844 for (s
= Config
.Sockaddr
.http
; s
!= NULL
; s
= (http_port_list
*) s
->next
) {
845 if (!s
->cert
&& !s
->key
)
848 debugs(3, 1, "Initializing http_port " << s
->http
.s
<< " SSL context");
850 s
->sslContext
= sslCreateServerContext(s
->cert
, s
->key
, s
->version
, s
->cipher
, s
->options
, s
->sslflags
, s
->clientca
, s
->cafile
, s
->capath
, s
->crlfile
, s
->dhfile
, s
->sslcontext
);
858 for (s
= Config
.Sockaddr
.https
; s
!= NULL
; s
= (https_port_list
*) s
->http
.next
) {
859 debugs(3, 1, "Initializing https_port " << s
->http
.s
<< " SSL context");
861 s
->sslContext
= sslCreateServerContext(s
->cert
, s
->key
, s
->version
, s
->cipher
, s
->options
, s
->sslflags
, s
->clientca
, s
->cafile
, s
->capath
, s
->crlfile
, s
->dhfile
, s
->sslcontext
);
868 /* Parse a time specification from the config file. Store the
869 * result in 'tptr', after converting it to 'units' */
871 parseTimeLine(time_t * tptr
, const char *units
)
878 if ((u
= parseTimeUnits(units
)) == 0)
881 if ((token
= strtok(NULL
, w_space
)) == NULL
)
886 m
= u
; /* default to 'units' if none specified */
890 else if ((token
= strtok(NULL
, w_space
)) == NULL
)
891 debugs(3, 0, "WARNING: No units on '" <<
892 config_input_line
<< "', assuming " <<
894 else if ((m
= parseTimeUnits(token
)) == 0)
897 *tptr
= static_cast<time_t> (m
* d
/ u
);
901 parseTimeUnits(const char *unit
)
903 if (!strncasecmp(unit
, T_SECOND_STR
, strlen(T_SECOND_STR
)))
906 if (!strncasecmp(unit
, T_MINUTE_STR
, strlen(T_MINUTE_STR
)))
909 if (!strncasecmp(unit
, T_HOUR_STR
, strlen(T_HOUR_STR
)))
912 if (!strncasecmp(unit
, T_DAY_STR
, strlen(T_DAY_STR
)))
915 if (!strncasecmp(unit
, T_WEEK_STR
, strlen(T_WEEK_STR
)))
918 if (!strncasecmp(unit
, T_FORTNIGHT_STR
, strlen(T_FORTNIGHT_STR
)))
921 if (!strncasecmp(unit
, T_MONTH_STR
, strlen(T_MONTH_STR
)))
924 if (!strncasecmp(unit
, T_YEAR_STR
, strlen(T_YEAR_STR
)))
925 return static_cast<int>(86400 * 365.2522);
927 if (!strncasecmp(unit
, T_DECADE_STR
, strlen(T_DECADE_STR
)))
928 return static_cast<int>(86400 * 365.2522 * 10);
930 debugs(3, 1, "parseTimeUnits: unknown time unit '" << unit
<< "'");
936 parseBytesLine64(int64_t * bptr
, const char *units
)
943 if ((u
= parseBytesUnits(units
)) == 0) {
948 if ((token
= strtok(NULL
, w_space
)) == NULL
) {
953 if (strcmp(token
, "none") == 0 || strcmp(token
, "-1") == 0) {
960 m
= u
; /* default to 'units' if none specified */
964 else if ((token
= strtok(NULL
, w_space
)) == NULL
)
965 debugs(3, 0, "WARNING: No units on '" <<
966 config_input_line
<< "', assuming " <<
968 else if ((m
= parseBytesUnits(token
)) == 0) {
973 *bptr
= static_cast<int64_t>(m
* d
/ u
);
975 if (static_cast<double>(*bptr
) * 2 != m
* d
/ u
* 2)
981 parseBytesLine(size_t * bptr
, const char *units
)
988 if ((u
= parseBytesUnits(units
)) == 0) {
993 if ((token
= strtok(NULL
, w_space
)) == NULL
) {
998 if (strcmp(token
, "none") == 0 || strcmp(token
, "-1") == 0) {
999 *bptr
= static_cast<size_t>(-1);
1005 m
= u
; /* default to 'units' if none specified */
1009 else if ((token
= strtok(NULL
, w_space
)) == NULL
)
1010 debugs(3, 0, "WARNING: No units on '" <<
1011 config_input_line
<< "', assuming " <<
1012 d
<< " " << units
);
1013 else if ((m
= parseBytesUnits(token
)) == 0) {
1018 *bptr
= static_cast<size_t>(m
* d
/ u
);
1020 if (static_cast<double>(*bptr
) * 2 != m
* d
/ u
* 2)
1025 parseBytesUnits(const char *unit
)
1027 if (!strncasecmp(unit
, B_BYTES_STR
, strlen(B_BYTES_STR
)))
1030 if (!strncasecmp(unit
, B_KBYTES_STR
, strlen(B_KBYTES_STR
)))
1033 if (!strncasecmp(unit
, B_MBYTES_STR
, strlen(B_MBYTES_STR
)))
1036 if (!strncasecmp(unit
, B_GBYTES_STR
, strlen(B_GBYTES_STR
)))
1039 debugs(3, DBG_CRITICAL
, "WARNING: Unknown bytes unit '" << unit
<< "'");
1044 /*****************************************************************************
1046 *****************************************************************************/
1049 dump_acl(StoreEntry
* entry
, const char *name
, ACL
* ae
)
1054 while (ae
!= NULL
) {
1055 debugs(3, 3, "dump_acl: " << name
<< " " << ae
->name
);
1056 storeAppendPrintf(entry
, "%s %s %s ",
1063 debugs(3, 3, "dump_acl: " << name
<< " " << ae
->name
<< " " << v
->key
);
1064 storeAppendPrintf(entry
, "%s ", v
->key
);
1068 storeAppendPrintf(entry
, "\n");
1069 wordlistDestroy(&w
);
1075 parse_acl(ACL
** ae
)
1077 ACL::ParseAclLine(LegacyParser
, ae
);
1087 dump_acl_list(StoreEntry
* entry
, ACLList
* head
)
1091 for (l
= head
; l
; l
= l
->next
) {
1092 storeAppendPrintf(entry
, " %s%s",
1093 l
->op
? null_string
: "!",
1099 dump_acl_access(StoreEntry
* entry
, const char *name
, acl_access
* head
)
1103 for (l
= head
; l
; l
= l
->next
) {
1104 storeAppendPrintf(entry
, "%s %s",
1106 l
->allow
? "Allow" : "Deny");
1107 dump_acl_list(entry
, l
->aclList
);
1108 storeAppendPrintf(entry
, "\n");
1113 parse_acl_access(acl_access
** head
)
1115 aclParseAccessLine(LegacyParser
, head
);
1119 free_acl_access(acl_access
** head
)
1121 aclDestroyAccessList(head
);
1125 dump_address(StoreEntry
* entry
, const char *name
, IpAddress
&addr
)
1127 char buf
[MAX_IPSTRLEN
];
1128 storeAppendPrintf(entry
, "%s %s\n", name
, addr
.NtoA(buf
,MAX_IPSTRLEN
) );
1132 parse_address(IpAddress
*addr
)
1134 char *token
= strtok(NULL
, w_space
);
1141 if (!strcmp(token
,"any_addr")) {
1144 } else if ( (!strcmp(token
,"no_addr")) || (!strcmp(token
,"full_mask")) ) {
1152 free_address(IpAddress
*addr
)
1157 CBDATA_TYPE(acl_address
);
1160 dump_acl_address(StoreEntry
* entry
, const char *name
, acl_address
* head
)
1162 char buf
[MAX_IPSTRLEN
];
1165 for (l
= head
; l
; l
= l
->next
) {
1166 if (!l
->addr
.IsAnyAddr())
1167 storeAppendPrintf(entry
, "%s %s", name
, l
->addr
.NtoA(buf
,MAX_IPSTRLEN
));
1169 storeAppendPrintf(entry
, "%s autoselect", name
);
1171 dump_acl_list(entry
, l
->aclList
);
1173 storeAppendPrintf(entry
, "\n");
1178 freed_acl_address(void *data
)
1180 acl_address
*l
= static_cast<acl_address
*>(data
);
1181 aclDestroyAclList(&l
->aclList
);
1185 parse_acl_address(acl_address
** head
)
1188 acl_address
**tail
= head
; /* sane name below */
1189 CBDATA_INIT_TYPE_FREECB(acl_address
, freed_acl_address
);
1190 l
= cbdataAlloc(acl_address
);
1191 parse_address(&l
->addr
);
1192 aclParseAclList(LegacyParser
, &l
->aclList
);
1195 tail
= &(*tail
)->next
;
1201 free_acl_address(acl_address
** head
)
1204 acl_address
*l
= *head
;
1210 CBDATA_TYPE(acl_tos
);
1213 dump_acl_tos(StoreEntry
* entry
, const char *name
, acl_tos
* head
)
1217 for (l
= head
; l
; l
= l
->next
) {
1219 storeAppendPrintf(entry
, "%s 0x%02X", name
, l
->tos
);
1221 storeAppendPrintf(entry
, "%s none", name
);
1223 dump_acl_list(entry
, l
->aclList
);
1225 storeAppendPrintf(entry
, "\n");
1230 freed_acl_tos(void *data
)
1232 acl_tos
*l
= static_cast<acl_tos
*>(data
);
1233 aclDestroyAclList(&l
->aclList
);
1237 parse_acl_tos(acl_tos
** head
)
1240 acl_tos
**tail
= head
; /* sane name below */
1243 char *token
= strtok(NULL
, w_space
);
1250 if (sscanf(token
, "0x%x%c", &tos
, &junk
) != 1) {
1255 if (tos
< 0 || tos
> 255) {
1260 CBDATA_INIT_TYPE_FREECB(acl_tos
, freed_acl_tos
);
1262 l
= cbdataAlloc(acl_tos
);
1266 aclParseAclList(LegacyParser
, &l
->aclList
);
1269 tail
= &(*tail
)->next
;
1275 free_acl_tos(acl_tos
** head
)
1285 CBDATA_TYPE(acl_size_t
);
1288 dump_acl_b_size_t(StoreEntry
* entry
, const char *name
, acl_size_t
* head
)
1292 for (l
= head
; l
; l
= l
->next
) {
1294 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) l
->size
, B_BYTES_STR
);
1296 storeAppendPrintf(entry
, "%s none", name
);
1298 dump_acl_list(entry
, l
->aclList
);
1300 storeAppendPrintf(entry
, "\n");
1305 freed_acl_b_size_t(void *data
)
1307 acl_size_t
*l
= static_cast<acl_size_t
*>(data
);
1308 aclDestroyAclList(&l
->aclList
);
1312 parse_acl_b_size_t(acl_size_t
** head
)
1315 acl_size_t
**tail
= head
; /* sane name below */
1317 CBDATA_INIT_TYPE_FREECB(acl_size_t
, freed_acl_b_size_t
);
1319 l
= cbdataAlloc(acl_size_t
);
1321 parse_b_int64_t(&l
->size
);
1323 aclParseAclList(LegacyParser
, &l
->aclList
);
1326 tail
= &(*tail
)->next
;
1332 free_acl_b_size_t(acl_size_t
** head
)
1335 acl_size_t
*l
= *head
;
1344 #include "DelayPools.h"
1345 #include "DelayConfig.h"
1346 /* do nothing - free_delay_pool_count is the magic free function.
1347 * this is why delay_pool_count isn't just marked TYPE: ushort
1349 #define free_delay_pool_class(X)
1350 #define free_delay_pool_access(X)
1351 #define free_delay_pool_rates(X)
1352 #define dump_delay_pool_class(X, Y, Z)
1353 #define dump_delay_pool_access(X, Y, Z)
1354 #define dump_delay_pool_rates(X, Y, Z)
1357 free_delay_pool_count(DelayConfig
* cfg
)
1359 cfg
->freePoolCount();
1363 dump_delay_pool_count(StoreEntry
* entry
, const char *name
, DelayConfig
&cfg
)
1365 cfg
.dumpPoolCount (entry
, name
);
1369 parse_delay_pool_count(DelayConfig
* cfg
)
1371 cfg
->parsePoolCount();
1375 parse_delay_pool_class(DelayConfig
* cfg
)
1377 cfg
->parsePoolClass();
1381 parse_delay_pool_rates(DelayConfig
* cfg
)
1383 cfg
->parsePoolRates();
1387 parse_delay_pool_access(DelayConfig
* cfg
)
1389 cfg
->parsePoolAccess(LegacyParser
);
1396 dump_http_header_access(StoreEntry
* entry
, const char *name
, header_mangler header
[])
1400 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1401 if (header
[i
].access_list
!= NULL
) {
1402 storeAppendPrintf(entry
, "%s ", name
);
1403 dump_acl_access(entry
, httpHeaderNameById(i
),
1404 header
[i
].access_list
);
1410 parse_http_header_access(header_mangler header
[])
1415 if ((t
= strtok(NULL
, w_space
)) == NULL
) {
1416 debugs(3, 0, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
1417 debugs(3, 0, "parse_http_header_access: missing header name.");
1421 /* Now lookup index of header. */
1422 id
= httpHeaderIdByNameDef(t
, strlen(t
));
1424 if (strcmp(t
, "All") == 0)
1426 else if (strcmp(t
, "Other") == 0)
1428 else if (id
== -1) {
1429 debugs(3, 0, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
1430 debugs(3, 0, "parse_http_header_access: unknown header name '" << t
<< "'");
1434 if (id
!= HDR_ENUM_END
) {
1435 parse_acl_access(&header
[id
].access_list
);
1437 char *next_string
= t
+ strlen(t
) - 1;
1439 *(next_string
+ 1) = ' ';
1441 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1442 char *new_string
= xstrdup(next_string
);
1443 strtok(new_string
, w_space
);
1444 parse_acl_access(&header
[i
].access_list
);
1445 safe_free(new_string
);
1451 free_http_header_access(header_mangler header
[])
1455 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1456 free_acl_access(&header
[i
].access_list
);
1461 dump_http_header_replace(StoreEntry
* entry
, const char *name
, header_mangler
1466 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1467 if (NULL
== header
[i
].replacement
)
1470 storeAppendPrintf(entry
, "%s %s %s\n", name
, httpHeaderNameById(i
),
1471 header
[i
].replacement
);
1476 parse_http_header_replace(header_mangler header
[])
1481 if ((t
= strtok(NULL
, w_space
)) == NULL
) {
1482 debugs(3, 0, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
1483 debugs(3, 0, "parse_http_header_replace: missing header name.");
1487 /* Now lookup index of header. */
1488 id
= httpHeaderIdByNameDef(t
, strlen(t
));
1490 if (strcmp(t
, "All") == 0)
1492 else if (strcmp(t
, "Other") == 0)
1494 else if (id
== -1) {
1495 debugs(3, 0, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
1496 debugs(3, 0, "parse_http_header_replace: unknown header name " << t
<< ".");
1501 if (id
!= HDR_ENUM_END
) {
1502 if (header
[id
].replacement
!= NULL
)
1503 safe_free(header
[id
].replacement
);
1505 header
[id
].replacement
= xstrdup(t
+ strlen(t
) + 1);
1507 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1508 if (header
[i
].replacement
!= NULL
)
1509 safe_free(header
[i
].replacement
);
1511 header
[i
].replacement
= xstrdup(t
+ strlen(t
) + 1);
1517 free_http_header_replace(header_mangler header
[])
1521 for (i
= 0; i
< HDR_ENUM_END
; i
++) {
1522 if (header
[i
].replacement
!= NULL
)
1523 safe_free(header
[i
].replacement
);
1530 dump_cachedir(StoreEntry
* entry
, const char *name
, SquidConfig::_cacheSwap swap
)
1536 for (i
= 0; i
< swap
.n_configured
; i
++) {
1537 s
= dynamic_cast<SwapDir
*>(swap
.swapDirs
[i
].getRaw());
1539 storeAppendPrintf(entry
, "%s %s %s", name
, s
->type(), s
->path
);
1541 storeAppendPrintf(entry
, "\n");
1546 check_null_string(char *s
)
1552 parse_authparam(authConfig
* config
)
1557 if ((type_str
= strtok(NULL
, w_space
)) == NULL
)
1560 if ((param_str
= strtok(NULL
, w_space
)) == NULL
)
1563 /* find a configuration for the scheme */
1564 AuthConfig
*scheme
= AuthConfig::Find (type_str
);
1566 if (scheme
== NULL
) {
1567 /* Create a configuration */
1568 AuthScheme
*theScheme
;
1570 if ((theScheme
= AuthScheme::Find(type_str
)) == NULL
) {
1571 debugs(3, 0, "Parsing Config File: Unknown authentication scheme '" << type_str
<< "'.");
1575 config
->push_back(theScheme
->createConfig());
1576 scheme
= config
->back();
1580 scheme
->parse(scheme
, config
->size(), param_str
);
1584 free_authparam(authConfig
* cfg
)
1587 /* DON'T FREE THESE FOR RECONFIGURE */
1592 while (cfg
->size()) {
1593 scheme
= cfg
->pop_back();
1599 dump_authparam(StoreEntry
* entry
, const char *name
, authConfig cfg
)
1601 for (authConfig::iterator i
= cfg
.begin(); i
!= cfg
.end(); ++i
)
1602 (*i
)->dump(entry
, name
, (*i
));
1605 /* TODO: just return the object, the # is irrelevant */
1607 find_fstype(char *type
)
1609 for (size_t i
= 0; i
< StoreFileSystem::FileSystems().size(); ++i
)
1610 if (strcasecmp(type
, StoreFileSystem::FileSystems().items
[i
]->type()) == 0)
1617 parse_cachedir(SquidConfig::_cacheSwap
* swap
)
1621 RefCount
<SwapDir
> sd
;
1625 if ((type_str
= strtok(NULL
, w_space
)) == NULL
)
1628 if ((path_str
= strtok(NULL
, w_space
)) == NULL
)
1631 fs
= find_fstype(type_str
);
1636 /* reconfigure existing dir */
1638 for (i
= 0; i
< swap
->n_configured
; i
++) {
1639 assert (swap
->swapDirs
[i
].getRaw());
1641 if ((strcasecmp(path_str
, dynamic_cast<SwapDir
*>(swap
->swapDirs
[i
].getRaw())->path
)) == 0) {
1642 /* this is specific to on-fs Stores. The right
1643 * way to handle this is probably to have a mapping
1644 * from paths to stores, and have on-fs stores
1645 * register with that, and lookip in that in their
1646 * own setup logic. RBC 20041225. TODO.
1649 sd
= dynamic_cast<SwapDir
*>(swap
->swapDirs
[i
].getRaw());
1651 if (sd
->type() != StoreFileSystem::FileSystems().items
[fs
]->type()) {
1652 debugs(3, 0, "ERROR: Can't change type of existing cache_dir " <<
1653 sd
->type() << " " << sd
->path
<< " to " << type_str
<< ". Restart required");
1657 sd
->reconfigure (i
, path_str
);
1659 update_maxobjsize();
1666 if (swap
->n_configured
> 63) {
1667 /* 7 bits, signed */
1668 debugs(3, DBG_CRITICAL
, "WARNING: There is a fixed maximum of 63 cache_dir entries Squid can handle.");
1669 debugs(3, DBG_CRITICAL
, "WARNING: '" << path_str
<< "' is one to many.");
1674 allocate_new_swapdir(swap
);
1676 swap
->swapDirs
[swap
->n_configured
] = StoreFileSystem::FileSystems().items
[fs
]->createSwapDir();
1678 sd
= dynamic_cast<SwapDir
*>(swap
->swapDirs
[swap
->n_configured
].getRaw());
1680 /* parse the FS parameters and options */
1681 sd
->parse(swap
->n_configured
, path_str
);
1683 ++swap
->n_configured
;
1685 /* Update the max object size */
1686 update_maxobjsize();
1690 peer_type_str(const peer_t type
)
1692 const char * result
;
1704 case PEER_MULTICAST
:
1705 result
= "multicast";
1717 dump_peer(StoreEntry
* entry
, const char *name
, peer
* p
)
1721 LOCAL_ARRAY(char, xname
, 128);
1724 storeAppendPrintf(entry
, "%s %s %s %d %d name=%s",
1731 dump_peer_options(entry
, p
);
1733 for (d
= p
->peer_domain
; d
; d
= d
->next
) {
1734 storeAppendPrintf(entry
, "cache_peer_domain %s %s%s\n",
1736 d
->do_ping
? null_string
: "!",
1741 snprintf(xname
, 128, "cache_peer_access %s", p
->name
);
1742 dump_acl_access(entry
, xname
, p
->access
);
1745 for (t
= p
->typelist
; t
; t
= t
->next
) {
1746 storeAppendPrintf(entry
, "neighbor_type_domain %s %s %s\n",
1748 peer_type_str(t
->type
),
1757 * utility function to prevent getservbyname() being called with a numeric value
1758 * on Windows at least it returns garage results.
1761 isUnsignedNumeric(const char *str
, size_t len
)
1763 if (len
< 1) return false;
1765 for (; len
>0 && *str
; str
++, len
--) {
1766 if (! isdigit(*str
))
1773 \param proto 'tcp' or 'udp' for protocol
1774 \returns Port the named service is supposed to be listening on.
1777 GetService(const char *proto
)
1779 struct servent
*port
= NULL
;
1780 /** Parses a port number or service name from the squid.conf */
1781 char *token
= strtok(NULL
, w_space
);
1782 if (token
== NULL
) {
1784 return 0; /* NEVER REACHED */
1786 /** Returns either the service port number from /etc/services */
1787 if ( !isUnsignedNumeric(token
, strlen(token
)) )
1788 port
= getservbyname(token
, proto
);
1790 return ntohs((u_short
)port
->s_port
);
1792 /** Or a numeric translation of the config text. */
1793 return xatos(token
);
1797 \returns Port the named TCP service is supposed to be listening on.
1798 \copydoc GetService(const char *proto)
1803 return GetService("tcp");
1807 \returns Port the named UDP service is supposed to be listening on.
1808 \copydoc GetService(const char *proto)
1813 return GetService("udp");
1817 parse_peer(peer
** head
)
1821 CBDATA_INIT_TYPE_FREECB(peer
, peerDestroy
);
1822 p
= cbdataAlloc(peer
);
1823 p
->http_port
= CACHE_HTTP_PORT
;
1824 p
->icp
.port
= CACHE_ICP_PORT
;
1827 p
->stats
.logged_state
= PEER_ALIVE
;
1829 if ((token
= strtok(NULL
, w_space
)) == NULL
)
1832 p
->host
= xstrdup(token
);
1834 p
->name
= xstrdup(token
);
1836 if ((token
= strtok(NULL
, w_space
)) == NULL
)
1839 p
->type
= parseNeighborType(token
);
1841 if (p
->type
== PEER_MULTICAST
) {
1842 p
->options
.no_digest
= 1;
1843 p
->options
.no_netdb_exchange
= 1;
1846 p
->http_port
= GetTcpService();
1851 p
->icp
.port
= GetUdpService();
1852 p
->connection_auth
= 2; /* auto */
1854 while ((token
= strtok(NULL
, w_space
))) {
1855 if (!strcasecmp(token
, "proxy-only")) {
1856 p
->options
.proxy_only
= 1;
1857 } else if (!strcasecmp(token
, "no-query")) {
1858 p
->options
.no_query
= 1;
1859 } else if (!strcasecmp(token
, "background-ping")) {
1860 p
->options
.background_ping
= 1;
1861 } else if (!strcasecmp(token
, "no-digest")) {
1862 p
->options
.no_digest
= 1;
1863 } else if (!strcasecmp(token
, "no-tproxy")) {
1864 p
->options
.no_tproxy
= 1;
1865 } else if (!strcasecmp(token
, "multicast-responder")) {
1866 p
->options
.mcast_responder
= 1;
1867 #if PEER_MULTICAST_SIBLINGS
1868 } else if (!strcasecmp(token
, "multicast-siblings")) {
1869 p
->options
.mcast_siblings
= 1;
1871 } else if (!strncasecmp(token
, "weight=", 7)) {
1872 p
->weight
= xatoi(token
+ 7);
1873 } else if (!strncasecmp(token
, "basetime=", 9)) {
1874 p
->basetime
= xatoi(token
+ 9);
1875 } else if (!strcasecmp(token
, "closest-only")) {
1876 p
->options
.closest_only
= 1;
1877 } else if (!strncasecmp(token
, "ttl=", 4)) {
1878 p
->mcast
.ttl
= xatoi(token
+ 4);
1880 if (p
->mcast
.ttl
< 0)
1883 if (p
->mcast
.ttl
> 128)
1885 } else if (!strcasecmp(token
, "default")) {
1886 p
->options
.default_parent
= 1;
1887 } else if (!strcasecmp(token
, "round-robin")) {
1888 p
->options
.roundrobin
= 1;
1889 } else if (!strcasecmp(token
, "weighted-round-robin")) {
1890 p
->options
.weighted_roundrobin
= 1;
1893 } else if (!strcasecmp(token
, "htcp")) {
1894 p
->options
.htcp
= 1;
1895 } else if (!strcasecmp(token
, "htcp-oldsquid")) {
1896 p
->options
.htcp
= 1;
1897 p
->options
.htcp_oldsquid
= 1;
1898 } else if (!strcasecmp(token
, "htcp-no-clr")) {
1899 if (p
->options
.htcp_only_clr
)
1900 fatalf("parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously");
1901 p
->options
.htcp
= 1;
1902 p
->options
.htcp_no_clr
= 1;
1903 } else if (!strcasecmp(token
, "htcp-no-purge-clr")) {
1904 p
->options
.htcp
= 1;
1905 p
->options
.htcp_no_purge_clr
= 1;
1906 } else if (!strcasecmp(token
, "htcp-only-clr")) {
1907 if (p
->options
.htcp_no_clr
)
1908 fatalf("parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously");
1909 p
->options
.htcp
= 1;
1910 p
->options
.htcp_only_clr
= 1;
1911 } else if (!strcasecmp(token
, "htcp-forward-clr")) {
1912 p
->options
.htcp
= 1;
1913 p
->options
.htcp_forward_clr
= 1;
1916 } else if (!strcasecmp(token
, "no-netdb-exchange")) {
1917 p
->options
.no_netdb_exchange
= 1;
1919 } else if (!strcasecmp(token
, "carp")) {
1920 if (p
->type
!= PEER_PARENT
)
1921 fatalf("parse_peer: non-parent carp peer %s/%d\n", p
->host
, p
->http_port
);
1923 p
->options
.carp
= 1;
1925 } else if (!strcasecmp(token
, "userhash")) {
1926 if (p
->type
!= PEER_PARENT
)
1927 fatalf("parse_peer: non-parent userhash peer %s/%d\n", p
->host
, p
->http_port
);
1929 p
->options
.userhash
= 1;
1931 } else if (!strcasecmp(token
, "sourcehash")) {
1932 if (p
->type
!= PEER_PARENT
)
1933 fatalf("parse_peer: non-parent sourcehash peer %s/%d\n", p
->host
, p
->http_port
);
1935 p
->options
.sourcehash
= 1;
1939 } else if (!strcasecmp(token
, "no-delay")) {
1940 p
->options
.no_delay
= 1;
1943 } else if (!strncasecmp(token
, "login=", 6)) {
1944 p
->login
= xstrdup(token
+ 6);
1945 rfc1738_unescape(p
->login
);
1946 } else if (!strncasecmp(token
, "connect-timeout=", 16)) {
1947 p
->connect_timeout
= xatoi(token
+ 16);
1948 } else if (!strncasecmp(token
, "connect-fail-limit=", 19)) {
1949 p
->connect_fail_limit
= xatoi(token
+ 19);
1950 #if USE_CACHE_DIGESTS
1951 } else if (!strncasecmp(token
, "digest-url=", 11)) {
1952 p
->digest_url
= xstrdup(token
+ 11);
1955 } else if (!strcasecmp(token
, "allow-miss")) {
1956 p
->options
.allow_miss
= 1;
1957 } else if (!strncasecmp(token
, "max-conn=", 9)) {
1958 p
->max_conn
= xatoi(token
+ 9);
1959 } else if (!strcasecmp(token
, "originserver")) {
1960 p
->options
.originserver
= 1;
1961 } else if (!strncasecmp(token
, "name=", 5)) {
1965 p
->name
= xstrdup(token
+ 5);
1966 } else if (!strncasecmp(token
, "forceddomain=", 13)) {
1967 safe_free(p
->domain
);
1970 p
->domain
= xstrdup(token
+ 13);
1974 } else if (strcmp(token
, "ssl") == 0) {
1976 } else if (strncmp(token
, "sslcert=", 8) == 0) {
1977 safe_free(p
->sslcert
);
1978 p
->sslcert
= xstrdup(token
+ 8);
1979 } else if (strncmp(token
, "sslkey=", 7) == 0) {
1980 safe_free(p
->sslkey
);
1981 p
->sslkey
= xstrdup(token
+ 7);
1982 } else if (strncmp(token
, "sslversion=", 11) == 0) {
1983 p
->sslversion
= atoi(token
+ 11);
1984 } else if (strncmp(token
, "ssloptions=", 11) == 0) {
1985 safe_free(p
->ssloptions
);
1986 p
->ssloptions
= xstrdup(token
+ 11);
1987 } else if (strncmp(token
, "sslcipher=", 10) == 0) {
1988 safe_free(p
->sslcipher
);
1989 p
->sslcipher
= xstrdup(token
+ 10);
1990 } else if (strncmp(token
, "sslcafile=", 10) == 0) {
1991 safe_free(p
->sslcafile
);
1992 p
->sslcafile
= xstrdup(token
+ 10);
1993 } else if (strncmp(token
, "sslcapath=", 10) == 0) {
1994 safe_free(p
->sslcapath
);
1995 p
->sslcapath
= xstrdup(token
+ 10);
1996 } else if (strncmp(token
, "sslcrlfile=", 11) == 0) {
1997 safe_free(p
->sslcrlfile
);
1998 p
->sslcapath
= xstrdup(token
+ 10);
1999 } else if (strncmp(token
, "sslflags=", 9) == 0) {
2000 safe_free(p
->sslflags
);
2001 p
->sslflags
= xstrdup(token
+ 9);
2002 } else if (strncmp(token
, "ssldomain=", 10) == 0) {
2003 safe_free(p
->ssldomain
);
2004 p
->ssldomain
= xstrdup(token
+ 10);
2007 } else if (strcmp(token
, "front-end-https") == 0) {
2008 p
->front_end_https
= 1;
2009 } else if (strcmp(token
, "front-end-https=on") == 0) {
2010 p
->front_end_https
= 1;
2011 } else if (strcmp(token
, "front-end-https=auto") == 0) {
2012 p
->front_end_https
= 2;
2013 } else if (strcmp(token
, "connection-auth=off") == 0) {
2014 p
->connection_auth
= 0;
2015 } else if (strcmp(token
, "connection-auth") == 0) {
2016 p
->connection_auth
= 1;
2017 } else if (strcmp(token
, "connection-auth=on") == 0) {
2018 p
->connection_auth
= 1;
2019 } else if (strcmp(token
, "connection-auth=auto") == 0) {
2020 p
->connection_auth
= 2;
2022 debugs(3, 0, "parse_peer: token='" << token
<< "'");
2027 if (peerFindByName(p
->name
))
2028 fatalf("ERROR: cache_peer %s specified twice\n", p
->name
);
2033 if (p
->connect_fail_limit
< 1)
2034 p
->connect_fail_limit
= 10;
2036 p
->icp
.version
= ICP_VERSION_CURRENT
;
2040 #if USE_CACHE_DIGESTS
2042 if (!p
->options
.no_digest
) {
2043 /* XXX This looks odd.. who has the original pointer
2046 PeerDigest
*pd
= peerDigestCreate(p
);
2047 p
->digest
= cbdataReference(pd
);
2052 p
->index
= ++Config
.npeers
;
2054 while (*head
!= NULL
)
2055 head
= &(*head
)->next
;
2063 free_peer(peer
** P
)
2067 while ((p
= *P
) != NULL
) {
2069 #if USE_CACHE_DIGESTS
2071 cbdataReferenceDone(p
->digest
);
2081 dump_cachemgrpasswd(StoreEntry
* entry
, const char *name
, cachemgr_passwd
* list
)
2085 while (list
!= NULL
) {
2086 if (strcmp(list
->passwd
, "none") && strcmp(list
->passwd
, "disable"))
2087 storeAppendPrintf(entry
, "%s XXXXXXXXXX", name
);
2089 storeAppendPrintf(entry
, "%s %s", name
, list
->passwd
);
2091 for (w
= list
->actions
; w
!= NULL
; w
= w
->next
) {
2092 storeAppendPrintf(entry
, " %s", w
->key
);
2095 storeAppendPrintf(entry
, "\n");
2101 parse_cachemgrpasswd(cachemgr_passwd
** head
)
2103 char *passwd
= NULL
;
2104 wordlist
*actions
= NULL
;
2106 cachemgr_passwd
**P
;
2107 parse_string(&passwd
);
2108 parse_wordlist(&actions
);
2109 p
= static_cast<cachemgr_passwd
*>(xcalloc(1, sizeof(cachemgr_passwd
)));
2111 p
->actions
= actions
;
2113 for (P
= head
; *P
; P
= &(*P
)->next
) {
2115 * See if any of the actions from this line already have a
2116 * password from previous lines. The password checking
2117 * routines in cache_manager.c take the the password from
2118 * the first cachemgr_passwd struct that contains the
2119 * requested action. Thus, we should warn users who might
2120 * think they can have two passwords for the same action.
2125 for (w
= (*P
)->actions
; w
; w
= w
->next
) {
2126 for (u
= actions
; u
; u
= u
->next
) {
2127 if (strcmp(w
->key
, u
->key
))
2130 debugs(0, 0, "WARNING: action '" << u
->key
<< "' (line " << config_lineno
<< ") already has a password");
2139 free_cachemgrpasswd(cachemgr_passwd
** head
)
2143 while ((p
= *head
) != NULL
) {
2146 wordlistDestroy(&p
->actions
);
2152 dump_denyinfo(StoreEntry
* entry
, const char *name
, acl_deny_info_list
* var
)
2156 while (var
!= NULL
) {
2157 storeAppendPrintf(entry
, "%s %s", name
, var
->err_page_name
);
2159 for (a
= var
->acl_list
; a
!= NULL
; a
= a
->next
)
2160 storeAppendPrintf(entry
, " %s", a
->name
);
2162 storeAppendPrintf(entry
, "\n");
2169 parse_denyinfo(acl_deny_info_list
** var
)
2171 aclParseDenyInfoLine(var
);
2175 free_denyinfo(acl_deny_info_list
** list
)
2177 acl_deny_info_list
*a
= NULL
;
2178 acl_deny_info_list
*a_next
= NULL
;
2179 acl_name_list
*l
= NULL
;
2180 acl_name_list
*l_next
= NULL
;
2182 for (a
= *list
; a
; a
= a_next
) {
2183 for (l
= a
->acl_list
; l
; l
= l_next
) {
2185 memFree(l
, MEM_ACL_NAME_LIST
);
2190 memFree(a
, MEM_ACL_DENY_INFO_LIST
);
2198 parse_peer_access(void)
2203 if (!(host
= strtok(NULL
, w_space
)))
2206 if ((p
= peerFindByName(host
)) == NULL
) {
2207 debugs(15, 0, "" << cfg_filename
<< ", line " << config_lineno
<< ": No cache_peer '" << host
<< "'");
2211 aclParseAccessLine(LegacyParser
, &p
->access
);
2215 parse_hostdomain(void)
2218 char *domain
= NULL
;
2220 if (!(host
= strtok(NULL
, w_space
)))
2223 while ((domain
= strtok(NULL
, list_sep
))) {
2224 domain_ping
*l
= NULL
;
2225 domain_ping
**L
= NULL
;
2228 if ((p
= peerFindByName(host
)) == NULL
) {
2229 debugs(15, 0, "" << cfg_filename
<< ", line " << config_lineno
<< ": No cache_peer '" << host
<< "'");
2233 l
= static_cast<domain_ping
*>(xcalloc(1, sizeof(domain_ping
)));
2236 if (*domain
== '!') { /* check for !.edu */
2241 l
->domain
= xstrdup(domain
);
2243 for (L
= &(p
->peer_domain
); *L
; L
= &((*L
)->next
));
2249 parse_hostdomaintype(void)
2253 char *domain
= NULL
;
2255 if (!(host
= strtok(NULL
, w_space
)))
2258 if (!(type
= strtok(NULL
, w_space
)))
2261 while ((domain
= strtok(NULL
, list_sep
))) {
2262 domain_type
*l
= NULL
;
2263 domain_type
**L
= NULL
;
2266 if ((p
= peerFindByName(host
)) == NULL
) {
2267 debugs(15, 0, "" << cfg_filename
<< ", line " << config_lineno
<< ": No cache_peer '" << host
<< "'");
2271 l
= static_cast<domain_type
*>(xcalloc(1, sizeof(domain_type
)));
2272 l
->type
= parseNeighborType(type
);
2273 l
->domain
= xstrdup(domain
);
2275 for (L
= &(p
->typelist
); *L
; L
= &((*L
)->next
));
2281 dump_int(StoreEntry
* entry
, const char *name
, int var
)
2283 storeAppendPrintf(entry
, "%s %d\n", name
, var
);
2301 dump_onoff(StoreEntry
* entry
, const char *name
, int var
)
2303 storeAppendPrintf(entry
, "%s %s\n", name
, var
? "on" : "off");
2307 parse_onoff(int *var
)
2309 char *token
= strtok(NULL
, w_space
);
2314 if (!strcasecmp(token
, "on") || !strcasecmp(token
, "enable"))
2320 #define free_onoff free_int
2323 dump_tristate(StoreEntry
* entry
, const char *name
, int var
)
2334 storeAppendPrintf(entry
, "%s %s\n", name
, state
);
2338 parse_tristate(int *var
)
2340 char *token
= strtok(NULL
, w_space
);
2345 if (!strcasecmp(token
, "on") || !strcasecmp(token
, "enable"))
2347 else if (!strcasecmp(token
, "warn"))
2353 #define free_tristate free_int
2356 dump_refreshpattern(StoreEntry
* entry
, const char *name
, refresh_t
* head
)
2358 while (head
!= NULL
) {
2359 storeAppendPrintf(entry
, "%s%s %s %d %d%% %d\n",
2361 head
->flags
.icase
? " -i" : null_string
,
2363 (int) head
->min
/ 60,
2364 (int) (100.0 * head
->pct
+ 0.5),
2365 (int) head
->max
/ 60);
2367 if (head
->flags
.refresh_ims
)
2368 storeAppendPrintf(entry
, " refresh-ims");
2372 if (head
->flags
.override_expire
)
2373 storeAppendPrintf(entry
, " override-expire");
2375 if (head
->flags
.override_lastmod
)
2376 storeAppendPrintf(entry
, " override-lastmod");
2378 if (head
->flags
.reload_into_ims
)
2379 storeAppendPrintf(entry
, " reload-into-ims");
2381 if (head
->flags
.ignore_reload
)
2382 storeAppendPrintf(entry
, " ignore-reload");
2384 if (head
->flags
.ignore_no_cache
)
2385 storeAppendPrintf(entry
, " ignore-no-cache");
2387 if (head
->flags
.ignore_no_store
)
2388 storeAppendPrintf(entry
, " ignore-no-store");
2390 if (head
->flags
.ignore_must_revalidate
)
2391 storeAppendPrintf(entry
, " ignore-must-revalidate");
2393 if (head
->flags
.ignore_private
)
2394 storeAppendPrintf(entry
, " ignore-private");
2396 if (head
->flags
.ignore_auth
)
2397 storeAppendPrintf(entry
, " ignore-auth");
2401 storeAppendPrintf(entry
, "\n");
2408 parse_refreshpattern(refresh_t
** head
)
2415 int refresh_ims
= 0;
2418 int override_expire
= 0;
2419 int override_lastmod
= 0;
2420 int reload_into_ims
= 0;
2421 int ignore_reload
= 0;
2422 int ignore_no_cache
= 0;
2423 int ignore_no_store
= 0;
2424 int ignore_must_revalidate
= 0;
2425 int ignore_private
= 0;
2426 int ignore_auth
= 0;
2433 int flags
= REG_EXTENDED
| REG_NOSUB
;
2435 if ((token
= strtok(NULL
, w_space
)) == NULL
) {
2440 if (strcmp(token
, "-i") == 0) {
2442 token
= strtok(NULL
, w_space
);
2443 } else if (strcmp(token
, "+i") == 0) {
2444 flags
&= ~REG_ICASE
;
2445 token
= strtok(NULL
, w_space
);
2448 if (token
== NULL
) {
2453 pattern
= xstrdup(token
);
2455 i
= GetInteger(); /* token: min */
2457 min
= (time_t) (i
* 60); /* convert minutes to seconds */
2459 i
= GetInteger(); /* token: pct */
2461 pct
= (double) i
/ 100.0;
2463 i
= GetInteger(); /* token: max */
2465 max
= (time_t) (i
* 60); /* convert minutes to seconds */
2468 while ((token
= strtok(NULL
, w_space
)) != NULL
) {
2469 if (!strcmp(token
, "refresh-ims")) {
2473 } else if (!strcmp(token
, "override-expire"))
2474 override_expire
= 1;
2475 else if (!strcmp(token
, "override-lastmod"))
2476 override_lastmod
= 1;
2477 else if (!strcmp(token
, "ignore-no-cache"))
2478 ignore_no_cache
= 1;
2479 else if (!strcmp(token
, "ignore-no-store"))
2480 ignore_no_store
= 1;
2481 else if (!strcmp(token
, "ignore-must-revalidate"))
2482 ignore_must_revalidate
= 1;
2483 else if (!strcmp(token
, "ignore-private"))
2485 else if (!strcmp(token
, "ignore-auth"))
2487 else if (!strcmp(token
, "reload-into-ims")) {
2488 reload_into_ims
= 1;
2489 refresh_nocache_hack
= 1;
2490 /* tell client_side.c that this is used */
2491 } else if (!strcmp(token
, "ignore-reload")) {
2493 refresh_nocache_hack
= 1;
2494 /* tell client_side.c that this is used */
2498 debugs(22, 0, "redreshAddToList: Unknown option '" << pattern
<< "': " << token
);
2501 if ((errcode
= regcomp(&comp
, pattern
, flags
)) != 0) {
2503 regerror(errcode
, &comp
, errbuf
, sizeof errbuf
);
2504 debugs(22, 0, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
2505 debugs(22, 0, "refreshAddToList: Invalid regular expression '" << pattern
<< "': " << errbuf
);
2509 pct
= pct
< 0.0 ? 0.0 : pct
;
2510 max
= max
< 0 ? 0 : max
;
2511 t
= static_cast<refresh_t
*>(xcalloc(1, sizeof(refresh_t
)));
2512 t
->pattern
= (char *) xstrdup(pattern
);
2513 t
->compiled_pattern
= comp
;
2518 if (flags
& REG_ICASE
)
2522 t
->flags
.refresh_ims
= 1;
2526 if (override_expire
)
2527 t
->flags
.override_expire
= 1;
2529 if (override_lastmod
)
2530 t
->flags
.override_lastmod
= 1;
2532 if (reload_into_ims
)
2533 t
->flags
.reload_into_ims
= 1;
2536 t
->flags
.ignore_reload
= 1;
2538 if (ignore_no_cache
)
2539 t
->flags
.ignore_no_cache
= 1;
2541 if (ignore_no_store
)
2542 t
->flags
.ignore_no_store
= 1;
2544 if (ignore_must_revalidate
)
2545 t
->flags
.ignore_must_revalidate
= 1;
2548 t
->flags
.ignore_private
= 1;
2551 t
->flags
.ignore_auth
= 1;
2558 head
= &(*head
)->next
;
2566 free_refreshpattern(refresh_t
** head
)
2570 while ((t
= *head
) != NULL
) {
2572 safe_free(t
->pattern
);
2573 regfree(&t
->compiled_pattern
);
2578 refresh_nocache_hack
= 0;
2584 dump_string(StoreEntry
* entry
, const char *name
, char *var
)
2587 storeAppendPrintf(entry
, "%s %s\n", name
, var
);
2591 parse_string(char **var
)
2593 char *token
= strtok(NULL
, w_space
);
2599 *var
= xstrdup(token
);
2603 ConfigParser::ParseString(char **var
)
2609 ConfigParser::ParseString(String
*var
)
2611 char *token
= strtok(NULL
, w_space
);
2620 free_string(char **var
)
2626 parse_eol(char *volatile *var
)
2628 unsigned char *token
= (unsigned char *) strtok(NULL
, null_string
);
2636 while (*token
&& xisspace(*token
))
2644 *var
= xstrdup((char *) token
);
2647 #define dump_eol dump_string
2648 #define free_eol free_string
2651 dump_time_t(StoreEntry
* entry
, const char *name
, time_t var
)
2653 storeAppendPrintf(entry
, "%s %d seconds\n", name
, (int) var
);
2657 parse_time_t(time_t * var
)
2659 parseTimeLine(var
, T_SECOND_STR
);
2663 free_time_t(time_t * var
)
2670 dump_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2672 storeAppendPrintf(entry
, "%s %d\n", name
, (int) var
);
2677 dump_b_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2679 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) var
, B_BYTES_STR
);
2684 dump_kb_size_t(StoreEntry
* entry
, const char *name
, size_t var
)
2686 storeAppendPrintf(entry
, "%s %d %s\n", name
, (int) var
, B_KBYTES_STR
);
2691 dump_b_int64_t(StoreEntry
* entry
, const char *name
, int64_t var
)
2693 storeAppendPrintf(entry
, "%s %"PRId64
" %s\n", name
, var
, B_BYTES_STR
);
2697 dump_kb_int64_t(StoreEntry
* entry
, const char *name
, int64_t var
)
2699 storeAppendPrintf(entry
, "%s %"PRId64
" %s\n", name
, var
, B_KBYTES_STR
);
2704 parse_size_t(size_t * var
)
2713 parse_b_size_t(size_t * var
)
2715 parseBytesLine(var
, B_BYTES_STR
);
2720 parse_kb_size_t(size_t * var
)
2722 parseBytesLine(var
, B_KBYTES_STR
);
2727 parse_b_int64_t(int64_t * var
)
2729 parseBytesLine64(var
, B_BYTES_STR
);
2733 parse_kb_int64_t(int64_t * var
)
2735 parseBytesLine64(var
, B_KBYTES_STR
);
2739 free_size_t(size_t * var
)
2745 free_b_int64_t(int64_t * var
)
2750 #define free_b_size_t free_size_t
2751 #define free_kb_size_t free_size_t
2752 #define free_mb_size_t free_size_t
2753 #define free_gb_size_t free_size_t
2754 #define free_kb_int64_t free_b_int64_t
2757 dump_ushort(StoreEntry
* entry
, const char *name
, u_short var
)
2759 storeAppendPrintf(entry
, "%s %d\n", name
, var
);
2763 free_ushort(u_short
* u
)
2769 parse_ushort(u_short
* var
)
2771 ConfigParser::ParseUShort(var
);
2775 ConfigParser::ParseUShort(u_short
*var
)
2781 ConfigParser::ParseBool(bool *var
)
2783 int i
= GetInteger();
2794 dump_wordlist(StoreEntry
* entry
, const char *name
, wordlist
* list
)
2796 while (list
!= NULL
) {
2797 storeAppendPrintf(entry
, "%s %s\n", name
, list
->key
);
2803 ConfigParser::ParseWordList(wordlist
** list
)
2805 parse_wordlist(list
);
2809 parse_wordlist(wordlist
** list
)
2812 char *t
= strtok(NULL
, "");
2814 while ((token
= strwordtok(NULL
, &t
)))
2815 wordlistAdd(list
, token
);
2818 #if 0 /* now unused */
2820 check_null_wordlist(wordlist
* w
)
2827 check_null_acl_access(acl_access
* a
)
2832 #define free_wordlist wordlistDestroy
2834 #define free_uri_whitespace free_int
2837 parse_uri_whitespace(int *var
)
2839 char *token
= strtok(NULL
, w_space
);
2844 if (!strcasecmp(token
, "strip"))
2845 *var
= URI_WHITESPACE_STRIP
;
2846 else if (!strcasecmp(token
, "deny"))
2847 *var
= URI_WHITESPACE_DENY
;
2848 else if (!strcasecmp(token
, "allow"))
2849 *var
= URI_WHITESPACE_ALLOW
;
2850 else if (!strcasecmp(token
, "encode"))
2851 *var
= URI_WHITESPACE_ENCODE
;
2852 else if (!strcasecmp(token
, "chop"))
2853 *var
= URI_WHITESPACE_CHOP
;
2859 dump_uri_whitespace(StoreEntry
* entry
, const char *name
, int var
)
2863 if (var
== URI_WHITESPACE_ALLOW
)
2865 else if (var
== URI_WHITESPACE_ENCODE
)
2867 else if (var
== URI_WHITESPACE_CHOP
)
2869 else if (var
== URI_WHITESPACE_DENY
)
2874 storeAppendPrintf(entry
, "%s %s\n", name
, s
);
2878 free_removalpolicy(RemovalPolicySettings
** settings
)
2883 free_string(&(*settings
)->type
);
2885 free_wordlist(&(*settings
)->args
);
2893 parse_removalpolicy(RemovalPolicySettings
** settings
)
2896 free_removalpolicy(settings
);
2898 *settings
= new RemovalPolicySettings
;
2900 parse_string(&(*settings
)->type
);
2902 parse_wordlist(&(*settings
)->args
);
2906 dump_removalpolicy(StoreEntry
* entry
, const char *name
, RemovalPolicySettings
* settings
)
2909 storeAppendPrintf(entry
, "%s %s", name
, settings
->type
);
2910 args
= settings
->args
;
2913 storeAppendPrintf(entry
, " %s", args
->key
);
2917 storeAppendPrintf(entry
, "\n");
2921 free_memcachemode(SquidConfig
* config
)
2927 parse_memcachemode(SquidConfig
* config
)
2929 char *token
= strtok(NULL
, w_space
);
2933 if (strcmp(token
, "always") == 0) {
2934 Config
.onoff
.memory_cache_first
= 1;
2935 Config
.onoff
.memory_cache_disk
= 1;
2936 } else if (strcmp(token
, "disk") == 0) {
2937 Config
.onoff
.memory_cache_first
= 0;
2938 Config
.onoff
.memory_cache_disk
= 1;
2939 } else if (strncmp(token
, "net", 3) == 0) {
2940 Config
.onoff
.memory_cache_first
= 1;
2941 Config
.onoff
.memory_cache_disk
= 0;
2942 } else if (strcmp(token
, "never") == 0) {
2943 Config
.onoff
.memory_cache_first
= 0;
2944 Config
.onoff
.memory_cache_disk
= 0;
2950 dump_memcachemode(StoreEntry
* entry
, const char *name
, SquidConfig
&config
)
2952 storeAppendPrintf(entry
, "%s ", name
);
2953 if (Config
.onoff
.memory_cache_first
&& Config
.onoff
.memory_cache_disk
)
2954 storeAppendPrintf(entry
, "always");
2955 else if (!Config
.onoff
.memory_cache_first
&& Config
.onoff
.memory_cache_disk
)
2956 storeAppendPrintf(entry
, "disk");
2957 else if (Config
.onoff
.memory_cache_first
&& !Config
.onoff
.memory_cache_disk
)
2958 storeAppendPrintf(entry
, "network");
2959 else if (!Config
.onoff
.memory_cache_first
&& !Config
.onoff
.memory_cache_disk
)
2960 storeAppendPrintf(entry
, "none");
2961 storeAppendPrintf(entry
, "\n");
2964 #include "cf_parser.h"
2967 parseNeighborType(const char *s
)
2969 if (!strcasecmp(s
, "parent"))
2972 if (!strcasecmp(s
, "neighbor"))
2973 return PEER_SIBLING
;
2975 if (!strcasecmp(s
, "neighbour"))
2976 return PEER_SIBLING
;
2978 if (!strcasecmp(s
, "sibling"))
2979 return PEER_SIBLING
;
2981 if (!strcasecmp(s
, "multicast"))
2982 return PEER_MULTICAST
;
2984 debugs(15, 0, "WARNING: Unknown neighbor type: " << s
);
2986 return PEER_SIBLING
;
2991 parse_IpAddress_list(IpAddress_list
** head
)
2997 while ((token
= strtok(NULL
, w_space
))) {
2998 if (GetHostWithPort(token
, &ipa
)) {
3001 head
= &(*head
)->next
;
3003 s
= static_cast<IpAddress_list
*>(xcalloc(1, sizeof(*s
)));
3013 dump_IpAddress_list(StoreEntry
* e
, const char *n
, const IpAddress_list
* s
)
3015 char ntoabuf
[MAX_IPSTRLEN
];
3018 storeAppendPrintf(e
, "%s %s\n",
3020 s
->s
.NtoA(ntoabuf
,MAX_IPSTRLEN
));
3026 free_IpAddress_list(IpAddress_list
** head
)
3028 if (*head
) delete *head
;
3032 #if CURRENTLY_UNUSED
3033 /* This code was previously used by http_port. Left as it really should
3034 * be used by icp_port and htcp_port
3037 check_null_IpAddress_list(const IpAddress_list
* s
)
3042 #endif /* CURRENTLY_UNUSED */
3043 #endif /* USE_WCCPv2 */
3045 CBDATA_CLASS_INIT(http_port_list
);
3048 parse_http_port_specification(http_port_list
* s
, char *token
)
3051 unsigned short port
= 0;
3055 s
->disable_pmtu_discovery
= DISABLE_PMTU_OFF
;
3056 s
->name
= xstrdup(token
);
3057 s
->connection_auth_disabled
= false;
3060 if (*token
== '[') {
3063 t
= strchr(host
, ']');
3065 debugs(3, 0, "http(s)_port: missing ']' on IPv6 address: " << token
);
3070 debugs(3, 0, "http(s)_port: missing Port in: " << token
);
3073 port
= xatos(t
+ 1);
3076 if ((t
= strchr(token
, ':'))) {
3081 port
= xatos(t
+ 1);
3083 } else if ((port
= strtol(token
, &junk
, 10)), !*junk
) {
3085 debugs(3, 3, "http(s)_port: found Listen on Port: " << port
);
3087 debugs(3, 0, "http(s)_port: missing Port: " << token
);
3092 debugs(3, 0, "http(s)_port: Port cannot be 0: " << token
);
3099 debugs(3, 3, "http(s)_port: found Listen on wildcard address: *:" << s
->s
.GetPort() );
3100 } else if ( s
->s
= host
) { /* check/parse numeric IPA */
3102 debugs(3, 3, "http(s)_port: Listen on Host/IP: " << host
<< " --> " << s
->s
);
3103 } else if ( s
->s
.GetHostByName(host
) ) { /* check/parse for FQDN */
3104 /* dont use ipcache */
3105 s
->defaultsite
= xstrdup(host
);
3107 debugs(3, 3, "http(s)_port: found Listen as Host " << s
->defaultsite
<< " on IP: " << s
->s
);
3109 debugs(3, 0, "http(s)_port: failed to resolve Host/IP: " << host
);
3115 parse_http_port_option(http_port_list
* s
, char *token
)
3117 if (strncmp(token
, "defaultsite=", 12) == 0) {
3118 safe_free(s
->defaultsite
);
3119 s
->defaultsite
= xstrdup(token
+ 12);
3121 } else if (strncmp(token
, "name=", 5) == 0) {
3123 s
->name
= xstrdup(token
+ 5);
3124 } else if (strcmp(token
, "vhost") == 0) {
3127 } else if (strcmp(token
, "vport") == 0) {
3130 } else if (strncmp(token
, "vport=", 6) == 0) {
3131 s
->vport
= xatos(token
+ 6);
3133 } else if (strncmp(token
, "protocol=", 9) == 0) {
3134 s
->protocol
= xstrdup(token
+ 9);
3136 } else if (strcmp(token
, "accel") == 0) {
3138 } else if (strcmp(token
, "allow-direct") == 0) {
3139 s
->allow_direct
= 1;
3140 } else if (strcmp(token
, "ignore-cc") == 0) {
3142 #if !HTTP_VIOLATIONS
3144 debugs(3, DBG_CRITICAL
, "FATAL: ignore-cc is only valid in accelerator mode");
3148 } else if (strcmp(token
, "no-connection-auth") == 0) {
3149 s
->connection_auth_disabled
= true;
3150 } else if (strcmp(token
, "connection-auth=off") == 0) {
3151 s
->connection_auth_disabled
= true;
3152 } else if (strcmp(token
, "connection-auth") == 0) {
3153 s
->connection_auth_disabled
= false;
3154 } else if (strcmp(token
, "connection-auth=on") == 0) {
3155 s
->connection_auth_disabled
= false;
3156 } else if (strncmp(token
, "disable-pmtu-discovery=", 23) == 0) {
3157 if (!strcasecmp(token
+ 23, "off"))
3158 s
->disable_pmtu_discovery
= DISABLE_PMTU_OFF
;
3159 else if (!strcasecmp(token
+ 23, "transparent"))
3160 s
->disable_pmtu_discovery
= DISABLE_PMTU_TRANSPARENT
;
3161 else if (!strcasecmp(token
+ 23, "always"))
3162 s
->disable_pmtu_discovery
= DISABLE_PMTU_ALWAYS
;
3166 } else if (strcmp(token
, "transparent") == 0 || strcmp(token
, "intercept") == 0) {
3168 IpInterceptor
.StartInterception();
3169 /* Log information regarding the port modes under interception. */
3170 debugs(3, DBG_IMPORTANT
, "Starting Authentication on port " << s
->s
);
3171 debugs(3, DBG_IMPORTANT
, "Disabling Authentication on port " << s
->s
<< " (interception enabled)");
3174 /* INET6: until transparent REDIRECT works on IPv6 SOCKET, force wildcard to IPv4 */
3175 debugs(3, DBG_IMPORTANT
, "Disabling IPv6 on port " << s
->s
<< " (interception enabled)");
3176 if ( !s
->s
.SetIPv4() ) {
3177 debugs(3, DBG_CRITICAL
, "http(s)_port: IPv6 addresses cannot be transparent (protocol does not provide NAT)" << s
->s
);
3181 } else if (strcmp(token
, "tproxy") == 0) {
3182 if (s
->intercepted
|| s
->accel
) {
3183 debugs(3,DBG_CRITICAL
, "http(s)_port: TPROXY option requires its own interception port. It cannot be shared.");
3186 s
->spoof_client_ip
= 1;
3187 IpInterceptor
.StartTransparency();
3188 /* Log information regarding the port modes under transparency. */
3189 debugs(3, DBG_IMPORTANT
, "Starting IP Spoofing on port " << s
->s
);
3190 debugs(3, DBG_IMPORTANT
, "Disabling Authentication on port " << s
->s
<< " (IP spoofing enabled)");
3192 if (!IpInterceptor
.ProbeForTproxy(s
->s
)) {
3193 debugs(3, DBG_CRITICAL
, "FATAL: http(s)_port: TPROXY support in the system does not work.");
3197 } else if (strcmp(token
, "ipv4") == 0) {
3199 if ( !s
->s
.SetIPv4() ) {
3200 debugs(3, 0, "http(s)_port: IPv6 addresses cannot be used a IPv4-Only." << s
->s
);
3204 } else if (strcmp(token
, "tcpkeepalive") == 0) {
3205 s
->tcp_keepalive
.enabled
= 1;
3206 } else if (strncmp(token
, "tcpkeepalive=", 13) == 0) {
3207 char *t
= token
+ 13;
3208 s
->tcp_keepalive
.enabled
= 1;
3209 s
->tcp_keepalive
.idle
= atoi(t
);
3213 s
->tcp_keepalive
.interval
= atoi(t
);
3218 s
->tcp_keepalive
.timeout
= atoi(t
);
3222 } else if (strncmp(token
, "cert=", 5) == 0) {
3224 s
->cert
= xstrdup(token
+ 5);
3225 } else if (strncmp(token
, "key=", 4) == 0) {
3227 s
->key
= xstrdup(token
+ 4);
3228 } else if (strncmp(token
, "version=", 8) == 0) {
3229 s
->version
= xatoi(token
+ 8);
3231 if (s
->version
< 1 || s
->version
> 4)
3233 } else if (strncmp(token
, "options=", 8) == 0) {
3234 safe_free(s
->options
);
3235 s
->options
= xstrdup(token
+ 8);
3236 } else if (strncmp(token
, "cipher=", 7) == 0) {
3237 safe_free(s
->cipher
);
3238 s
->cipher
= xstrdup(token
+ 7);
3239 } else if (strncmp(token
, "clientca=", 9) == 0) {
3240 safe_free(s
->clientca
);
3241 s
->clientca
= xstrdup(token
+ 9);
3242 } else if (strncmp(token
, "cafile=", 7) == 0) {
3243 safe_free(s
->cafile
);
3244 s
->cafile
= xstrdup(token
+ 7);
3245 } else if (strncmp(token
, "capath=", 7) == 0) {
3246 safe_free(s
->capath
);
3247 s
->capath
= xstrdup(token
+ 7);
3248 } else if (strncmp(token
, "crlfile=", 8) == 0) {
3249 safe_free(s
->crlfile
);
3250 s
->crlfile
= xstrdup(token
+ 8);
3251 } else if (strncmp(token
, "dhparams=", 9) == 0) {
3252 safe_free(s
->dhfile
);
3253 s
->dhfile
= xstrdup(token
+ 9);
3254 } else if (strncmp(token
, "sslflags=", 9) == 0) {
3255 safe_free(s
->sslflags
);
3256 s
->sslflags
= xstrdup(token
+ 9);
3257 } else if (strncmp(token
, "sslcontext=", 11) == 0) {
3258 safe_free(s
->sslcontext
);
3259 s
->sslcontext
= xstrdup(token
+ 11);
3260 } else if (strcmp(token
, "sslBump") == 0) {
3261 s
->sslBump
= 1; // accelerated when bumped, otherwise not
3267 if ( s
->spoof_client_ip
&& (s
->intercepted
|| s
->accel
) ) {
3268 debugs(3,DBG_CRITICAL
, "http(s)_port: TPROXY option requires its own interception port. It cannot be shared.");
3273 static http_port_list
*
3274 create_http_port(char *portspec
)
3276 http_port_list
*s
= new http_port_list("http");
3277 parse_http_port_specification(s
, portspec
);
3282 add_http_port(char *portspec
)
3284 http_port_list
*s
= create_http_port(portspec
);
3285 // we may need to merge better of the above returns a list with clones
3286 assert(s
->next
== NULL
);
3287 s
->next
= Config
.Sockaddr
.http
;
3288 Config
.Sockaddr
.http
= s
;
3291 #if IPV6_SPECIAL_SPLITSTACK
3293 clone_http_port_list(http_port_list
*a
)
3295 http_port_list
*b
= new http_port_list(a
->protocol
);
3299 b
->name
= xstrdup(a
->name
);
3301 b
->defaultsite
= xstrdup(a
->defaultsite
);
3303 b
->intercepted
= a
->intercepted
;
3304 b
->spoof_client_ip
= a
->spoof_client_ip
;
3305 b
->accel
= a
->accel
;
3306 b
->allow_direct
= a
->allow_direct
;
3307 b
->vhost
= a
->vhost
;
3308 b
->sslBump
= a
->sslBump
;
3309 b
->vport
= a
->vport
;
3310 b
->connection_auth_disabled
= a
->connection_auth_disabled
;
3311 b
->disable_pmtu_discovery
= a
->disable_pmtu_discovery
;
3313 memcpy( &(b
->tcp_keepalive
), &(a
->tcp_keepalive
), sizeof(a
->tcp_keepalive
));
3316 // AYJ: 2009-07-18: for now SSL does not clone. Configure separate ports with IPs and SSL settings
3319 // XXX: temporary hack to ease move of SSL options to http_port
3320 http_port_list
&http
;
3334 SSL_CTX
*sslContext
;
3344 parse_http_port_list(http_port_list
** head
)
3346 char *token
= strtok(NULL
, w_space
);
3353 http_port_list
*s
= create_http_port(token
);
3355 /* parse options ... */
3356 while ((token
= strtok(NULL
, w_space
))) {
3357 parse_http_port_option(s
, token
);
3360 #if IPV6_SPECIAL_SPLITSTACK
3361 if (s
->s
.IsAnyAddr()) {
3362 // clone the port options from *s to *(s->next)
3363 s
->next
= clone_http_port_list(s
);
3364 s
->next
->s
.SetIPv4();
3365 debugs(3, 3, "http(s)_port: clone wildcard address for split-stack: " << s
->s
<< " and " << s
->next
->s
);
3370 head
= &(*head
)->next
;
3376 dump_generic_http_port(StoreEntry
* e
, const char *n
, const http_port_list
* s
)
3378 char buf
[MAX_IPSTRLEN
];
3380 storeAppendPrintf(e
, "%s %s",
3382 s
->s
.ToURL(buf
,MAX_IPSTRLEN
));
3385 storeAppendPrintf(e
, " defaultsite=%s", s
->defaultsite
);
3388 storeAppendPrintf(e
, " intercept");
3391 storeAppendPrintf(e
, " vhost");
3394 storeAppendPrintf(e
, " vport");
3396 if (s
->connection_auth_disabled
)
3397 storeAppendPrintf(e
, " connection-auth=off");
3399 storeAppendPrintf(e
, " connection-auth=on");
3401 if (s
->disable_pmtu_discovery
!= DISABLE_PMTU_OFF
) {
3404 if (s
->disable_pmtu_discovery
== DISABLE_PMTU_ALWAYS
)
3407 pmtu
= "transparent";
3409 storeAppendPrintf(e
, " disable-pmtu-discovery=%s", pmtu
);
3412 if (s
->tcp_keepalive
.enabled
) {
3413 if (s
->tcp_keepalive
.idle
|| s
->tcp_keepalive
.interval
|| s
->tcp_keepalive
.timeout
) {
3414 storeAppendPrintf(e
, " tcpkeepalive=%d,%d,%d", s
->tcp_keepalive
.idle
, s
->tcp_keepalive
.interval
, s
->tcp_keepalive
.timeout
);
3416 storeAppendPrintf(e
, " tcpkeepalive");
3422 storeAppendPrintf(e
, " cert=%s", s
->cert
);
3425 storeAppendPrintf(e
, " key=%s", s
->key
);
3428 storeAppendPrintf(e
, " version=%d", s
->version
);
3431 storeAppendPrintf(e
, " options=%s", s
->options
);
3434 storeAppendPrintf(e
, " cipher=%s", s
->cipher
);
3437 storeAppendPrintf(e
, " cafile=%s", s
->cafile
);
3440 storeAppendPrintf(e
, " capath=%s", s
->capath
);
3443 storeAppendPrintf(e
, " crlfile=%s", s
->crlfile
);
3446 storeAppendPrintf(e
, " dhparams=%s", s
->dhfile
);
3449 storeAppendPrintf(e
, " sslflags=%s", s
->sslflags
);
3452 storeAppendPrintf(e
, " sslcontext=%s", s
->sslcontext
);
3455 storeAppendPrintf(e
, " sslBump");
3460 dump_http_port_list(StoreEntry
* e
, const char *n
, const http_port_list
* s
)
3463 dump_generic_http_port(e
, n
, s
);
3464 storeAppendPrintf(e
, "\n");
3470 free_http_port_list(http_port_list
** head
)
3474 while ((s
= *head
) != NULL
) {
3482 // TODO: merge better with parse_http_port_list
3484 parse_https_port_list(https_port_list
** head
)
3489 token
= strtok(NULL
, w_space
);
3494 s
= new https_port_list
;
3495 parse_http_port_specification(&s
->http
, token
);
3497 /* parse options ... */
3498 while ((token
= strtok(NULL
, w_space
))) {
3499 parse_http_port_option(s
, token
);
3503 http_port_list
** headTmp
= &(*head
)->http
.next
;
3504 head
= (https_port_list
**)headTmp
;
3511 dump_https_port_list(StoreEntry
* e
, const char *n
, const https_port_list
* s
)
3513 dump_http_port_list(e
, n
, s
);
3517 free_https_port_list(https_port_list
** head
)
3519 free_http_port_list((http_port_list
**)head
);
3524 check_null_https_port_list(const https_port_list
* s
)
3531 #endif /* USE_SSL */
3534 configFreeMemory(void)
3540 requirePathnameExists(const char *name
, const char *path
)
3544 char pathbuf
[BUFSIZ
];
3545 assert(path
!= NULL
);
3547 if (Config
.chroot_dir
&& (geteuid() == 0)) {
3548 snprintf(pathbuf
, BUFSIZ
, "%s/%s", Config
.chroot_dir
, path
);
3552 if (stat(path
, &sb
) < 0) {
3553 if (opt_send_signal
== -1 || opt_send_signal
== SIGHUP
)
3554 fatalf("%s %s: %s", name
, path
, xstrerror());
3556 fprintf(stderr
, "WARNING: %s %s: %s\n", name
, path
, xstrerror());
3563 return ConfigParser::strtokFile();
3566 #include "AccessLogEntry.h"
3567 /* TODO: split out parsing somehow ...*/
3569 parse_logformat(logformat
** logformat_definitions
)
3574 if ((name
= strtok(NULL
, w_space
)) == NULL
)
3577 if ((def
= strtok(NULL
, "\r\n")) == NULL
) {
3582 debugs(3, 2, "Logformat for '" << name
<< "' is '" << def
<< "'");
3584 nlf
= (logformat
*)xcalloc(1, sizeof(logformat
));
3586 nlf
->name
= xstrdup(name
);
3588 if (!accessLogParseLogFormat(&nlf
->format
, def
)) {
3593 nlf
->next
= *logformat_definitions
;
3595 *logformat_definitions
= nlf
;
3599 parse_access_log(customlog
** logs
)
3601 const char *filename
, *logdef_name
;
3605 cl
= (customlog
*)xcalloc(1, sizeof(*cl
));
3607 if ((filename
= strtok(NULL
, w_space
)) == NULL
) {
3612 if (strcmp(filename
, "none") == 0) {
3613 cl
->type
= CLF_NONE
;
3617 if ((logdef_name
= strtok(NULL
, w_space
)) == NULL
)
3618 logdef_name
= "auto";
3620 debugs(3, 9, "Log definition name '" << logdef_name
<< "' file '" << filename
<< "'");
3622 cl
->filename
= xstrdup(filename
);
3624 /* look for the definition pointer corresponding to this name */
3625 lf
= Config
.Log
.logformats
;
3627 while (lf
!= NULL
) {
3628 debugs(3, 9, "Comparing against '" << lf
->name
<< "'");
3630 if (strcmp(lf
->name
, logdef_name
) == 0)
3637 cl
->type
= CLF_CUSTOM
;
3639 } else if (strcmp(logdef_name
, "auto") == 0) {
3640 cl
->type
= CLF_AUTO
;
3641 } else if (strcmp(logdef_name
, "squid") == 0) {
3642 cl
->type
= CLF_SQUID
;
3643 } else if (strcmp(logdef_name
, "common") == 0) {
3644 cl
->type
= CLF_COMMON
;
3646 } else if (strcmp(logdef_name
, "icap_squid") == 0) {
3647 cl
->type
= CLF_ICAP_SQUID
;
3650 debugs(3, 0, "Log format '" << logdef_name
<< "' is not defined");
3656 aclParseAclList(LegacyParser
, &cl
->aclList
);
3659 logs
= &(*logs
)->next
;
3665 check_null_access_log(customlog
*customlog_definitions
)
3667 return customlog_definitions
== NULL
;
3671 dump_logformat(StoreEntry
* entry
, const char *name
, logformat
* definitions
)
3673 accessLogDumpLogFormat(entry
, name
, definitions
);
3677 dump_access_log(StoreEntry
* entry
, const char *name
, customlog
* logs
)
3681 for (log
= logs
; log
; log
= log
->next
) {
3682 storeAppendPrintf(entry
, "%s ", name
);
3684 switch (log
->type
) {
3687 storeAppendPrintf(entry
, "%s %s", log
->filename
, log
->logFormat
->name
);
3691 storeAppendPrintf(entry
, "none");
3695 storeAppendPrintf(entry
, "%s squid", log
->filename
);
3699 storeAppendPrintf(entry
, "%s squid", log
->filename
);
3702 case CLF_ICAP_SQUID
:
3703 storeAppendPrintf(entry
, "%s icap_squid", log
->filename
);
3709 storeAppendPrintf(entry
, "%s auto", log
->filename
);
3711 storeAppendPrintf(entry
, "%s", log
->filename
);
3720 dump_acl_list(entry
, log
->aclList
);
3722 storeAppendPrintf(entry
, "\n");
3727 free_logformat(logformat
** definitions
)
3729 while (*definitions
) {
3730 logformat
*format
= *definitions
;
3731 *definitions
= format
->next
;
3732 safe_free(format
->name
);
3733 accessLogFreeLogFormat(&format
->format
);
3739 free_access_log(customlog
** definitions
)
3741 while (*definitions
) {
3742 customlog
*log
= *definitions
;
3743 *definitions
= log
->next
;
3745 log
->logFormat
= NULL
;
3746 log
->type
= CLF_UNKNOWN
;
3749 aclDestroyAclList(&log
->aclList
);
3751 safe_free(log
->filename
);
3760 parse_adaptation_service_set_type()
3762 Adaptation::Config::ParseServiceSet();
3766 parse_adaptation_service_chain_type()
3768 Adaptation::Config::ParseServiceChain();
3772 parse_adaptation_access_type()
3774 Adaptation::Config::ParseAccess(LegacyParser
);
3777 #endif /* USE_ADAPTATION */
3783 parse_icap_service_type(Adaptation::Icap::Config
* cfg
)
3785 cfg
->parseService();
3789 free_icap_service_type(Adaptation::Icap::Config
* cfg
)
3795 dump_icap_service_type(StoreEntry
* entry
, const char *name
, const Adaptation::Icap::Config
&cfg
)
3797 cfg
.dumpService(entry
, name
);
3801 parse_icap_class_type()
3803 debugs(93, 0, "WARNING: 'icap_class' is depricated. " <<
3804 "Use 'adaptation_service_set' instead");
3805 Adaptation::Config::ParseServiceSet();
3809 parse_icap_access_type()
3811 debugs(93, 0, "WARNING: 'icap_access' is depricated. " <<
3812 "Use 'adaptation_access' instead");
3813 Adaptation::Config::ParseAccess(LegacyParser
);
3822 parse_ecap_service_type(Adaptation::Ecap::Config
* cfg
)
3824 cfg
->parseService();
3828 free_ecap_service_type(Adaptation::Ecap::Config
* cfg
)
3834 dump_ecap_service_type(StoreEntry
* entry
, const char *name
, const Adaptation::Ecap::Config
&cfg
)
3836 cfg
.dumpService(entry
, name
);
3839 #endif /* USE_ECAP */