--- ./haproxy.c~ Sun Nov 14 16:13:34 2004 +++ ./haproxy.c Sat Nov 27 13:35:50 2004 @@ -73,10 +73,24 @@ #define SHUT_WR 1 #endif -#define BUFSIZE 8192 +/* + * BUFSIZE defines the size of a read and write buffer. It is the maximum + * amount of bytes which can be stored by the proxy for each session. However, + * when reading HTTP headers, the proxy needs some spare space to add or rewrite + * headers if needed. The size of this spare is defined with MAXREWRITE. So it + * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By + * default, BUFSIZE=16384 bytes and MAXREWRITE=BUFSIZE/2, so the maximum length + * of headers accepted is 8192 bytes, which is in line with Apache's limits. + */ +#ifndef BUFSIZE +#define BUFSIZE 16384 +#endif // reserved buffer space for header rewriting -#define MAXREWRITE 4096 +#ifndef MAXREWRITE +#define MAXREWRITE (BUFSIZE / 2) +#endif + #define REQURI_LEN 1024 #define CAPTURE_LEN 64 --- ./Makefile~ Sat Aug 14 15:55:31 2004 +++ ./Makefile Sat Nov 27 12:07:09 2004 @@ -61,12 +61,19 @@ #DEBUG = DEBUG = -g +# if small memory footprint is required, you can reduce the buffer size. There +# are 2 buffers per concurrent session, so 16 kB buffers will eat 32 MB memory +# with 1000 concurrent sessions. +#SMALL_OPTS = -DBUFSIZE=8192 -DMAXREWRITE=1024 +SMALL_OPTS = + + # global options TARGET_OPTS=$(COPTS.$(TARGET)) REGEX_OPTS=$(COPTS.$(REGEX)) CPU_OPTS=$(COPTS.$(CPU)) -COPTS=$(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) +COPTS=$(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) $(SMALL_OPTS) LIBS=$(LIBS.$(TARGET)) $(LIBS.$(REGEX)) # - use -DSTATTIME=0 to disable statistics, else specify an interval in