mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MEDIUM: filters: Set CF_FL_ANALYZE on channels when filters are attached
CF_FL_ANALYZE flag is used to know a channel is filtered. It is important to synchronize request and response channels when the filtering ends. However, it is possible to call all request analyzers before starting the filtering on the response channel. This means flt_end_analyze() may be called for the request channel before flt_start_analyze() on the response channel. Thus because CF_FL_ANALYZE flag is not set on the response channel, we consider the filtering is finished on both sides. The consequence is that flt_end_analyze() is not called for the response and backend filters are unregistered before their execution on the response channel. It is possible to encounter this bug on TCP frontend or CONNECT request on HTTP frontend if the client shutdown is reveiced with the first read. To fix this bug, CF_FL_ANALYZE is set when filters are attached to the stream. It means, on the request channel when the stream is created, in flt_stream_start(). And on both channels when the backend is set, in flt_set_stream_backend(). This patch must be backported as far as 1.7.
This commit is contained in:
parent
3b728a92bb
commit
5647fbacdf
@ -473,6 +473,8 @@ flt_stream_start(struct stream *s)
|
|||||||
if (FLT_OPS(filter)->stream_start && FLT_OPS(filter)->stream_start(s, filter) < 0)
|
if (FLT_OPS(filter)->stream_start && FLT_OPS(filter)->stream_start(s, filter) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (strm_li(s) && (strm_li(s)->analysers & AN_REQ_FLT_START_FE))
|
||||||
|
s->req.flags |= CF_FLT_ANALYZE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,6 +533,10 @@ flt_set_stream_backend(struct stream *s, struct proxy *be)
|
|||||||
FLT_OPS(filter)->stream_set_backend(s, filter, be) < 0)
|
FLT_OPS(filter)->stream_set_backend(s, filter, be) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (be->be_req_ana & AN_REQ_FLT_START_BE)
|
||||||
|
s->req.flags |= CF_FLT_ANALYZE;
|
||||||
|
if ((strm_fe(s)->fe_rsp_ana | be->be_rsp_ana) & (AN_RES_FLT_START_FE|AN_RES_FLT_START_BE))
|
||||||
|
s->res.flags |= CF_FLT_ANALYZE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user