Commit Graph

2925 Commits

Author SHA1 Message Date
Willy Tarreau
4266a36c5a [BUG] segfault on some erroneous configurations
If captures were configured in a TCP-only listener, and
the logs were enabled, the proxy could segfault when
trying to scan the capture buffer which was NULL. Such
an erroneous configuration will not be possible anymore
soon, but let's avoid the problem for now by detecting
the NULL condition.
2007-02-01 23:15:45 +01:00
Willy Tarreau
9cabf70db7 [RELEASE] Released version 1.3.7 with the following changes :
- fix critical bug introduced with 1.3.6 : an empty request header
      may lead to a crash due to missing pointer assignment
    - hdr_idx might be left uninitialized in debug mode
    - fixed build on FreeBSD due to missing fd_set declaration
2007-01-26 23:49:01 +01:00
Willy Tarreau
b9ebf70a3a [CRITICAL] an empty header may lead to a crash
A missing pointer assignment in case of an empty header
will result in this header's length being 65535, causing
a SEGV when accessing the next header. It should not be
possible to exploit this problem to run arbitrary code
because the crash occurs while reading the data.
2007-01-26 23:39:38 +01:00
Willy Tarreau
f0d058e8ab [BUG] hdr_idx might be left uninitialized in some cases
When a request is invalid during RQ_BEFORE AND the debug mode is active,
the hdr_idx might be used uninitialized. Let's initialize it right after
the accept() for now.
2007-01-25 12:03:42 +01:00
Willy Tarreau
ca28d1e1cb [BUILD] fix build on FreeBSD (missing fd_set declaration)
Sorin Pop reported a patch to fix build on FreeBSD.
The file common/standard.h used an fd_set in a declaration
but did not include enough headers for it to be known.
2007-01-24 18:20:50 +01:00
Willy Tarreau
e7a2438cae [RELEASE] Released version 1.3.6.1 with the following change :
- change in the header chaining broke cookies and authentication
2007-01-22 08:57:44 +01:00
Willy Tarreau
83969f42ba [MAJOR] invalid header offset broke cookies and authentication
Since the request is no longer part of the headers, cookies and
authentication did not work anymore. Obvious fix is to add the
request offset to the start pointer.
2007-01-22 08:55:47 +01:00
Willy Tarreau
49e1ee83be [RELEASE] Released 1.3.6 with the following changes :
- stats now support the HEAD method too
    - extracted http request from the session
    - huge rework of the HTTP parser which is now a 28-state FSM.
    - linux-style likely/unlikely macros for optimization hints
    - do not create a server socket when there's no server
2007-01-22 00:56:46 +01:00
Willy Tarreau
8973c70f7d [MEDIUM] implemented the status-line parser in http_msg_analyzer().
The status line parser has been written. With it, it should not
be too hard to replace the response parser to benefit from the
new header facilities.
2007-01-21 23:58:29 +01:00
Willy Tarreau
362b34d05c [MINOR] move the response headers to the http_req 2007-01-21 20:49:31 +01:00
Willy Tarreau
ee68cf29bb [DOC] added a link to an excellent paper about HTTP load time 2007-01-21 19:18:55 +01:00
Willy Tarreau
8d5d7f20b9 [MAJOR] huge rework of the HTTP request FSM
The HTTP parser has been rewritten for better compliance to RFC2616.
The same parser is now usable for both requests and responses, and
it now supports HTTP/0.9 as well as multi-line headers. It has also
been improved for speed ; a typicial HTTP request is parsed in about
2 microseconds on a 1 GHz processor.

The monitor-uri check has been moved so that the requests are not
logged. The httpclose option now tries to change as little as
possible in the request, and does not affect the first header if
it is already set to 'close'. HTTP/0.9 requests are converted to
HTTP/1.0 before being forwarded.

Headers and request transformations are now distinct. The headers
list is updated after each insertion/removal/transformation. The
request is re-parsed and checked after each transformation. It is
not possible anymore to remove a request, and requests which lead
to invalid request lines are now rejected.
2007-01-21 19:16:41 +01:00
Willy Tarreau
5d65bbb2aa [BUG] last backend change broke server assignment
Due to a change in the if/else paths, s->flags did not receive
the SN_ASSIGNED value anymore.
2007-01-21 12:47:26 +01:00
Willy Tarreau
1a1158b0bd [MINOR] do not create a socket if there is no server
Since the distinction of backends and frontends, it has become
possible that some requests reach a frontend which has no
backend parameters. We must not create a socket on the backend
side just to destroy it later in such a case. The real problem
comes from the dispatch mode not being explictly stated.
2007-01-20 11:07:46 +01:00
Willy Tarreau
0637fa0671 [MINOR] add the end of line pointer in each HTTP header 2007-01-13 23:07:22 +01:00
Willy Tarreau
7d58a63071 [MINOR] added the Linux-style likely/unlikely macros
Recent GCC versions support the __builtin_expect() macro which
is undecipherable. Let's use likely()/unlikely() like it's done
in Linux.
2007-01-13 23:06:06 +01:00
Willy Tarreau
0f7562b8d3 [MEDIUM] separate the http request from the session (step 1)
A struct http_req has been created to collect every information
related to an HTTP request being processed. Right now, it is
still in the struct session but the frontier is clear now.
2007-01-07 15:46:13 +01:00
Willy Tarreau
6cf932508d Merge branch 'master' into http_parser 2007-01-07 13:49:41 +01:00
Willy Tarreau
0214c3a307 [MEDIUM] Stats: add support for the HEAD method
There are browsers which sometimes send HEAD requests to the stats
page, but it was not handled so it returned a 503 server error or
was simply sent to the default backend servers.

Now with a HEAD request, the stats return the headers and finish
there. Normally, other methods should be blocked so that the stats
page really catches the whole URI. Other methods would need to cause
a 405 Method not allowed to be returned.
2007-01-07 13:47:30 +01:00
Willy Tarreau
d1142aa073 [DOC] imported lots of internal documentations
Those documentations provide nothing to users nor contributors
but at least now I know where they are.
2007-01-07 13:03:59 +01:00
Willy Tarreau
1ba6a73594 [DOC] updated the http_parsing doc 2007-01-07 12:43:29 +01:00
Willy Tarreau
5871f8e9bf [RELEASE] Released 1.3.5 with the following major changes :
- added complete support and doc for TCP Splicing
    - replaced the wait-queue linked list with an rbtree.
    - stats: swap color sets for active and backup servers
    - try to guess server check port when unset
    - a few bugfixes and cleanups
2007-01-07 02:47:01 +01:00
Willy Tarreau
ef00b50011 [MINOR] try to guess server check port when unset
When a server has no port specified and there is a check
enabled on it, the check is disabled because the port is
unknown. However, people expect the "listen" line to set
the check port just like it sets the server's port. Now,
if a port is specified in the listen or in the first bind
and nowhere else, it will be used for the checks as well.
2007-01-07 02:40:09 +01:00
Willy Tarreau
86efac8411 Merge branch 'rbtree' 2007-01-07 02:17:18 +01:00
Willy Tarreau
733fef4add Merge branch 'tcpsplice' 2007-01-07 02:16:59 +01:00
Willy Tarreau
964c936b04 [MAJOR] replace the wait-queue linked list with an rbtree.
This patch from Sin Yu makes use of an rbtree for the wait queue,
which will solve the slowdown problem encountered when timeouts
are heterogenous in the configuration. The next step will be to
turn maintain_proxies() into a per-proxy task so that we won't
have to scan them all after each poll() loop.
2007-01-07 02:14:23 +01:00
Willy Tarreau
d59d22e20a [MINOR] imported the rbtree function from Linux kernel
Those rbtree functions will be used by Sin Yu's new rbtree scheduler.
2007-01-07 02:12:57 +01:00
Willy Tarreau
42afc3b5a3 [MINOR] Makefile: git-log may return multiple dates in case of merges. 2007-01-07 02:08:22 +01:00
Willy Tarreau
368e96ad88 [MINOR] [STATS] swap color sets for active and backup servers
colors had incidently been swapped during the stats page rewrite.
Thanks to Sin Yu for noticing it.
2007-01-07 02:08:18 +01:00
Willy Tarreau
6d1a9884f9 [MAJOR] complete support and doc for tcp-splicing
The tcp-splicing code has been merged, and a doc has been written.
A configuration example has been derived from the previous content
switching sample.
2007-01-07 02:03:04 +01:00
Willy Tarreau
8f922fcc3c [MINOR] added the "tcpsplice" option
it does nothing yet except set the minimal options.
2007-01-06 23:45:24 +01:00
Willy Tarreau
4fee4e9d32 [MINOR] the options table now sets the prerequisite checks
Some options will need some checks (or initializations) to be performed
before starting everything. The cfg_opts table has been extended to
allow storing of options-dependant checks.
2007-01-06 21:09:17 +01:00
Willy Tarreau
85270da1d9 [MINOR] updated versions and docs
The version was not updated in some files. Also, added a few
example configs.
2007-01-02 00:59:39 +01:00
Willy Tarreau
6620dbb47a [RELEASE] released 1.3.4
Released 1.3.4 with the following major changes :
    - support for cttproxy on the server side to present the client
      address to the server.
    - added support for SO_REUSEPORT on Linux (needs kernel patch)
    - new RFC2616-compliant HTTP request parser with header indexing
    - split proxies in frontends, rulesets and backends
    - implemented the 'req[i]setbe' to select a backend depending
      on the contents
    - added the 'default_backend' keyword to select a default BE.
    - new stats page featuring FEs and BEs + bytes in both dirs
    - improved log format to indicate the backend and the time in ms.
    - lots of cleanups
2007-01-02 00:44:53 +01:00
Willy Tarreau
35d66b0c28 [MINOR] added byte count to sessions and statistics.
Now the stats page reports the IN and OUT byte counts per FE,
BE and SRV.
2007-01-02 00:28:21 +01:00
Willy Tarreau
41dff82b54 [CRITICAL] fixed memory leak in session_free()
Since the introduction of hdr_idx, session_free() had not
been updated to free the header ! It implied a consumption
of about 400 bytes per new session.
2007-01-01 23:32:30 +01:00
Willy Tarreau
5fdfb911a0 [MEDIUM] implemented the "default_backend" keyword
The "default_backend" keyword used in a frontend sets the
default backend which will be used if no setbe rule matches.
2007-01-01 23:11:07 +01:00
Willy Tarreau
128e954663 [MINOR] stats: factorize many chunk_printf()
Improve code size, speed and readability by factoring many
calls to chunk_printf().
2007-01-01 22:01:43 +01:00
Willy Tarreau
c0dde7a8ed [MAJOR] udpated the stats page to clearly distinguish FEs and BEs
The stats page could not tell the difference between a FE and a BE.
It has been revamped to indicate all relevant information. The font
is also slightly smaller in order for all the info to fit into small
screens. The data output path has been greatly simplified to use
string chunks.
2007-01-01 21:38:07 +01:00
Willy Tarreau
2b5652f9fa [MINOR] indicate the proxy type in the logs after a loss of servers
When the last server goes down in a backend, indicate 'backend' or
'listener' in the log message depending on the type of the backend.
2006-12-31 17:46:05 +01:00
Willy Tarreau
13943abbd2 [MEDIUM] use an array to store most common options
Most common options are now stored in an array which eases
the parsing and which also permits reporting of ignored
options depending on the proxy's capabilities (back/front).
2006-12-31 00:24:10 +01:00
Willy Tarreau
e01954f45e [MINOR] option httpclose is now checked both in FE and BE
The "httpclose" option affects both frontend and backend, so it
was logical to check for its presence at both places. A request
which traverses either a frontend or a backend with this option
set will have a "Connection: close" header appended.
2006-12-30 23:43:54 +01:00
Willy Tarreau
ebd6160dd3 [MEDIUM] updated log format to report frontend and backend
The log format has been slightly updated to separately report the name
of the frontend and the name of the backend. The accept date has been
enhanced to report the millisecond. The number of remaining connections
has also been updated and their order reversed, to include the number
of connections on the frontend. The new log format is now :

  -  $1: IP:port
  -  $2: accept date in this format : [dd/mm/YYYY:HH:MM:SS.ttt]
  -  $3: frontend name
  -  $4: backend name '/' server name
  -  $5: req time '/' queue time '/' conn time '/' header time '/' total time
  -  $6: HTTP status code
  -  $7: number of bytes returned
  -  $8: captures (request)
  -  $9: captures (response)
  - $10: completion flags
  - $11: remaining conns on process '/' frontend '/' backend '/' server
  - $12: srv queue size '/' backend queue size
  - $13..: '"' full request '"'
2006-12-30 11:54:15 +01:00
Willy Tarreau
977b8e41ba [MAJOR] distinguish between frontend, backend, ruleset and listen
The notion of capabilities has been added to the proxy so that we
know whether a proxy supports frontend, backend, or rulesets. Given
this, some parameters are optionnal, some are ignored with a warning
and others are forbidden. It is now possible to write valid two level
configs without binding to dummy address/ports.
2006-12-29 14:19:17 +01:00
Willy Tarreau
8603431822 [MEDIUM] split fe->maxconn into fe->maxconn and be->fullconn
The maxconn argument is used only for the listeners, and the
fullconn is used only for the backends. If unset, it inherits
maxconn's value which itself can inherit the default or the
global value (we might need to change this).
2006-12-29 00:10:33 +01:00
Willy Tarreau
97de624c17 [MEDIUM] session logging is now defined by the frontend
To solve the logging maze, it has been decided that the frontend
and nothing else will define how a session will be logged. It might
change in the future but at least this choice allows all sort of
fantasies.
2006-12-27 17:18:38 +01:00
Willy Tarreau
8058743d7a [MEDIUM] errorloc now checked first from backend then from frontend
It is now possible to define an errorloc in the backend as well as
in the frontend. The backend's will be used first, and if undefined,
then the frontend's will be used instead. If none is used, then the
original error messages will be used.
2006-12-24 17:47:20 +01:00
Willy Tarreau
0f77253a22 [MINOR] store HTTP error messages into a chunk array
HTTP error messages were all specific cases handled by an IF.
Now they are all in an array so that it will be easier to add
new ones. Also, the return functions now use chunks as inputs
so that it should be easier to provide alternative return
messages if needed.
2006-12-23 20:51:41 +01:00
Willy Tarreau
9bf6c6e24f [BUILD] makefile now detects and uses git to set the version
If git is found during the build process, then it will be used
to set the version, the commit number and the commit date. This
way, it will not be needed anymore to update the code to change
the version. The version is the last tag, and the commit number
is the number of commits since the last tag.
2006-12-23 11:12:04 +01:00
Willy Tarreau
79b34bfe0f [BUILD] version and date now come from the makefile 2006-12-22 15:28:43 +01:00