Skip to content

Commit

Permalink
Don't allow post_read directive on location ref: #210
Browse files Browse the repository at this point in the history
  • Loading branch information
MATSUMOTO Ryosuke committed Sep 28, 2016
1 parent 5f3c163 commit c1fbd24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/http/ngx_http_mruby_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static ngx_command_t ngx_http_mruby_commands[] = {
NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_mruby_loc_conf_t, add_handler), NULL},

{ngx_string("mruby_post_read_handler"),
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE12,
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_CONF_TAKE12,
ngx_http_mruby_post_read_phase, NGX_HTTP_LOC_CONF_OFFSET, 0, NULL},

{ngx_string("mruby_server_rewrite_handler"),
Expand All @@ -229,7 +229,7 @@ static ngx_command_t ngx_http_mruby_commands[] = {
ngx_http_mruby_log_phase, NGX_HTTP_LOC_CONF_OFFSET, 0, NULL},

{ngx_string("mruby_post_read_handler_code"),
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_CONF_TAKE1,
ngx_http_mruby_post_read_inline, NGX_HTTP_LOC_CONF_OFFSET, 0, ngx_http_mruby_post_read_inline_handler},

{ngx_string("mruby_server_rewrite_handler_code"),
Expand Down
4 changes: 2 additions & 2 deletions test/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,12 @@ http {
location /nginx_false_true {
mruby_content_handler_code 'Nginx.rputs (Nginx::FALSE + Nginx::TRUE)';
}

mruby_post_read_handler_code 'Nginx::Request.new.headers_out["hoge"] = "fuga"';
location /issue_210 {
mruby_post_read_handler_code 'Nginx::Request.new.headers_out["hoge"] = "fuga"';
mruby_content_handler_code 'Nginx.rputs "hello"';
}
location /issue_210_2 {
mruby_post_read_handler build/nginx/html/issue-210.rb cache;
mruby_content_handler_code 'Nginx.rputs "hello2"';
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/t/ngx_mruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def base_ssl(port)

t.assert('ngx_mruby - bug; mruby_post_read_handler not running in 1.18.3+ for file code', 'location /issue_210_2') do
res = HttpRequest.new.get base + '/issue_210_2'
t.assert_equal "hoge", res["fuga"]
t.assert_equal "fuga", res["hoge"]
t.assert_equal "hello2", res["body"]
end

Expand Down

0 comments on commit c1fbd24

Please sign in to comment.