blob: 05628e176393630d6b82e4a903b2cc8a0017b997 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
Willy Tarreau2dd0d472006-06-29 17:53:05 +02002 include/common/defaults.h
Willy Tarreaubaaee002006-06-26 02:48:02 +02003 Miscellaneous default values.
4
Willy Tarreau1db37712007-06-03 17:16:49 +02005 Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
Willy Tarreaubaaee002006-06-26 02:48:02 +02006
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation, version 2.1
10 exclusively.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
Willy Tarreau2dd0d472006-06-29 17:53:05 +020022#ifndef _COMMON_DEFAULTS_H
23#define _COMMON_DEFAULTS_H
Willy Tarreaubaaee002006-06-26 02:48:02 +020024
Willy Tarreaubaaee002006-06-26 02:48:02 +020025/*
26 * BUFSIZE defines the size of a read and write buffer. It is the maximum
27 * amount of bytes which can be stored by the proxy for each session. However,
28 * when reading HTTP headers, the proxy needs some spare space to add or rewrite
29 * headers if needed. The size of this spare is defined with MAXREWRITE. So it
30 * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By
31 * default, BUFSIZE=16384 bytes and MAXREWRITE=BUFSIZE/2, so the maximum length
32 * of headers accepted is 8192 bytes, which is in line with Apache's limits.
33 */
34#ifndef BUFSIZE
35#define BUFSIZE 16384
36#endif
37
38// reserved buffer space for header rewriting
39#ifndef MAXREWRITE
40#define MAXREWRITE (BUFSIZE / 2)
41#endif
42
43#define REQURI_LEN 1024
44#define CAPTURE_LEN 64
45
Krzysztof Piotr Oledzkie6bbd742007-11-01 00:33:12 +010046// maximum line size when parsing config
47#ifndef LINESIZE
48#define LINESIZE 2048
49#endif
50
Willy Tarreaubaaee002006-06-26 02:48:02 +020051// max # args on a configuration line
Krzysztof Piotr Oledzkie6bbd742007-11-01 00:33:12 +010052#define MAX_LINE_ARGS 64
Willy Tarreaubaaee002006-06-26 02:48:02 +020053
Krzysztof Piotr Oledzki2c6962c2008-03-02 02:42:14 +010054// max # args on a uxts socket
55#define MAX_UXST_ARGS 16
56
Willy Tarreaubaaee002006-06-26 02:48:02 +020057// max # of added headers per request
58#define MAX_NEWHDR 10
59
60// max # of matches per regexp
61#define MAX_MATCH 10
62
Willy Tarreaue5f20dc2006-12-03 15:21:35 +010063// max # of headers in one HTTP request or response
64// By default, about 100 headers per 8 kB.
65#ifndef MAX_HTTP_HDR
66#define MAX_HTTP_HDR ((BUFSIZE+79)/80)
67#endif
68
Willy Tarreaub8949f12007-03-23 22:39:59 +010069// max # of loops we can perform around a read() which succeeds.
70// It's very frequent that the system returns a few TCP segments at a time.
71#ifndef MAX_READ_POLL_LOOPS
72#define MAX_READ_POLL_LOOPS 4
73#endif
74
Willy Tarreau83749182007-04-15 20:56:27 +020075// same, but for writes. Generally, it's enough to write twice: one time for
76// first half of the buffer, and a second time for the last half after a
77// wrap-around.
78#ifndef MAX_WRITE_POLL_LOOPS
79#define MAX_WRITE_POLL_LOOPS 2
80#endif
81
Willy Tarreau9641e8f2007-03-23 23:02:09 +010082// the number of bytes returned by a read below which we will not try to
83// poll the socket again. Generally, return values below the MSS are worthless
84// to try again.
85#ifndef MIN_RET_FOR_READ_LOOP
86#define MIN_RET_FOR_READ_LOOP 1460
87#endif
88
Willy Tarreau1db37712007-06-03 17:16:49 +020089// the max number of events returned in one call to poll/epoll. Too small a
90// value will cause lots of calls, and too high a value may cause high latency.
91#ifndef MAX_POLL_EVENTS
92#define MAX_POLL_EVENTS 200
93#endif
94
Willy Tarreaubaaee002006-06-26 02:48:02 +020095// cookie delimitor in "prefix" mode. This character is inserted between the
96// persistence cookie and the original value. The '~' is allowed by RFC2965,
97// and should not be too common in server names.
98#ifndef COOKIE_DELIM
99#define COOKIE_DELIM '~'
100#endif
101
102#define CONN_RETRIES 3
103
104#define CHK_CONNTIME 2000
105#define DEF_CHKINTR 2000
106#define DEF_FALLTIME 3
107#define DEF_RISETIME 2
108#define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n\r\n"
Willy Tarreau23677902007-05-08 23:50:35 +0200109#define DEF_SMTP_CHECK_REQ "HELO localhost\r\n"
Willy Tarreaubaaee002006-06-26 02:48:02 +0200110
Ross Westaf72a1d2008-08-03 10:51:45 +0200111// X-Forwarded-For header default
112#define DEF_XFORWARDFOR_HDR "X-Forwarded-For"
113
Willy Tarreaubaaee002006-06-26 02:48:02 +0200114/* Default connections limit.
115 *
116 * A system limit can be enforced at build time in order to avoid using haproxy
117 * beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the
118 * absolute limit accepted by the system. If the configuration specifies a
119 * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be
120 * emitted. The only way to override this limit will be to set it via the
121 * command-line '-n' argument.
122 */
123#ifndef SYSTEM_MAXCONN
124#define DEFAULT_MAXCONN 2000
125#else
126#define DEFAULT_MAXCONN SYSTEM_MAXCONN
127#endif
128
Willy Tarreau2c43a1e2007-10-14 23:05:39 +0200129/* Minimum check interval for spread health checks. Servers with intervals
130 * greater than or equal to this value will have their checks spread apart
131 * and will be considered when searching the minimal interval.
132 * Others will be ignored for the minimal interval and will have their checks
133 * scheduled on a different basis.
134 */
135#ifndef SRV_CHK_INTER_THRES
136#define SRV_CHK_INTER_THRES 1000
137#endif
138
Krzysztof Oledzkid9db9272007-10-15 10:05:11 +0200139/* Specifies the string used to report the version and release date on the
140 * statistics page. May be defined to the empty string ("") to permanently
141 * disable the feature.
142 */
143#ifndef STATS_VERSION_STRING
144#define STATS_VERSION_STRING " version " HAPROXY_VERSION ", released " HAPROXY_DATE
145#endif
146
Willy Tarreau2dd0d472006-06-29 17:53:05 +0200147#endif /* _COMMON_DEFAULTS_H */