Commit Graph

5111 Commits

Author SHA1 Message Date
Willy Tarreau
bd99d5818d BUG/MAJOR: http: don't manipulate the server connection if it's killed
Jesse Hathaway reported a crash that Cyril Bonté diagnosed as being
caused by the manipulation of srv_conn after setting it to NULL. This
happens in http-server-close mode when the server returns either a 401
or a 407, because the connection was previously closed then it's being
assigned the CO_FL_PRIVATE flag.

This bug only affects 1.6-dev as it was introduced by connection reuse code
with commit 387ebf8 ("MINOR: connection: add a new flag CO_FL_PRIVATE").
2015-09-02 10:52:05 +02:00
Willy Tarreau
61d301fbfb [RELEASE] Released version 1.6-dev4
Released version 1.6-dev4 with the following main changes :
    - MINOR: log: Add log-format variable %HQ, to log HTTP query strings
    - DOC: typo in 'redirect', 302 code meaning
    - DOC: typos in tcp-check expect examples
    - DOC: resolve-prefer default value and default-server update
    - MINOR: DNS counters: increment valid counter
    - BUG/MEDIUM: DNS resolution response parsing broken
    - MINOR: server: add new SRV_ADMF_CMAINT flag
    - MINOR: server SRV_ADMF_CMAINT flag doesn't imply SRV_ADMF_FMAINT
    - BUG/MEDIUM: dns: wrong first time DNS resolution
    - BUG/MEDIUM: lua: Lua tasks fail to start.
    - BUILD: add USE_LUA to BUILD_OPTIONS when it's used
    - DOC/MINOR: fix OpenBSD versions where haproxy works
    - MINOR: 51d: unable to start haproxy without "51degrees-data-file"
    - BUG/MEDIUM: peers: fix wrong message id on stick table updates acknowledgement.
    - BUG/MAJOR: peers: fix current table pointer not re-initialized on session release.
    - BUILD: ssl: Allow building against libssl without SSLv3.
    - DOC: clarify some points about SSL and the proxy protocol
    - DOC: mention support for RFC 5077 TLS Ticket extension in starter guide
    - BUG/MEDIUM: mailer: DATA part must be terminated with <CRLF>.<CRLF>
    - DOC: match several lua configuration option names to those implemented in code
    - MINOR cfgparse: Correct the mailer warning text to show the right names to the user
    - BUG/MINOR: ssl: TLS Ticket Key rotation broken via socket command
    - MINOR: stream: initialize the current_rule field to NULL on stream init
    - BUG/MEDIUM: lua: timeout error with converters, wrapper and actions.
    - CLEANUP: proto_http: remove useless initialisation
    - CLEANUP: http/tcp actions: remove the scope member
    - BUG/MINOR: proto_tcp: custom action continue is ignored
    - MINOR: proto_tcp: add session in the action prototype
    - MINOR: vars: reduce the code size of some wrappers
    - MINOR: Move http method enum from proto_http to sample
    - MINOR: sample: Add ipv6 to ipv4 and sint to ipv6 casts
    - MINOR: sample/proto_tcp: export "smp_fetch_src"
    - MEDIUM: cli: rely on the map's output type instead of the sample type
    - BUG/MEDIUM: stream: The stream doen't inherit SC from the session
    - BUG/MEDIUM: vars: segfault during the configuration parsing
    - BUG/MEDIUM: stick-tables: refcount error after copying SC for the session to the stream
    - BUG/MEDIUM: lua: bad error processing
    - MINOR: samples: rename a struct from sample_storage to sample_data
    - MINOR: samples: rename some struct member from "smp" to "data"
    - MEDIUM: samples: Use the "struct sample_data" in the "struct sample"
    - MINOR: samples: extract the anonymous union and create the union sample_value
    - MINOR: samples: rename union from "data" to "u"
    - MEDIUM: 51degrees: Adapt the 51Degrees library
    - MINOR: samples: data assignation simplification
    - MEDIUM: pattern/map: Maps can returns various types
    - MINOR: map: The map can return IPv4 and IPv6
    - MEDIUM: actions: Merge (http|tcp)-(request|reponse) action structs
    - MINOR: actions: Remove the data opaque pointer
    - MINOR: lua: use the hlua_rule type in place of opaque type
    - MINOR: vars: use the vars types as argument in place of opaque type
    - MINOR: proto_http: use an "expr" type in place of generic opaque type.
    - MINOR: proto_http: replace generic opaque types by real used types for the actions on thr request line
    - MINOR: proto_http: replace generic opaque types by real used types in "http_capture"
    - MINOR: proto_http: replace generic opaque types by real used types in "http_capture" by id
    - MEDIUM: track-sc: Move the track-sc configuration storage in the union
    - MEDIUM: capture: Move the capture configuration storage in the union
    - MINOR: actions: add "from" information
    - MINOR: actions: remove the mark indicating the last entry in enum
    - MINOR: actions: Declare all the embedded actions in the same header file
    - MINOR: actions: change actions names
    - MEDIUM: actions: Add standard return code for the action API
    - MEDIUM: actions: Merge (http|tcp)-(request|reponse) keywords structs
    - MINOR: proto_tcp: proto_tcp.h is now useles
    - MINOR: actions: mutualise the action keyword lookup
    - MEDIUM: actions: Normalize the return code of the configuration parsers
    - MINOR: actions: Remove wrappers
    - MAJOR: stick-tables: use sample types in place of dedicated types
    - MEDIUM: stick-tables: use the sample type names
    - MAJOR: stick-tables: remove key storage from the key struct
    - MEDIUM: stick-tables: Add GPT0 in the stick tables
    - MINOR: stick-tables: Add GPT0 access
    - MINOR: stick-tables: Add GPC0 actions
    - BUG/MEDIUM: lua: the lua fucntion Channel:close() causes a segfault
    - DOC: ssl: missing LF
    - MINOR: lua: add core.done() function
    - DOC: fix function name
    - BUG/MINOR: lua: in some case a sample may remain undefined
    - DOC: fix "http_action_set_req_line()" comments
    - MINOR: http: Action for manipulating the returned status code.
    - MEDIUM: lua: turns txn:close into txn:done
    - BUG/MEDIUM: lua: cannot process more Lua hooks after a "done()" function call
    - BUILD: link with libdl if needed for Lua support
    - CLEANUP: backend: factor out objt_server() in connect_server()
    - MEDIUM: backend: don't call si_alloc_conn() when we reuse a valid connection
    - MEDIUM: stream-int: simplify si_alloc_conn()
    - MINOR: stream-int: add new function si_detach_endpoint()
    - MINOR: server: add a list of private idle connections
    - MINOR: connection: add a new list member in the connection struct
    - MEDIUM: stream-int: queue idle connections at the server
    - MINOR: stream-int: make si_idle_conn() only accept valid connections
    - MINOR: server: add a list of already used idle connections
    - MINOR: connection: add a new flag CO_FL_PRIVATE
    - MINOR: config: add new setting "http-reuse"
    - MAJOR: backend: initial work towards connection reuse
    - MAJOR: backend: improve the connection reuse mechanism
    - MEDIUM: backend: implement "http-reuse safe"
    - MINOR: server: add a list of safe, already reused idle connections
    - MEDIUM: backend: add the "http-reuse aggressive" strategy
    - DOC: document the new http-reuse directive
    - DOC: internals: document next steps for HTTP connection reuse
    - DOC: mention that %ms is left-padded with zeroes.
    - MINOR: init: indicate to check 'bind' lines when no listeners were found.
    - MAJOR: http: remove references to appsession
    - CLEANUP: config: remove appsession initialization
    - CLEANUP: appsession: remove appsession.c and sessionhash.c
    - CLEANUP: tests: remove sessionhash_test.c and test-cookie-appsess.cfg
    - CLEANUP: proxy: remove last references to appsession
    - CLEANUP: appsession: remove the last include files
    - DOC: remove documentation about appsession
    - CLEANUP: .gitignore: ignore more test files
    - CLEANUP: .gitignore: finally ignore everything but what is known.
    - MEDIUM: config: emit a warning on a frontend without listener
    - DOC: add doc/internals/entities-v2.txt
    - DOC: add doc/linux-syn-cookies.txt
    - DOC: add design thoughts on HTTP/2
    - DOC: add some thoughts on connection sharing for HTTP/2
    - DOC: add design thoughts on dynamic buffer allocation
    - BUG/MEDIUM: counters: ensure that src_{inc,clr}_gpc0 creates a missing entry
    - DOC: add new file intro.txt
    - MAJOR: tproxy: remove support for cttproxy
    - BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2
    - DOC: lua: replace txn:close with txn:done in lua-api
    - DOC: intro: minor updates and fixes
    - DOC: intro: fix too long line.
    - DOC: fix example of http-request using ssl_fc_session_id
    - BUG/MEDIUM: lua: txn:done() still causes a segfault in TCP mode
    - CLEANUP: lua: fix some indent issues
    - BUG/MEDIUM: lua: fix a segfault in txn:done() if called twice
    - DOC: lua: mention than txn:close was renamed txn:done.
2015-08-30 00:17:17 +02:00
Baptiste Assmann
f046f11561 BUG/MEDIUM: dns: wrong first time DNS resolution
First DNS resolution is supposed to be triggered by first health check,
which is not the case with current code.
This patch fixes this behavior by setting the
resolution->last_resolution time to 0 instead of now_ms when parsing
server's configuration at startup.
2015-08-28 17:23:04 +02:00
Willy Tarreau
bc183a6eda DOC: lua: mention than txn:close was renamed txn:done.
Also indicate that it's not limited to error processing.
2015-08-28 10:39:11 +02:00
Willy Tarreau
630ef4585a BUG/MEDIUM: lua: fix a segfault in txn:done() if called twice
When called from an http ruleset, txn:done() can still crash the process
because it closes the stream without consuming pending data resulting in
the transaction's buffer representation to differ from the real buffer.

This patch also adjusts the transaction's state to indicate that it's
closed to be consistent with what's already done in redirect rules.
2015-08-28 10:28:24 +02:00
Willy Tarreau
a678b43119 CLEANUP: lua: fix some indent issues
Just the result from a few copy-pastes with different tab sizes.
2015-08-28 10:16:23 +02:00
Thierry FOURNIER
e1587b3314 BUG/MEDIUM: lua: cannot process more Lua hooks after a "done()" function call
When the Lua execution flow endswith the command done (core.done or txn.done())
an error is detourned, and the stack is no longer usable. This patch juste
reinitilize the stack if this case is detected.
2015-08-28 10:12:49 +02:00
Willy Tarreau
0458b08a5a BUG/MEDIUM: lua: txn:done() still causes a segfault in TCP mode
We must not dereference s->txn to get the channel, as it doesn't
exist in TCP mode.
2015-08-28 09:40:04 +02:00
Willy Tarreau
fca4261dac DOC: fix example of http-request using ssl_fc_session_id
It was missing the ",hex" resulting in raw binary data being dumped in
the header or the logs. Now we know where these crazy logs originated
from!
2015-08-27 17:16:40 +02:00
Willy Tarreau
16af23c1f3 DOC: intro: fix too long line.
dconv detected one line > 80 chars.
2015-08-27 16:30:53 +02:00
Willy Tarreau
eff04f48b4 DOC: intro: minor updates and fixes
- temporarily remove reference to management.txt which doesn't exist yet
- minor update to the lb intro
- indicate that e-mails can be sent to notify about server state change
2015-08-27 14:57:30 +02:00
Willy Tarreau
99a36dddf5 DOC: lua: replace txn:close with txn:done in lua-api
It was missed in the last patch.
2015-08-27 14:57:30 +02:00
Thierry FOURNIER
4bb375ca18 MEDIUM: lua: turns txn:close into txn:done
The function txn:close() must be terminal because it demands the session
destruction. This patch renames this function to "done()" to be much
clearer about the fact that it is a final operation.
2015-08-27 14:33:52 +02:00
Thierry FOURNIER
35d70efc33 MINOR: http: Action for manipulating the returned status code.
This patch is inspired by Bowen Ni's proposal and it is based on his first
implementation:

   With Lua integration in HAProxy 1.6, one can change the request method,
   path, uri, header, response header etc except response line.
   I'd like to contribute the following methods to allow modification of the
   response line.

   [...]

   There are two new keywords in 'http-response' that allows you to rewrite
   them in the native HAProxy config. There are also two new APIs in Lua that
   allows you to do the same rewriting in your Lua script.

   Example:
   Use it in HAProxy config:
   *http-response set-code 404*
   Or use it in Lua script:
   *txn.http:res_set_reason("Redirect")*

I dont take the full patch because the manipulation of the "reason" is useless.
standard reason are associated with each returned code, and unknown code can
take generic reason.

So, this patch can set the status code, and the reason is automatically adapted.
2015-08-27 14:29:44 +02:00
Thierry FOURNIER
3f4bc65a22 DOC: fix "http_action_set_req_line()" comments
Bowen repports errors about http_action_set_req_line() comments.
Some other errors appears from the patches about "actions" reorganisation.
2015-08-27 11:31:19 +02:00
Thierry FOURNIER
93405e1fde BUG/MINOR: lua: in some case a sample may remain undefined
When we transform a top stack entry in sample, the empty stack case
is not handled. This patch fix this behavior.
2015-08-27 11:31:02 +02:00
Thierry FOURNIER
0d79cf686b DOC: fix function name
Bowen repports this typo fix about one Lua function name.

Reported-By: Bowen
2015-08-27 11:29:45 +02:00
Thierry FOURNIER
0a99b89531 MINOR: lua: add core.done() function
This function immediately give back the control to HAProxy core.
2015-08-27 11:27:29 +02:00
Thierry FOURNIER
bc965348d7 DOC: ssl: missing LF
An error message miss LF
2015-08-27 11:24:23 +02:00
Thierry FOURNIER
10ec214f41 BUG/MEDIUM: lua: the lua fucntion Channel:close() causes a segfault
The function dont remove remaineing analysers and dont update response
channel timeout.

The fix is a copy of the behavior of the functions http_apply_redirect_rule()
and stream_int_retnclose().
2015-08-25 18:24:11 +02:00
Willy Tarreau
bdc97a8795 BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2
Tsvetan Tsvetanov reported that the following Lua code fails in
dev2 and dev3 :

	function hello(txn)
	    local request_msg = txn.req:dup()
	    local tsm_sock = core.tcp()
	    tsm_sock:connect("127.0.0.1", 7777)
	    local res = tsm_sock:send(request_msg)
	    local response = tsm_sock:receive('*l')
	    txn.res:send(response)
	    txn:close()
	end

Thierry diagnosed that it was caused by commit 563cc37 ("MAJOR: stream:
use a regular ->update for all stream interfaces"). It broke lua's
ability to establish outgoing connections.

The reason is that the applet used to be notified about established
connections just after the stream analyser loop, and that's not the
case anymore. In peers, this issue didn't happen because peers use
a handshake so after sending data, the response is received and wakes
the applet up again. Here we have to indicate that we want to send or
receive data, this will cause the notification to happen as soon as
the connection is ready. This is similar to pretending that we're
working on a full buffer after all. In theory subscribing for reads
is not needed, but it's added here for completeness.

Reported-By: Tsvetan Tsvetanov <cpi.cecko@gmail.com>
2015-08-25 16:58:00 +02:00
Pavlos Parissis
ba56d9ceec DOC: mention support for RFC 5077 TLS Ticket extension in starter guide 2015-08-25 11:20:33 +02:00
Pieter Baauw
8669e971a3 MINOR cfgparse: Correct the mailer warning text to show the right names to the user 2015-08-24 21:59:39 +02:00
Nikos Mavrogiannopoulos
f1650a8adf DOC: clarify some points about SSL and the proxy protocol
Make it clearer that some fields are in fact sub-types of the SSL
field.
2015-08-24 15:53:58 +02:00
Emeric Brun
b157d73beb BUG/MAJOR: peers: fix current table pointer not re-initialized on session release.
This bug causes malfunctions after re-connect. For instance the re-sync fails.
2015-08-21 14:24:32 +02:00
Emeric Brun
e1ab808ff8 BUG/MEDIUM: peers: fix wrong message id on stick table updates acknowledgement.
The table definition message id was used instead of the update acknowledgement id.

This bug causes a malformated message and a protocol error and breaks the
connection.

After that, the updates remain unacknowledged.
2015-08-21 14:24:17 +02:00
Willy Tarreau
29fbe51490 MAJOR: tproxy: remove support for cttproxy
This was the first transparent proxy technology supported by haproxy
circa 2005 but it was obsoleted in 2007 by Tproxy 4.0 which removed a
lot of the earlier versions' shortcomings and was finally merged into
the kernel. Since nobody has been using cttproxy for many years now
and nobody has even just tried to compile the files, it's time to
remove it. The doc was updated as well.
2015-08-20 19:35:14 +02:00
Thierry FOURNIER
e0627bdae0 MINOR: stick-tables: Add GPC0 actions
This patch adds access to GPC0 through http and tcp actions
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
236657b5e0 MINOR: stick-tables: Add GPT0 access
This patch adds acces to GPT0. The access can be done with http and
tcp actions, and through a converter.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
3cf1111eb3 MEDIUM: stick-tables: Add GPT0 in the stick tables
This patch adds GPT0 (General Purpose Tag 0). It is useful for storing
a simple state.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
7e25df3f17 MAJOR: stick-tables: remove key storage from the key struct
Now, the key struct only points to the storage provided by the
sample as input.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
5d24ebc3d7 MEDIUM: stick-tables: use the sample type names
This patch removes the special stick tables types names and
use the standard sample type names. This avoid the maintainance
of two types and remove the switch/case for matching a sample
type for each stick table type.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
bc8c404449 MAJOR: stick-tables: use sample types in place of dedicated types
This patch is the first step for sample integration. Actually
the stick tables uses her own data type, and some converters
must be called to convert sample type to stick-tables types.

This patch removes the stick-table types and replace it by
the sample types. This prevent:
 - Maintenance of two types of converters
 - reduce the code using the samples converters
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
4dc15d1a2d MINOR: actions: Remove wrappers
Now the prototype for each action from each section are the same, and
a discriminant for determining for each section we are called are added.
So, this patch removes the wrappers for the action functions called from
more than one section.

This patch removes 132 lines of useless code.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
afa80496db MEDIUM: actions: Normalize the return code of the configuration parsers
This patch normalize the return code of the configuration parsers. Before
these changes, the tcp action parser returned -1 if fail and 0 for the
succes. The http action returned 0 if fail and 1 if succes.

The normalisation does:
 - ACT_RET_PRS_OK for succes
 - ACT_RET_PRS_ERR for failure
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
322a124867 MINOR: actions: mutualise the action keyword lookup
Each (http|tcp)-(request|response) action use the same method
for looking up the action keyword during the cofiguration parsing.

This patch mutualize the code.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
c2bb050f7f MINOR: proto_tcp: proto_tcp.h is now useles
After removing the keyword register from types/proto_tcp.h, the header
file remains empty. This patch remove it
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
36481b8667 MEDIUM: actions: Merge (http|tcp)-(request|reponse) keywords structs
This patch merges the conguration keyword struct. Each declared configuration
keyword struct are similar with the others. This patch simplify the code.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
24ff6c6fce MEDIUM: actions: Add standard return code for the action API
Action function can return 3 status:
 - error if the action encounter fatal error (like out of memory)
 - yield if the action must terminate his work later
 - continue in other cases
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
0ea5c7fafa MINOR: actions: change actions names
For performances considerations, some actions are not processed by remote
function. They are directly processed by the function. Some of these actions
does the same things but for different processing part (request / response).

This patch give the same name for the same actions, and change the normalization
of the other actions names.

This patch is ONLY a rename, it doesn't modify the code.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
91f6ba0f2c MINOR: actions: Declare all the embedded actions in the same header file
This patch group the action name in one file. Some action are called
many times and need an action embedded in the action caller. The main
goal is to have only one header file grouping all definitions.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
22e49011b1 MINOR: actions: remove the mark indicating the last entry in enum
This mark permit to detect if the action tag is over the allowed range.
 - Normally, this case doesn't appear
 - If it appears, it is processed by ded fault case of the switch
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
5563e4b469 MINOR: actions: add "from" information
This struct member is used to specify who is the rule caller. It permits
to use one function for differents callers.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
d0d65aeab6 MEDIUM: capture: Move the capture configuration storage in the union
This patch moves the capture configuration struct (capture_prm) in the main
"arg" union. This reduce the size of the struct.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
5ec63e008d MEDIUM: track-sc: Move the track-sc configuration storage in the union
This patch moves the track-sc configuration struct (track_ctr_prm) in the main
"arg" union. This reduce the size od the struct.
2015-08-20 17:13:47 +02:00
Thierry FOURNIER
e209797ef0 MINOR: proto_http: replace generic opaque types by real used types in "http_capture" by id
This patch removes the generic opaque type for storing the configuration of the
action "http_capture" by id.
2015-08-20 17:13:46 +02:00
Thierry FOURNIER
32b15003fe MINOR: proto_http: replace generic opaque types by real used types in "http_capture"
This patch removes the generic opaque type for storing the configuration of the
action "http_capture"".
2015-08-20 17:13:46 +02:00
Thierry FOURNIER
8855a92d8c MINOR: proto_http: replace generic opaque types by real used types for the actions on thr request line
This patch removes the generic opaque type for storing the configuration of the
action "set-method", "set-path", "set-query" and "set-uri".
2015-08-20 17:13:46 +02:00
Thierry FOURNIER
a002dc9df8 MINOR: proto_http: use an "expr" type in place of generic opaque type.
This patch removes the generic opaque type for storing the configuration of the
acion "set-src" (HTTP_REQ_ACT_SET_SRC), and use the dedicated type "struct expr"
2015-08-20 17:13:46 +02:00
Thierry FOURNIER
f8c1dcea01 MINOR: vars: use the vars types as argument in place of opaque type
The (http|tcp)-(request|response) action rules use common
opaque type. For the HAProxy embbedded feature, types are know,
it better to add this types in the action union and use it.
2015-08-20 17:13:46 +02:00