haproxy/include/types
Cyril Bonté 7433c2a4b3 [MEDIUM] appsession: add the "request-learn" option
This patch has 2 goals :

1. I wanted to test the appsession feature with a small PHP code,
using PHPSESSID. The problem is that when PHP gets an unknown session
id, it creates a new one with this ID. So, when sending an unknown
session to PHP, persistance is broken : haproxy won't see any new
cookie in the response and will never attach this session to a
specific server.

This also happens when you restart haproxy : the internal hash becomes
empty and all sessions loose their persistance (load balancing the
requests on all backend servers, creating a new session on each one).
For a user, it's like the service is unusable.

The patch modifies the code to make haproxy also learn the persistance
from the client : if no session is sent from the server, then the
session id found in the client part (using the URI or the client cookie)
is used to associated the server that gave the response.

As it's probably not a feature usable in all cases, I added an option
to enable it (by default it's disabled). The syntax of appsession becomes :

  appsession <cookie> len <length> timeout <holdtime> [request-learn]

This helps haproxy repair the persistance (with the risk of losing its
session at the next request, as the user will probably not be load
balanced to the same server the first time).

2. This patch also tries to reduce the memory usage.
Here is a little example to explain the current behaviour :
- Take a Tomcat server where /session.jsp is valid.
- Send a request using a cookie with an unknown value AND a path
  parameter with another unknown value :

  curl -b "JSESSIONID=12345678901234567890123456789012" http://<haproxy>/session.jsp;jsessionid=00000000000000000000000000000001

(I know, it's unexpected to have a request like that on a live service)
Here, haproxy finds the URI session ID and stores it in its internal
hash (with no server associated). But it also finds the cookie session
ID and stores it again.

- As a result, session.jsp sends a new session ID also stored in the
  internal hash, with a server associated.

=> For 1 request, haproxy has stored 3 entries, with only 1 which will be usable

The patch modifies the behaviour to store only 1 entry (maximum).

Similar patch was merged in 1.4 with commit ID bf47aeb946.
2009-10-18 11:58:53 +02:00
..
acl.h [MEDIUM] acl: set types on all currently known ACL verbs 2008-07-25 19:31:03 +02:00
backend.h [MEDIUM] add support for "balance hdr(name)" 2009-05-10 15:50:15 +02:00
buffers.h [OPTIM] buffer: new BF_READ_DONTWAIT flag reduces EAGAIN rates 2009-03-21 21:57:30 +01:00
capture.h [MAJOR] last bunch of capture changes for mempool v2 2007-05-13 22:46:04 +02:00
fd.h [MEDIUM] add support for binding to source port ranges during connect 2009-07-14 20:13:26 +02:00
freq_ctr.h [MEDIUM] measure and report session rate on frontend, backends and servers 2009-03-05 18:43:00 +01:00
global.h [MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2 2009-10-03 20:01:52 +02:00
hdr_idx.h [BUG] files were missing for hdr_idx in previous commit 2006-12-04 02:20:02 +01:00
httperr.h [MAJOR] udpated the stats page to clearly distinguish FEs and BEs 2007-01-01 21:38:07 +01:00
log.h [BUILD] fix build on AIX due to recent log changes 2007-12-05 11:11:55 +01:00
pipe.h [MEDIUM] introduce pipe pools 2009-01-25 13:49:53 +01:00
port_range.h [MEDIUM] add support for binding to source port ranges during connect 2009-07-14 20:13:26 +02:00
proto_http.h [MEDIUM] http: add options to ignore invalid header names 2009-04-02 21:36:34 +02:00
proto_tcp.h [MAJOR] implement tcp request content inspection 2008-07-16 10:29:07 +02:00
protocols.h [MEDIUM] minor update to the task api: let the scheduler queue itself 2009-03-08 09:38:41 +01:00
proxy.h [MEDIUM] appsession: add the "request-learn" option 2009-10-18 11:58:53 +02:00
queue.h [MAJOR] ported pendconn to mempools v2 2007-05-13 20:19:55 +02:00
server.h [MEDIUM] add support for binding to source port ranges during connect 2009-07-14 20:13:26 +02:00
session.h [MEDIUM] appsession: add the "request-learn" option 2009-10-18 11:58:53 +02:00
signal.h [MINOR] add basic signal handling functions 2009-05-10 09:24:23 +02:00
stream_interface.h [MEDIUM] new option "independant-streams" to stop updating read timeout on writes 2009-10-03 22:11:50 +02:00
task.h [MINOR] show sess: report number of calls to each task 2009-03-28 17:54:35 +01:00
template.h [CLEANUP] included common/version.h everywhere 2006-06-29 18:54:54 +02:00