haproxy/include/proto
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: when possible, report the name and requirements of ACLs in warnings 2008-08-03 09:41:05 +02:00
backend.h [MAJOR] migrate the connection logic to stream interface 2008-11-02 10:19:10 +01:00
buffers.h [BUG] buffer_forward() would not correctly consider data already scheduled 2009-10-03 19:16:22 +02:00
checks.h [MEDIUM] minor update to the task api: let the scheduler queue itself 2009-03-08 09:38:41 +01:00
client.h [CLEANUP] remove unused include/types/client.h 2008-07-16 10:30:40 +02:00
cttproxy.h [MEDIUM] check for cttproxy support when required 2007-03-24 17:24:39 +01:00
dumpstats.h [MEDIUM] implement error dump on unix socket with "show errors" 2009-03-04 15:53:18 +01:00
fd.h [MEDIUM] Fix memory freeing at exit 2008-05-30 07:07:19 +02:00
freq_ctr.h [CLEANUP] include time.h from freq_ctr.h as it uses "now". 2009-10-03 19:32:26 +02:00
hdr_idx.h [MAJOR] huge rework of the HTTP request FSM 2007-01-21 19:16:41 +01:00
httperr.h [MEDIUM] errorloc now checked first from backend then from frontend 2006-12-24 17:47:20 +01:00
log.h [BUILD] add format(printf) to printf-like functions 2009-04-03 12:01:47 +02: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] appsession: add the "request-learn" option 2009-10-18 11:58:53 +02:00
proto_tcp.h [MEDIUM] extract TCP request processing from HTTP 2008-11-30 23:15:34 +01:00
proto_uxst.h [MEDIUM] minor update to the task api: let the scheduler queue itself 2009-03-08 09:38:41 +01:00
protocols.h [MINOR] add a generic unbind_all_listeners() primitive 2007-11-04 22:42:49 +01:00
proxy.h [MEDIUM] config: split parser and checker in two functions 2009-07-14 20:17:07 +02:00
queue.h [BUG] do not dequeue the backend's pending connections on a dead server 2008-12-07 23:51:12 +01:00
server.h [MINOR] compute the max of sessions/s on fe/be/srv 2009-05-10 18:52:49 +02:00
session.h [BUG] session: errors were not reported in termination flags in TCP mode 2009-03-15 22:34:05 +01:00
signal.h [MINOR] add basic signal handling functions 2009-05-10 09:24:23 +02:00
stream_interface.h [BUILD] stream_interface: fix conflicting declaration 2009-10-03 19:25:25 +02:00
stream_sock.h [MEDIUM] enable inter-stream_interface wakeup calls 2008-12-28 11:09:02 +01: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