haproxy/include/types
Cyril Bonté bf47aeb946 [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).
2009-10-18 11:56:26 +02:00
..
acl.h [MINOR] config: add pointer to file name in block/redirect/use_backend/monitor rules 2009-10-04 22:02:50 +02:00
backend.h [MEDIUM] backend: implement consistent hashing variation 2009-10-09 07:17:58 +02:00
buffers.h [MAJOR] buffer: flag BF_DONT_READ to disable reads when not required 2009-10-18 08:52:24 +02:00
capture.h [MAJOR] last bunch of capture changes for mempool v2 2007-05-13 22:46:04 +02:00
checks.h [MEDIUM] Health check reporting code rework + health logging, v3 2009-10-01 10:17:37 +02:00
counters.h [MINOR] Collect & provide http response codes received from servers 2009-10-14 21:49:53 +02:00
fd.h [MEDIUM] fd: merge fd_list into fdtab 2009-10-18 08:20: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 [MEDIUM] add access restrictions to the stats socket 2009-10-10 17:13:00 +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
lb_chash.h [MEDIUM] backend: implement consistent hashing variation 2009-10-09 07:17:58 +02:00
lb_fwlc.h [CLEANUP] proxy: move last lb-specific bits to their respective files 2009-10-03 18:41:18 +02:00
lb_fwrr.h [CLEANUP] proxy: move last lb-specific bits to their respective files 2009-10-03 18:41:18 +02:00
lb_map.h [CLEANUP] proxy: move last lb-specific bits to their respective files 2009-10-03 18:41:18 +02: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-06-10 12:23:32 +02:00
proto_http.h [MEDIUM] Collect & provide separate statistics for sockets, v2 2009-10-04 18:56:02 +02:00
proto_tcp.h [MAJOR] implement tcp request content inspection 2008-07-16 10:29:07 +02:00
protocols.h [MINOR] tcp: add support for the defer_accept bind option 2009-10-13 07:34:14 +02:00
proxy.h [MEDIUM] appsession: add the "request-learn" option 2009-10-18 11:56:26 +02:00
queue.h [MAJOR] ported pendconn to mempools v2 2007-05-13 20:19:55 +02:00
server.h [MINOR] Capture & display more data from health checks, v2 2009-10-10 21:51:16 +02:00
session.h [MEDIUM] appsession: add the "request-learn" option 2009-10-18 11:56:26 +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:01:18 +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