Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
243c9882
Commit
243c9882
authored
Feb 04, 2012
by
Wandenberg Peixoto
Committed by
Wandenberg
Nov 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding tests to use keep alive in subscribers connection
parent
57127bb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
keepalive_spec.rb
misc/spec/mix/keepalive_spec.rb
+21
-0
ngx_http_push_stream_module_subscriber.c
src/ngx_http_push_stream_module_subscriber.c
+2
-0
No files found.
misc/spec/mix/keepalive_spec.rb
View file @
243c9882
...
...
@@ -53,4 +53,25 @@ describe "Keepalive" do
socket
.
close
end
end
it
"should accept subscribe many times using the same socket"
do
channel
=
'ch_test_subscribe_with_keepalive'
body_prefix
=
'message to be sent'
get_messages
=
"GET /sub/
#{
channel
}
HTTP/1.1
\r\n
Host: test
\r\n\r\n
"
nginx_run_server
(
config
.
merge
(
:store_messages
=>
'off'
,
:subscriber_mode
=>
'long-polling'
),
:timeout
=>
5
)
do
|
conf
|
socket
=
open_socket
(
nginx_host
,
nginx_port
)
socket_pub
=
open_socket
(
nginx_host
,
nginx_port
)
1
.
upto
(
500
)
do
|
j
|
socket
.
print
(
get_messages
)
post_in_socket
(
"/pub?id=
#{
channel
}
"
,
"
#{
body_prefix
}
#{
j
.
to_s
.
rjust
(
3
,
'0'
)
}
"
,
socket_pub
,
"}
\r\n
"
)
headers
,
body
=
read_response_on_socket
(
socket
,
"
\r\n
0
\r\n\r\n
"
)
body
.
should
eql
(
"18
\r\n
message to be sent
#{
j
.
to_s
.
rjust
(
3
,
'0'
)
}
\r\n\r\n
0
\r\n\r\n
"
)
end
socket
.
close
socket_pub
.
close
end
end
end
src/ngx_http_push_stream_module_subscriber.c
View file @
243c9882
...
...
@@ -59,6 +59,8 @@ ngx_http_push_stream_subscriber_handler(ngx_http_request_t *r)
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ACCESS_CONTROL_ALLOW_HEADERS
,
&
NGX_HTTP_PUSH_STREAM_ALLOWED_HEADERS
);
}
r
->
keepalive
=
cf
->
keepalive
;
if
(
r
->
method
&
NGX_HTTP_OPTIONS
)
{
return
ngx_http_push_stream_send_only_header_response
(
r
,
NGX_HTTP_OK
,
NULL
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment