blob: 2d1cb89a059e477469b2f980e970c22f4af6da66 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001How it works ? (unfinished and inexact)
2
3For TCP and HTTP :
4
5- listeners create listening sockets with a READ callback pointing to the
6 protocol-specific accept() function.
7
8- the protocol-specific accept() function then accept()'s the connection and
9 instantiates a "server TCP socket" (which is dedicated to the client side),
10 and configures it (non_block, get_original_dst, ...).
11
12For TCP :
13- in case of pure TCP, a request buffer is created, as well as a "client TCP
14 socket", which tries to connect to the server.
15
16- once the connection is established, the response buffer is allocated and
17 connected to both ends.
18
19- both sockets are set to "autonomous mode" so that they only wake up their
20 supervising session when they encounter a special condition (error or close).
21
22
23For HTTP :
24- in case of HTTP, a request buffer is created with the "HOLD" flag set and
25 a read limit to support header rewriting (may be this one will be removed
26 eventually because it's better to limit only to the buffer size and report
27 an error when rewritten data overflows)
28
29- a "flow analyzer" is attached to the buffer (or possibly multiple flow
30 analyzers). For the request, the flow analyzer is "http_lb_req". The flow
31 analyzer is a function which gets called when new data is present and
32 blocked. It has a timeout (request timeout). It can also be bypassed on
33 demand.
34
35- when the "http_lb_req" has received the whole request, it creates a client
36 socket with all the parameters needed to try to connect to the server. When
37 the connection establishes, the response buffer is allocated on the fly,
38 put to HOLD mode, and a an "http_lb_resp" flow analyzer is attached to the
39 buffer.
40
41
42For client-side HTTPS :
43
44- the accept() function must completely instantiate a TCP socket + an SSL
45 reader. It is when the SSL session is complete that we call the
46 protocol-specific accept(), and create its buffer.
47
48
49
50
51Conclusions
52-----------
53
54- we need a generic TCP accept() function with a lot of flags set by the
55 listener, to tell it what info we need to get at the accept() time, and
56 what flags will have to be set on the socket.
57
58- once the TCP accept() function ends, it wakes up the protocol supervisor
59 which is in charge of creating the buffers, etc, switch states, etc...
60