summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http.h
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2020-03-27 17:22:52 +0300
committerValentin Bartenev <vbart@nginx.com>2020-03-27 17:22:52 +0300
commit8d727774e3a2b2eaf194781c382fb953ed61f755 (patch)
tree9c3ec0878ebffb033f352f59c7abc099d17307a9 /src/nxt_http.h
parent5f9c4754cbb1dfec0156b4473d1b31a4da8a3e3d (diff)
downloadunit-8d727774e3a2b2eaf194781c382fb953ed61f755.tar.gz
unit-8d727774e3a2b2eaf194781c382fb953ed61f755.tar.bz2
Implemented "return" action.
The "return" action can be used to immediately generate a simple HTTP response with an arbitrary status: { "action": { "return": 404 } } This is especially useful for denying access to specific resources.
Diffstat (limited to 'src/nxt_http.h')
-rw-r--r--src/nxt_http.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nxt_http.h b/src/nxt_http.h
index 36ce74c6..a86b77f9 100644
--- a/src/nxt_http.h
+++ b/src/nxt_http.h
@@ -43,6 +43,9 @@ typedef enum {
NXT_HTTP_SERVICE_UNAVAILABLE = 503,
NXT_HTTP_GATEWAY_TIMEOUT = 504,
NXT_HTTP_VERSION_NOT_SUPPORTED = 505,
+ NXT_HTTP_SERVER_ERROR_MAX = 599,
+
+ NXT_HTTP_STATUS_MAX = 999,
} nxt_http_status_t;
@@ -192,6 +195,7 @@ struct nxt_http_action_s {
nxt_http_action_t *fallback;
nxt_upstream_t *upstream;
uint32_t upstream_number;
+ nxt_http_status_t return_code;
} u;
nxt_str_t name;
@@ -282,6 +286,9 @@ nxt_int_t nxt_upstreams_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
nxt_int_t nxt_upstreams_joint_create(nxt_router_temp_conf_t *tmcf,
nxt_upstream_t ***upstream_joint);
+nxt_http_action_t *nxt_http_return_handler(nxt_task_t *task,
+ nxt_http_request_t *r, nxt_http_action_t *action);
+
nxt_http_action_t *nxt_http_static_handler(nxt_task_t *task,
nxt_http_request_t *r, nxt_http_action_t *action);
nxt_int_t nxt_http_static_mtypes_init(nxt_mp_t *mp, nxt_lvlhsh_t *hash);