MEDIUM: filters: Replace filter_http_headers callback by an analyzer
This new analyzer will be called for each HTTP request/response, before the
parsing of the body. It is identified by AN_FLT_HTTP_HDRS.
Special care was taken about the following condition :
* the frontend is a TCP proxy
* filters are defined in the frontend section
* the selected backend is a HTTP proxy
So, this patch explicitly add AN_FLT_HTTP_HDRS analyzer on the request and the
response channels when the backend is a HTTP proxy and when there are filters
attatched on the stream.
This patch simplifies http_request_forward_body and http_response_forward_body
functions.
diff --git a/include/proto/filters.h b/include/proto/filters.h
index 0eb69a2..8eaaf3a 100644
--- a/include/proto/filters.h
+++ b/include/proto/filters.h
@@ -91,17 +91,17 @@
int flt_stream_init(struct stream *s);
void flt_stream_release(struct stream *s, int only_backend);
-int flt_http_headers(struct stream *s, struct http_msg *msg);
int flt_http_data(struct stream *s, struct http_msg *msg);
int flt_http_chunk_trailers(struct stream *s, struct http_msg *msg);
int flt_http_end(struct stream *s, struct http_msg *msg);
-void flt_http_reset(struct stream *s, struct http_msg *msg);
+int flt_http_forward_data(struct stream *s, struct http_msg *msg, unsigned int len);
+void flt_http_reset(struct stream *s, struct http_msg *msg);
void flt_http_reply(struct stream *s, short status, const struct chunk *msg);
-int flt_http_forward_data(struct stream *s, struct http_msg *msg, unsigned int len);
int flt_start_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);
int flt_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);
+int flt_analyze_http_headers(struct stream *s, struct channel *chn, unsigned int an_bit);
int flt_end_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);
int flt_xfer_data(struct stream *s, struct channel *chn, unsigned int an_bit);
diff --git a/include/types/channel.h b/include/types/channel.h
index e43e8eb..b31f493 100644
--- a/include/types/channel.h
+++ b/include/types/channel.h
@@ -161,6 +161,7 @@
#define AN_FLT_START_BE 0x02000000
#define AN_FLT_END 0x04000000
#define AN_FLT_XFER_DATA 0x08000000
+#define AN_FLT_HTTP_HDRS 0x10000000
#define AN_FLT_ALL_FE 0x0d000000
#define AN_FLT_ALL_BE 0x0e000000
diff --git a/include/types/filters.h b/include/types/filters.h
index e3a091d..4bfa1c2 100644
--- a/include/types/filters.h
+++ b/include/types/filters.h
@@ -99,12 +99,6 @@
* it needs to wait, any other value otherwise.
*
*
- * - http_headers : Called just before headers sending and parsing of
- * the body. At this step, headers are fully parsed
- * and the processing on it is finished.
- * Returns a negative value if an error occurs, 0 if
- * it needs to read more data (or to wait for some
- * reason), any other value otherwise.
* - http_data : Called when unparsed body data are available.
* Returns a negative value if an error occurs, else
* the number of consumed bytes.
@@ -160,16 +154,15 @@
/*
* HTTP callbacks
*/
- int (*http_headers) (struct stream *s, struct filter *f, struct http_msg *msg);
int (*http_data) (struct stream *s, struct filter *f, struct http_msg *msg);
int (*http_chunk_trailers)(struct stream *s, struct filter *f, struct http_msg *msg);
int (*http_end) (struct stream *s, struct filter *f, struct http_msg *msg);
- void (*http_reset) (struct stream *s, struct filter *f, struct http_msg *msg);
+ int (*http_forward_data) (struct stream *s, struct filter *f, struct http_msg *msg,
+ unsigned int len);
+ void (*http_reset) (struct stream *s, struct filter *f, struct http_msg *msg);
void (*http_reply) (struct stream *s, struct filter *f, short status,
const struct chunk *msg);
- int (*http_forward_data) (struct stream *s, struct filter *f, struct http_msg *msg,
- unsigned int len);
/*
* TCP callbacks