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
e871c8ca
Commit
e871c8ca
authored
Oct 23, 2013
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable keepalive on websocket connections
parent
47146111
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
websocket_spec.rb
misc/spec/subscriber/websocket_spec.rb
+30
-2
ngx_http_push_stream_module_websocket.c
src/ngx_http_push_stream_module_websocket.c
+3
-0
No files found.
misc/spec/subscriber/websocket_spec.rb
View file @
e871c8ca
...
...
@@ -422,7 +422,7 @@ describe "Subscriber WebSocket" do
end
it
"should accept messages with different bytes"
do
nginx_run_server
(
config
.
merge
(
:client_max_body_size
=>
'130k'
,
:client_body_buffer_size
=>
'130k'
,
:
subscriber_connection_ttl
=>
"1s"
,
:
message_template
=>
"~text~|"
))
do
|
conf
|
nginx_run_server
(
config
.
merge
(
:client_max_body_size
=>
'130k'
,
:client_body_buffer_size
=>
'130k'
,
:message_template
=>
"~text~|"
))
do
|
conf
|
ranges
=
[
0
..
255
]
ranges
.
each
do
|
range
|
bytes
=
[]
...
...
@@ -469,7 +469,35 @@ describe "Subscriber WebSocket" do
end
end
it
"should not try to parse the rewuest line when doing a reload"
do
it
"should not try to parse the request line when receive a frame after send close frame"
do
channel
=
'ch_test_data_after_close_frame_parse_request_line'
pid
=
pid2
=
0
frame
=
"%c%c%c%c%c%c"
%
[
0x8A
,
0x80
,
0xBD
,
0xD0
,
0xE5
,
0x2A
]
#send 'pong' frame
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
(
:subscriber_connection_ttl
=>
'1s'
))
do
|
conf
|
File
.
open
(
conf
.
error_log
,
"a"
).
truncate
(
0
)
socket
=
open_socket
(
nginx_host
,
nginx_port
)
socket
.
print
(
"
#{
request
}
\r\n
"
)
headers
,
body
=
read_response_on_socket
(
socket
)
# wait for close frame
body
,
dummy
=
read_response_on_socket
(
socket
,
"
\210\000
"
)
body
.
should
eql
(
"
\210\000
"
)
socket
.
print
(
"WRITE SOMETHING UNKNOWN
\r\n
"
)
sleep
1
error_log
=
File
.
read
(
conf
.
error_log
)
error_log
.
should_not
include
(
"client sent invalid"
)
end
end
it
"should not try to parse the request line when doing a reload"
do
channel
=
'ch_test_reload_not_parse_request_line'
pid
=
pid2
=
0
...
...
src/ngx_http_push_stream_module_websocket.c
View file @
e871c8ca
...
...
@@ -48,6 +48,9 @@ ngx_http_push_stream_websocket_handler(ngx_http_request_t *r)
ngx_str_t
*
upgrade_header
,
*
connection_header
,
*
sec_key_header
,
*
sec_version_header
,
*
sec_accept_header
;
ngx_int_t
version
;
// WebSocket connections must not use keepalive
r
->
keepalive
=
0
;
// only accept GET method
if
(
!
(
r
->
method
&
NGX_HTTP_GET
))
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ALLOW
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET
);
...
...
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