Commit d2f4a9a4 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

change use of ngx_http_finalize_request on...

change use of ngx_http_finalize_request on ngx_http_push_stream_send_response_finalize function to run cleanup connection properly
parent 851615d5
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
#define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ #define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.3"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.3");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("5e7f6af68a133967b8476b75a9d562bb6672174c"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("851615d53faea9628d2125cf1f52c6e8455a3970");
#endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */ #endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */
...@@ -638,7 +638,7 @@ ngx_http_push_stream_send_response_finalize(ngx_http_request_t *r) ...@@ -638,7 +638,7 @@ ngx_http_push_stream_send_response_finalize(ngx_http_request_t *r)
} else { } else {
ngx_http_push_stream_send_response_text(r, NGX_HTTP_PUSH_STREAM_LAST_CHUNK.data, NGX_HTTP_PUSH_STREAM_LAST_CHUNK.len, 1); ngx_http_push_stream_send_response_text(r, NGX_HTTP_PUSH_STREAM_LAST_CHUNK.data, NGX_HTTP_PUSH_STREAM_LAST_CHUNK.len, 1);
} }
ngx_http_finalize_request(r, NGX_DONE); ngx_http_finalize_request(r, NGX_OK);
} }
static void static void
......
...@@ -65,6 +65,51 @@ class TestPublishMessages < Test::Unit::TestCase ...@@ -65,6 +65,51 @@ class TestPublishMessages < Test::Unit::TestCase
end end
end end
def config_test_publish_large_messages
@header_template = nil
@footer_template = nil
@message_template = "~text~"
@ping_message_interval = nil
@client_max_body_size = '2000k'
@client_body_buffer_size = '2000k'
@subscriber_connection_timeout = '5s'
end
def test_publish_large_messages
headers = {'accept' => 'text/html'}
channel = 'ch_test_publish_large_messages'
body = "|123456789" * 102400 + "|"
response = ''
EventMachine.run {
sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers
sub.stream { | chunk |
response += chunk
if response.include?(body)
assert_equal(body + "\r\n", response, "The published message was not received correctly")
end
}
sub.callback {
response = ''
sub_1 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + ".b1").get :head => headers
sub_1.stream { | chunk |
response += chunk
if response.include?(body)
assert_equal(body + "\r\n", response, "The published message was not received correctly")
EventMachine.stop
end
}
sub_1.callback {
EventMachine.stop
}
}
pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel.to_s ).post :head => headers, :body => body, :timeout => 30
add_test_timeout(15)
}
end
def config_test_publish_many_messages_in_the_same_channel def config_test_publish_many_messages_in_the_same_channel
@header_template = nil @header_template = nil
@message_template = "~text~" @message_template = "~text~"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment