]> git.kaiwu.me - haproxy.git/commit
MINOR: http: Action for manipulating the returned status code.
authorThierry FOURNIER <tfournier@arpalert.org>
Wed, 26 Aug 2015 14:21:56 +0000 (16:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 27 Aug 2015 12:29:44 +0000 (14:29 +0200)
commit35d70efc3330198c49602120cefef8842f92236a
treec85235ef91a17c8935d65561ea2bf41034783649
parent3f4bc65a2206bd35831e6270bf32e383cf03e7f2
MINOR: http: Action for manipulating the returned status code.

This patch is inspired by Bowen Ni's proposal and it is based on his first
implementation:

   With Lua integration in HAProxy 1.6, one can change the request method,
   path, uri, header, response header etc except response line.
   I'd like to contribute the following methods to allow modification of the
   response line.

   [...]

   There are two new keywords in 'http-response' that allows you to rewrite
   them in the native HAProxy config. There are also two new APIs in Lua that
   allows you to do the same rewriting in your Lua script.

   Example:
   Use it in HAProxy config:
   *http-response set-code 404*
   Or use it in Lua script:
   *txn.http:res_set_reason("Redirect")*

I dont take the full patch because the manipulation of the "reason" is useless.
standard reason are associated with each returned code, and unknown code can
take generic reason.

So, this patch can set the status code, and the reason is automatically adapted.
doc/configuration.txt
doc/lua-api/index.rst
include/proto/proto_http.h
include/types/action.h
src/hlua.c
src/proto_http.c