Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 2 | include/common/defaults.h |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 3 | Miscellaneous default values. |
| 4 | |
| 5 | Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu |
| 6 | |
| 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 Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 22 | #ifndef _COMMON_DEFAULTS_H |
| 23 | #define _COMMON_DEFAULTS_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 25 | /* |
| 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 | |
| 46 | // max # args on a configuration line |
| 47 | #define MAX_LINE_ARGS 40 |
| 48 | |
| 49 | // max # of added headers per request |
| 50 | #define MAX_NEWHDR 10 |
| 51 | |
| 52 | // max # of matches per regexp |
| 53 | #define MAX_MATCH 10 |
| 54 | |
Willy Tarreau | e5f20dc | 2006-12-03 15:21:35 +0100 | [diff] [blame] | 55 | // max # of headers in one HTTP request or response |
| 56 | // By default, about 100 headers per 8 kB. |
| 57 | #ifndef MAX_HTTP_HDR |
| 58 | #define MAX_HTTP_HDR ((BUFSIZE+79)/80) |
| 59 | #endif |
| 60 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 61 | // cookie delimitor in "prefix" mode. This character is inserted between the |
| 62 | // persistence cookie and the original value. The '~' is allowed by RFC2965, |
| 63 | // and should not be too common in server names. |
| 64 | #ifndef COOKIE_DELIM |
| 65 | #define COOKIE_DELIM '~' |
| 66 | #endif |
| 67 | |
| 68 | #define CONN_RETRIES 3 |
| 69 | |
| 70 | #define CHK_CONNTIME 2000 |
| 71 | #define DEF_CHKINTR 2000 |
| 72 | #define DEF_FALLTIME 3 |
| 73 | #define DEF_RISETIME 2 |
| 74 | #define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n\r\n" |
| 75 | |
| 76 | /* Default connections limit. |
| 77 | * |
| 78 | * A system limit can be enforced at build time in order to avoid using haproxy |
| 79 | * beyond reasonable system limits. For this, just define SYSTEM_MAXCONN to the |
| 80 | * absolute limit accepted by the system. If the configuration specifies a |
| 81 | * higher value, it will be capped to SYSTEM_MAXCONN and a warning will be |
| 82 | * emitted. The only way to override this limit will be to set it via the |
| 83 | * command-line '-n' argument. |
| 84 | */ |
| 85 | #ifndef SYSTEM_MAXCONN |
| 86 | #define DEFAULT_MAXCONN 2000 |
| 87 | #else |
| 88 | #define DEFAULT_MAXCONN SYSTEM_MAXCONN |
| 89 | #endif |
| 90 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 91 | #endif /* _COMMON_DEFAULTS_H */ |