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
a03b3f5e
Commit
a03b3f5e
authored
Aug 28, 2013
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support for OPTIONS method on publisher location
parent
0a819f72
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
CHANGELOG.textile
CHANGELOG.textile
+1
-0
properties_spec.rb
misc/spec/publisher/properties_spec.rb
+26
-0
ngx_http_push_stream_module_publisher.c
src/ngx_http_push_stream_module_publisher.c
+5
-0
No files found.
CHANGELOG.textile
View file @
a03b3f5e
h1(#changelog). Changelog
* Added support for OPTIONS method on publisher location
* Unified longPollingTimeout and timeout configurations on javascript client
* Renamed some javascript client configurations
** jsonDataKey -> jsonTextKey
...
...
misc/spec/publisher/properties_spec.rb
View file @
a03b3f5e
...
...
@@ -72,6 +72,13 @@ describe "Publisher Properties" do
it
"should check accepted methods"
do
nginx_run_server
(
config
)
do
|
conf
|
# testing OPTIONS method, EventMachine::HttpRequest does not have support to it
socket
=
open_socket
(
nginx_host
,
nginx_port
)
socket
.
print
(
"OPTIONS /pub?id=ch_test_accepted_methods HTTP/1.0
\r\n\r\n
"
)
headers
,
body
=
read_response_on_socket
(
socket
)
headers
.
should
match_the_pattern
(
/HTTP\/1\.1 200 OK/
)
headers
.
should
match_the_pattern
(
/Content-Length: 0/
)
EventMachine
.
run
do
multi
=
EventMachine
::
MultiRequest
.
new
...
...
@@ -348,12 +355,31 @@ describe "Publisher Properties" do
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
).
get
:head
=>
headers
pub
.
callback
do
pub
.
response_header
[
'ACCESS_CONTROL_ALLOW_ORIGIN'
].
should
be_nil
pub
.
response_header
[
'ACCESS_CONTROL_ALLOW_METHODS'
].
should
be_nil
EventMachine
.
stop
end
end
end
end
context
"when allow origin directive is set"
do
it
"should receive acess control allow headers"
do
channel
=
'test_access_control_allow_headers'
nginx_run_server
(
config
.
merge
(
:allowed_origins
=>
"custom.domain.com"
))
do
|
conf
|
EventMachine
.
run
do
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
).
get
:head
=>
headers
pub
.
callback
do
pub
.
response_header
[
'ACCESS_CONTROL_ALLOW_ORIGIN'
].
should
eql
(
"custom.domain.com"
)
pub
.
response_header
[
'ACCESS_CONTROL_ALLOW_METHODS'
].
should
eql
(
"GET, POST, PUT, DELETE"
)
EventMachine
.
stop
end
end
end
end
end
it
"should not receive channel info after publish a message when disabled"
do
body
=
'published message'
...
...
src/ngx_http_push_stream_module_publisher.c
View file @
a03b3f5e
...
...
@@ -40,6 +40,11 @@ ngx_http_push_stream_publisher_handler(ngx_http_request_t *r)
if
(
cf
->
allowed_origins
.
len
>
0
)
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
,
&
cf
->
allowed_origins
);
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ACCESS_CONTROL_ALLOW_METHODS
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_PUT_DELETE_METHODS
);
}
if
(
r
->
method
&
NGX_HTTP_OPTIONS
)
{
return
ngx_http_push_stream_send_only_header_response
(
r
,
NGX_HTTP_OK
,
NULL
);
}
// only accept GET, POST, PUT and DELETE methods if enable publisher administration
...
...
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