MINOR: http: custom status reason.
The older 'rsprep' directive allows modification of the status reason.
Extend 'http-response set-status' to take an optional string of the new
status reason.
http-response set-status 418 reason "I'm a coffeepot"
Matching updates in Lua code:
- AppletHTTP.set_status
- HTTP.res_set_status
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 5ee2e2f..6c81766 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -108,7 +108,7 @@
int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ctx *ctx);
int http_header_add_tail2(struct http_msg *msg, struct hdr_idx *hdr_idx, const char *text, int len);
int http_replace_req_line(int action, const char *replace, int len, struct proxy *px, struct stream *s);
-void http_set_status(unsigned int status, struct stream *s);
+void http_set_status(unsigned int status, const char *reason, struct stream *s);
int http_transform_header_str(struct stream* s, struct http_msg *msg, const char* name,
unsigned int name_len, const char *str, struct my_regex *re,
int action);
diff --git a/include/types/action.h b/include/types/action.h
index 5a70db0..1c17154 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -135,6 +135,7 @@
} cap;
struct {
unsigned int code; /* HTTP status code */
+ const char *reason; /* HTTP status reason */
} status;
struct {
struct sample_expr *expr;
diff --git a/include/types/applet.h b/include/types/applet.h
index 759b905..642c793 100644
--- a/include/types/applet.h
+++ b/include/types/applet.h
@@ -80,6 +80,7 @@
int left_bytes; /* The max amount of bytes that we can read. */
int flags;
int status;
+ const char *reason;
struct task *task;
} hlua_apphttp; /* used by the Lua HTTP services */
struct {