Skip to content

Commit

Permalink
Merge branch 'read_timeout_with_nginx' of
Browse files Browse the repository at this point in the history
https://github.com/pkmiec/passenger into PR_34

Conflicts:
	ext/nginx/Configuration.c
	test/integration_tests/nginx_tests.rb
	test/stub/rack/config.ru
  • Loading branch information
Daniel Knoppel (Phusion) committed Apr 7, 2015
1 parent ecdc158 commit 48e207b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Release 5.0.7
-------------

* Introduced `passenger_read_timeout` for rare cases when server needs more than the default 10 minute timeout. Closes [GH-PR-34](https://github.com/phusion/passenger/pull/34).


Release 5.0.6
Expand Down
7 changes: 7 additions & 0 deletions ext/nginx/Configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,13 @@ const ngx_command_t passenger_commands[] = {
offsetof(passenger_main_conf_t, analytics_log_group),
NULL },

{ ngx_string("passenger_read_timeout"),
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(passenger_loc_conf_t, upstream_config.read_timeout),
NULL },

{ ngx_string("union_station_gateway_address"),
NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
Expand Down
11 changes: 11 additions & 0 deletions test/integration_tests/nginx_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def log(message)
server[:root] = "#{@stub.full_app_root}/public"
server[:passenger_app_group_name] = "secondary"
server[:passenger_load_shell_envvars] = "off"
server[:passenger_read_timeout] = '3000ms'
end
@nginx.add_server do |server|
server[:server_name] = "3.passenger.test"
Expand Down Expand Up @@ -336,6 +337,16 @@ def log(message)
get("/pid").should == pid
get("/pid").should_not == pid
end

it "respects read_timeout setting" do
@server = "http://2.passenger.test:#{@nginx.port}/"

response = get_response('/?sleep_seconds=1')
response.class.should == Net::HTTPOK
response = get_response('/?sleep_seconds=6')
response.class.should == Net::HTTPGatewayTimeOut
end

end

describe "oob work" do
Expand Down
6 changes: 6 additions & 0 deletions test/stub/rack/config.ru
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# encoding: binary

require File.expand_path(File.dirname(__FILE__) + "/library")
require 'cgi'

app = lambda do |env|
case env['PATH_INFO']
when '/'
params = CGI.parse(env['QUERY_STRING'])
if params['sleep_seconds'].first
sleep params['sleep_seconds'].first.to_f
end

if File.exist?("front_page.txt")
text_response(File.read("front_page.txt"))
else
Expand Down

0 comments on commit 48e207b

Please sign in to comment.