haproxy/include/proto
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 [MEDIUM] acl: when possible, report the name and requirements of ACLs in warnings 2008-08-03 09:41:05 +02:00
backend.h [CLEANUP] backend: move LB algos to individual files 2009-10-01 11:19:37 +02:00
buffers.h [OPTIM] stats: check free space before trying to print 2009-10-11 23:35:10 +02:00
checks.h [MEDIUM] Collect & show information about last health check, v3 2009-09-23 23:15:36 +02: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 [MINOR] stats: use a dedicated state to output static data 2009-10-11 23:12:51 +02:00
fd.h [MEDIUM] Fix memory freeing at exit 2008-05-30 07:07:19 +02:00
freq_ctr.h [MINOR] include time.h from freq_ctr.h as is uses "now". 2009-10-01 11:05: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
lb_chash.h [MEDIUM] backend: implement consistent hashing variation 2009-10-09 07:17:58 +02:00
lb_fwlc.h [CLEANUP] backend: move LB algos to individual files 2009-10-01 11:19:37 +02:00
lb_fwrr.h [CLEANUP] backend: move LB algos to individual files 2009-10-01 11:19:37 +02:00
lb_map.h [MINOR] lb_map: reorder code in order to ease integration of new hash functions 2009-10-01 21:11:15 +02: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-06-10 12:23:32 +02:00
proto_http.h [MEDIUM] appsession: add the "request-learn" option 2009-10-18 11:56:26 +02:00
proto_tcp.h [MEDIUM] move connection establishment from backend to the SI. 2009-08-16 17:46:15 +02:00
proto_uxst.h [CLEANUP] unix: remove uxst_process_session() 2009-08-16 19:34:23 +02:00
protocols.h [MINOR] add a generic unbind_all_listeners() primitive 2007-11-04 22:42:49 +01:00
proxy.h [MINOR] proxy: provide function to retrieve backend/server pointers 2009-10-10 18:36:25 +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 [OPTIM] counters: move some max numbers to the counters struct 2009-10-04 23:26:19 +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 [MINOR] stream_interface: add functions to support running as internal/external tasks 2009-09-23 23:52:15 +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