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
390fe737
You need to sign in or sign up before continuing.
Commit
390fe737
authored
Oct 09, 2013
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set keepalive to 0 when the server is reloading, to avoid parse remaining bytes as a resquest line
parent
a0fbac6e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
websocket_spec.rb
misc/spec/subscriber/websocket_spec.rb
+51
-0
ngx_http_push_stream_module_utils.c
src/ngx_http_push_stream_module_utils.c
+1
-0
No files found.
misc/spec/subscriber/websocket_spec.rb
View file @
390fe737
...
...
@@ -471,4 +471,55 @@ describe "Subscriber WebSocket" do
headers
.
should
include
(
"Cache-Control: no-cache, no-store, must-revalidate
\r\n
"
)
end
end
it
"should not try to parse the rewuest line when doing a reload"
do
channel
=
'ch_test_reload_not_parse_request_line'
pid
=
pid2
=
0
request
=
"GET /ws/
#{
channel
}
.b1 HTTP/1.1
\r\n
Host: localhost
\r\n
Connection: Upgrade
\r\n
Sec-WebSocket-Key: /mQoZf6pRiv8+6o72GncLQ==
\r\n
Upgrade: websocket
\r\n
Sec-WebSocket-Version: 8
\r\n
"
nginx_run_server
(
config
.
merge
(
:ping_message_interval
=>
"1s"
),
:timeout
=>
10
)
do
|
conf
|
File
.
open
(
conf
.
error_log
,
"a"
).
truncate
(
0
)
EventMachine
.
run
do
publish_message_inline
(
channel
,
{},
"body"
)
socket
=
open_socket
(
nginx_host
,
nginx_port
)
socket
.
print
(
"
#{
request
}
\r\n
"
)
headers
,
body
=
read_response_on_socket
(
socket
)
# check statistics
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels-stats'
).
get
pub_1
.
callback
do
pub_1
.
should
be_http_status
(
200
).
with_body
resp_1
=
JSON
.
parse
(
pub_1
.
response
)
resp_1
.
has_key?
(
"channels"
).
should
be_true
resp_1
[
"channels"
].
to_i
.
should
eql
(
1
)
resp_1
[
"subscribers"
].
to_i
.
should
eql
(
1
)
# send reload signal
`
#{
nginx_executable
}
-c
#{
conf
.
configuration_filename
}
-s reload > /dev/null 2>&1`
socket
.
print
(
"WRITE SOMETHING UNKNOWN
\r\n
"
)
sleep
3
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels-stats'
).
get
pub_2
.
callback
do
pub_2
.
should
be_http_status
(
200
).
with_body
resp_2
=
JSON
.
parse
(
pub_2
.
response
)
resp_2
.
has_key?
(
"channels"
).
should
be_true
resp_2
[
"channels"
].
to_i
.
should
eql
(
1
)
resp_2
[
"subscribers"
].
to_i
.
should
eql
(
0
)
error_log
=
File
.
read
(
conf
.
error_log
)
error_log
.
should_not
include
(
"client sent invalid"
)
EventMachine
.
stop
end
end
end
end
end
end
src/ngx_http_push_stream_module_utils.c
View file @
390fe737
...
...
@@ -155,6 +155,7 @@ ngx_http_push_stream_cleanup_shutting_down_worker(void)
while
(
!
ngx_queue_empty
(
&
thisworker_data
->
subscribers_queue
))
{
ngx_http_push_stream_subscriber_t
*
subscriber
=
ngx_queue_data
(
ngx_queue_head
(
&
thisworker_data
->
subscribers_queue
),
ngx_http_push_stream_subscriber_t
,
worker_queue
);
subscriber
->
request
->
keepalive
=
0
;
if
(
subscriber
->
longpolling
)
{
ngx_http_push_stream_send_response_finalize_for_longpolling_by_timeout
(
subscriber
->
request
);
}
else
{
...
...
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