MEDIUM: http: Add a ruleset evaluated on all responses just before forwarding

This patch introduces the 'http-after-response' rules. These rules are evaluated
at the end of the response analysis, just before the data forwarding, on ALL
HTTP responses, the server ones but also all responses generated by
HAProxy. Thanks to this ruleset, it is now possible for instance to add some
headers to the responses generated by the stats applet. Following actions are
supported :

   * allow
   * add-header
   * del-header
   * replace-header
   * replace-value
   * set-header
   * set-status
   * set-var
   * strict-mode
   * unset-var
diff --git a/include/proto/http_ana.h b/include/proto/http_ana.h
index 2b35388..62fd74d 100644
--- a/include/proto/http_ana.h
+++ b/include/proto/http_ana.h
@@ -40,6 +40,7 @@
 int http_request_forward_body(struct stream *s, struct channel *req, int an_bit);
 int http_response_forward_body(struct stream *s, struct channel *res, int an_bit);
 int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn);
+int http_eval_after_res_rules(struct stream *s);
 int http_replace_hdrs(struct stream* s, struct htx *htx, struct ist name, const char *str, struct my_regex *re, int full);
 int http_req_replace_stline(int action, const char *replace, int len,
 			    struct proxy *px, struct stream *s);
diff --git a/include/proto/http_rules.h b/include/proto/http_rules.h
index 608ca57..3e57b9d 100644
--- a/include/proto/http_rules.h
+++ b/include/proto/http_rules.h
@@ -29,9 +29,11 @@
 
 extern struct action_kw_list http_req_keywords;
 extern struct action_kw_list http_res_keywords;
+extern struct action_kw_list http_after_res_keywords;
 
 struct act_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
 struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
+struct act_rule *parse_http_after_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
 struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
                                                const char **args, char **errmsg, int use_fmt, int dir);
 
@@ -45,6 +47,11 @@
 	LIST_ADDQ(&http_res_keywords.list, &kw_list->list);
 }
 
+static inline void http_after_res_keywords_register(struct action_kw_list *kw_list)
+{
+	LIST_ADDQ(&http_after_res_keywords.list, &kw_list->list);
+}
+
 #endif /* _PROTO_HTTP_RULES_H */
 
 /*
diff --git a/include/types/proxy.h b/include/types/proxy.h
index c6b56aa..f3b0e6b 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -315,6 +315,7 @@
 	struct list acl;                        /* ACL declared on this proxy */
 	struct list http_req_rules;		/* HTTP request rules: allow/deny/... */
 	struct list http_res_rules;		/* HTTP response rules: allow/deny/... */
+	struct list http_after_res_rules;	/* HTTP final response rules: set-header/del-header/... */
 	struct list redirect_rules;             /* content redirecting rules (chained) */
 	struct list switching_rules;            /* content switching rules (chained) */
 	struct list persist_rules;		/* 'force-persist' and 'ignore-persist' rules (chained) */