Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ index *commonly used variables* as follows:
- `$http_proxy_connection`
- `$http_te`
- `$http_upgrade`
- `$http_via`
- `$http_x_forwarded_for`
- `$http_x_forwarded_host`
- `$http_x_forwarded_path`
Expand Down
3 changes: 1 addition & 2 deletions src/ngx_http_lua_kong_var_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static ngx_str_t default_vars[] = {
ngx_string("http_proxy_connection"),
ngx_string("http_te"),
ngx_string("http_upgrade"),
ngx_string("http_via"),

/* http request headers */
ngx_string("http_x_forwarded_for"),
Expand Down Expand Up @@ -333,5 +334,3 @@ ngx_http_lua_kong_ffi_var_set_by_index(ngx_http_request_t *r, ngx_uint_t index,
*err = "no memory";
return NGX_ERROR;
}


9 changes: 6 additions & 3 deletions t/006-default_indexed-var.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Test::Nginx::Socket::Lua;

repeat_each(2);

plan tests => repeat_each() * (blocks() * 8) - 10;
plan tests => repeat_each() * (blocks() * 8) - 8;

$ENV{TEST_NGINX_HTML_DIR} ||= html_dir();

Expand Down Expand Up @@ -117,7 +117,8 @@ get variable value '/test' by index
ngx.var.http_proxy, " ",
ngx.var.http_proxy_connection, " ",
ngx.var.http_te, " ",
ngx.var.http_upgrade
ngx.var.http_upgrade, " ",
ngx.var.http_via
)
}
}
Expand All @@ -132,8 +133,9 @@ proxy: 111
proxy-connection: 222
te: 333
upgrade: 444
via: 1.1 kong
--- response_body
auth close test.com 1 111 222 333 444
auth close test.com 1 111 222 333 444 1.1 kong
--- error_log
get variable value 'auth' by index
get variable value 'close' by index
Expand All @@ -143,6 +145,7 @@ get variable value '111' by index
get variable value '222' by index
get variable value '333' by index
get variable value '444' by index
get variable value '1.1 kong' by index
--- no_error_log
[error]
[crit]
Expand Down