Commit Graph

295 Commits

Author SHA1 Message Date
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
Willy Tarreau
a69468af66 Merge branch 'master' of home:/data/git/public/haproxy-1.3 2006-12-22 14:41:19 +01:00
Willy Tarreau
075a12284c [MINOR] forgot to include common/tools.h in the archive.
tools.h contains several commonly-used macros such as MIN()
and MAX().
2006-12-22 14:40:41 +01:00
Willy Tarreau
14d43834f5 [BUILD] updated .gitignore 2006-12-19 18:03:12 +01:00
Willy Tarreau
0ea7c431fc [DOC] added a short descriptive of the backend mechanism 2006-12-18 00:24:49 +01:00
Willy Tarreau
c21aa083df [BUILD] fixed the "git-tar" target in the Makefile
The git-tar target did not work correctly anymore, probably because
of a recent change in the output of "git-describe --tags". This is
now fixed.
2006-12-18 00:15:06 +01:00
Willy Tarreau
5fc49f2fc3 [DOC] updated TODO with remaining l7-switch work 2006-12-17 23:32:53 +01:00
Willy Tarreau
a496b6042b [MAJOR] merged the 'setbe' actions to switch the backend on a regex
Sin Yu's patch to permit to change the proxy from a regex was merged
with little changes :
  - req_cap/rsp_cap are not reassigned to the new proxy, they stay
    attached to the frontend

  - the actions have been renamed "reqsetbe" and "reqisetbe" for
    "set BackEnd".

  - the buffer is not reset after the switch, instead, the headers are
    parsed again by the backend

  - in Sin's patch, it was theorically possible to switch multiple times,
    but the switching track was lost, making it impossible to apply
    server responsesin the reverse order. Now switching is limited to
    1 action (separation between frontend and backend) but the filters
    remain.

Now it will be extremely easy to add other switching conditions, such
as host matching, URI matching, etc...

There's still a hard work to be done on the logs and stats.
2006-12-17 23:15:24 +01:00
Willy Tarreau
ddb358d932 [MEDIUM] tried to clean the logs up a little bit
The logs have become a real mess. It is now very hard to tell which
frontend/backend will impose its configuration for the logs. This
needs a complete rework but at least it should work.
2006-12-17 22:55:52 +01:00
Willy Tarreau
f1221aa19f [MEDIUM] separated nbconn into feconn and beconn
The nbconn attribute in the proxies was not relevant anymore because
a frontend A may use backend B and both of them must account for their
respective connections. For this reason, there now are two separate
counters for frontend and backend connections.

The stats page has been updated to reflect the backend, but a separate
line entry for the frontend with error counts would be good.

Note that as of now, beconn may be higher than maxconn, because maxconn
applies to the frontend, while beconn may be increased due to sessions
passed from another frontend.
2006-12-17 22:14:12 +01:00
Willy Tarreau
830ff458de [MAJOR] reworked ->be, ->fe and ->fi in sessions
There was a confusion about the way to find filters and backend
parameters from sessions. The chaining has been changed between
the session and the proxy.

Now, a session knows only two proxies : one frontend (->fe) and
one backend (->be). Each proxy has a link to the proxy providing
filters and to the proxy providing backend parameters (both self
by default).

The captures (cookies and headers) have been attached to the
frontend's filters for now.

The uri_auth and the statistics are attached to the backend's
filters so that the uri can depend on a hostname for instance.
2006-12-17 19:31:23 +01:00
Willy Tarreau
97a738f32c [MINOR] add the fiprm and beprm indirections to struct proxy
A proxy will be able to borrow parameters from another one.
In particular, the filters will be inheritable from another
proxy, and the backend parameters too.
2006-12-17 18:02:30 +01:00
Willy Tarreau
b251390f7e [MEDIUM] moved uri_auth check to a separate function
The check of uri_auth is now in a separate function which is
checked after every backend switch, so that it will be possible
to have an uri_auth for the frontend and another one for the
backend.
2006-12-17 14:52:38 +01:00
Willy Tarreau
921d7c0a70 [MINOR] removed the SN_POST flag and string checks on method
Now that hreq.meth is known, use it everywhere a method is required.
2006-12-17 13:50:27 +01:00
Willy Tarreau
53b6c74d06 [MEDIUM] check the HTTP method after all filters have been applied
The HTTP method is now checked and saved into hreq.meth. It will be
usable at several places instead of those dirty string comparisons.
2006-12-17 13:37:46 +01:00
Willy Tarreau
230fd0bfdf [MEDIUM] optimized the request parser a bit more
Some while() constructs are not very efficient with gcc, yet they are
used to scan all the text in the start line and the headers. Replacing
them with more efficient (but ugly) loops provides a global gain of
about 2%, which is not bad at all !
2006-12-17 12:05:00 +01:00
Willy Tarreau
976f1ee561 [MINOR] reorganized the request parser states to improve speed
The most commonly branched states have been grouped in the first
ifs.
2006-12-17 10:06:03 +01:00
Willy Tarreau
06619265b1 [MEDIUM] reorganized request handling to prepare for content-switching
The filters are now iterated for FE, FI, BE.

Some grey areas remain :
  - uri_auth has been propagated to the backend, but in fact it
    should be checked at every level (fe, fi, be), depending
    where it is declared, and before the filters.

  - the HTTP method and URI should be stored and propagated everywhere
    they are used. For this, we would need to first apply filters to
    be aware of filter changes which affect them.

  - there seems to be no need anymore for hdr_idx[0] being empty.
    It may contain the start line, which will slightly improve
    performance and make the code easier to read.
2006-12-17 08:37:22 +01:00
Willy Tarreau
45e73e3cd9 [MEDIUM] move all HTTP Request-related session material to struct hreq
The req_cap, hdr_state, hdr_idx, auth_hdr and req_line have been moved
to a dedicated hreq structure in the session. It makes is easier to
add HTTP-specific fields such as SOR (start of request) and EOF (end
of headers).

It also made it possible to fix two bugs introduced by last commit :
 - end of headers not correctly detected
 - hdr_idx not freed upon one specific error during session creation

When the backend side will be reworked, it should rely on a similar
structure.
2006-12-17 00:05:15 +01:00
Willy Tarreau
8a68c24b91 [BUILD] debug.h had a typo. Also add FSM_PRINTF to debug FSM only. 2006-12-16 23:22:58 +01:00
Willy Tarreau
a4cd1f50cc [MEDIUM] make process_cli() not depend on req->h anymore
Local variables now keep the start and end of line at any moment.
req->h has been removed and will soon be removable from the buffer.
2006-12-16 19:57:26 +01:00
Willy Tarreau
09733ab109 [MINOR] add .gitignore 2006-12-16 19:56:22 +01:00
Willy Tarreau
1d488b6e10 [MINOR] added include/common/debug.h
This file will provide debugging macros such as DPRINTF.
2006-12-16 19:54:02 +01:00
Willy Tarreau
f224273df3 [BUILD] last commit did not build 2006-12-16 19:00:29 +01:00
Willy Tarreau
e15d9132df [MEDIUM] reference and index appended request headers
When headers are appended to the end of a request, they must
be indexed.
2006-12-14 22:26:42 +01:00
Willy Tarreau
2a32428926 [MAJOR] finished replacement of the client-side HTTP parser with a new one
The code is working again, but not as clean as it could be.
Many blocks should still move to dedicated functions. req->h
must be removed everywhere and updated everytime needed.

A few functions or macros should take care of the headers
during header insertion/deletion/change.
2006-12-05 00:05:46 +01:00
Willy Tarreau
58f10d7478 [MAJOR] replaced the client-side HTTP parser with a new one
The new parser uses an FSM to strictly follow RFC2616.
Headers are indexed and parsed only once they're all available.
That way, complex regexes make more sense.

HTTP processing is now performed in several phases by calling
multiple functions, making the code cleaner and easier to read.

Note that req[i]pass does not work anymore because it would
require that we mark a header to be ignored. What is really
needed is to have the ability to add an exception to a matching
(match xx except yy).

Several bugs have been fixed in appsession during the conversion
to the new FSM (method length and recovery on malloc errors).

The code does build and work with the debug examples, but is
not usable yet to connect to anything as it does not forward
the requests yet.
2006-12-04 02:26:12 +01:00
Willy Tarreau
b7eba10304 [BUG] files were missing for hdr_idx in previous commit 2006-12-04 02:20:02 +01:00
Willy Tarreau
e5f20dcea8 [MEDIUM] added the hdr_idx structure for future HTTP header indexing
This structure will consume 4 bytes per header to keep track of
headers within a request or a response without having to parse
the whole request for each regex. As it's not possible to allocate
only 4 bytes, we define a max number of HTTP headers. We set it
to (BUFSIZE+79)/80 so that 8kB buffers can contain 100 headers
(like Apache), resulting in 400 bytes dedicated to indexation,
or about 400/(2*8kB) ~= 2.4% of the memory usage.
2006-12-03 15:21:35 +01:00
Willy Tarreau
09536952b3 Merge branch 'rfc2616' into switch 2006-12-02 20:13:39 +01:00
Willy Tarreau
669e6da163 [BUG] implemented support for multi-line headers as required by RFC2616.
This patch was added in 1.2.9 but was then incidentely reverted by
  manipulation error when merging next patch (enforce max number of
  conns). It's now merged again.
2006-12-02 20:12:55 +01:00