mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-09 11:41:00 +01:00
MEDIUM: proto_htx: Add HTX analyzers and use it when the mux H1 is used
For now, these analyzers are just copies of the legacy HTTP analyzers. But,
during the HTTP refactoring, it will be the main place where it will be
visible. And in legacy analyzers, the macro IS_HTX_STRM is used to know if the
HTX version should be called or not.
Note: the following commits were applied to proto_http.c after this patch
was developed and need to be studied to see if an adaptation to htx
is required :
fd9b68c BUG/MINOR: only mark connections private if NTLM is detected
This commit is contained in:
parent
1d5b85aba2
commit
e0768ebabc
@ -52,6 +52,18 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx);
|
||||
void http_txn_reset_req(struct http_txn *txn);
|
||||
void http_txn_reset_res(struct http_txn *txn);
|
||||
|
||||
/* Export HTX analyzers */
|
||||
int htx_wait_for_request(struct stream *s, struct channel *req, int an_bit);
|
||||
int htx_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px);
|
||||
int htx_process_request(struct stream *s, struct channel *req, int an_bit);
|
||||
int htx_process_tarpit(struct stream *s, struct channel *req, int an_bit);
|
||||
int htx_wait_for_request_body(struct stream *s, struct channel *req, int an_bit);
|
||||
int htx_send_name_header(struct http_txn *txn, struct proxy* be, const char* svr_name);
|
||||
int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit);
|
||||
int htx_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px);
|
||||
int htx_request_forward_body(struct stream *s, struct channel *req, int an_bit);
|
||||
int htx_response_forward_body(struct stream *s, struct channel *res, int an_bit);
|
||||
|
||||
void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end);
|
||||
int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hdr_exp *exp);
|
||||
int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_exp *exp);
|
||||
|
||||
@ -864,6 +864,9 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
struct http_msg *msg = &txn->req;
|
||||
struct hdr_ctx ctx;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_wait_for_request(s, req, an_bit);
|
||||
|
||||
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%lu analysers=%02x\n",
|
||||
now_ms, __FUNCTION__,
|
||||
s,
|
||||
@ -2844,6 +2847,9 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
||||
int deny_status = HTTP_ERR_403;
|
||||
struct connection *conn = objt_conn(sess->origin);
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_process_req_common(s, req, an_bit, px);
|
||||
|
||||
if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
|
||||
/* we need more data */
|
||||
goto return_prx_yield;
|
||||
@ -3115,6 +3121,9 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
struct http_msg *msg = &txn->req;
|
||||
struct connection *cli_conn = objt_conn(strm_sess(s)->origin);
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_process_request(s, req, an_bit);
|
||||
|
||||
if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
|
||||
/* we need more data */
|
||||
channel_dont_connect(req);
|
||||
@ -3448,6 +3457,9 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
|
||||
{
|
||||
struct http_txn *txn = s->txn;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_process_tarpit(s, req, an_bit);
|
||||
|
||||
/* This connection is being tarpitted. The CLIENT side has
|
||||
* already set the connect expiration date to the right
|
||||
* timeout. We just have to check that the client is still
|
||||
@ -3494,6 +3506,9 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
||||
struct http_txn *txn = s->txn;
|
||||
struct http_msg *msg = &s->txn->req;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_wait_for_request_body(s, req, an_bit);
|
||||
|
||||
/* We have to parse the HTTP request body to find any required data.
|
||||
* "balance url_param check_post" should have been the only way to get
|
||||
* into this. We were brought here after HTTP header analysis, so all
|
||||
@ -4272,6 +4287,9 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
struct http_msg *msg = &s->txn->req;
|
||||
int ret;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_request_forward_body(s, req, an_bit);
|
||||
|
||||
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%lu analysers=%02x\n",
|
||||
now_ms, __FUNCTION__,
|
||||
s,
|
||||
@ -4511,6 +4529,9 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
|
||||
srv_conn = cs_conn(objt_cs(s->si[1].end));
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_wait_for_response(s, rep, an_bit);
|
||||
|
||||
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%lu analysers=%02x\n",
|
||||
now_ms, __FUNCTION__,
|
||||
s,
|
||||
@ -5154,6 +5175,9 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
||||
struct cond_wordlist *wl;
|
||||
enum rule_result ret = HTTP_RULE_RES_CONT;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_process_res_common(s, rep, an_bit, px);
|
||||
|
||||
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%lu analysers=%02x\n",
|
||||
now_ms, __FUNCTION__,
|
||||
s,
|
||||
@ -5501,6 +5525,9 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
struct http_msg *msg = &s->txn->rsp;
|
||||
int ret;
|
||||
|
||||
if (IS_HTX_STRM(s))
|
||||
return htx_response_forward_body(s, res, an_bit);
|
||||
|
||||
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%lu analysers=%02x\n",
|
||||
now_ms, __FUNCTION__,
|
||||
s,
|
||||
|
||||
2868
src/proto_htx.c
2868
src/proto_htx.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user