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
b75a4baa
Commit
b75a4baa
authored
Aug 07, 2012
by
Wandenberg Peixoto
Committed by
Wandenberg
Nov 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accepting PUT method to publish messages
parent
92e02b7b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
13 deletions
+29
-13
CHANGELOG.textile
CHANGELOG.textile
+2
-2
ngx_http_push_stream_module.h
include/ngx_http_push_stream_module.h
+2
-2
properties_spec.rb
misc/spec/publisher/properties_spec.rb
+3
-4
publish_messages_spec.rb
misc/spec/publisher/publish_messages_spec.rb
+17
-0
ngx_http_push_stream_module_publisher.c
src/ngx_http_push_stream_module_publisher.c
+5
-5
No files found.
CHANGELOG.textile
View file @
b75a4baa
h1(#changelog). Changelog
* Changed push_stream_channel_id variable to directive
* Changed push_stream_channels_path variable to directive
* Changed push_stream_channel_id variable to directive
, and make possible set it inside an if block
* Changed push_stream_channels_path variable to directive
, and make possible set it inside an if block
* Back to use Nginx chunked filter
h2. Version 0.3.5
...
...
include/ngx_http_push_stream_module.h
View file @
b75a4baa
...
...
@@ -321,8 +321,8 @@ static const u_char NGX_HTTP_PUSH_STREAM_WEBSOCKET_PAYLOAD_LEN_64_BYTE = 127;
// other stuff
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
DELETE_METHODS
=
ngx_string
(
"GET, POS
T, DELETE"
);
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
METHODS
=
ngx_string
(
"GET, POS
T"
);
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
PUT_DELETE_METHODS
=
ngx_string
(
"GET, POST, PU
T, DELETE"
);
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
PUT_METHODS
=
ngx_string
(
"GET, POST, PU
T"
);
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOW_GET
=
ngx_string
(
"GET"
);
static
const
ngx_str_t
NGX_HTTP_PUSH_STREAM_ALLOWED_HEADERS
=
ngx_string
(
"If-Modified-Since,If-None-Match"
);
...
...
misc/spec/publisher/properties_spec.rb
View file @
b75a4baa
...
...
@@ -87,8 +87,7 @@ describe "Publisher Properties" do
multi
.
responses
[
:callback
][
:a
].
should_not
be_http_status
(
405
)
multi
.
responses
[
:callback
][
:a
].
req
.
method
.
should
eql
(
"GET"
)
multi
.
responses
[
:callback
][
:b
].
should
be_http_status
(
405
)
multi
.
responses
[
:callback
][
:b
].
response_header
[
'ALLOW'
].
should
eql
(
accepted_methods
)
multi
.
responses
[
:callback
][
:b
].
should_not
be_http_status
(
405
)
multi
.
responses
[
:callback
][
:b
].
req
.
method
.
should
eql
(
"PUT"
)
multi
.
responses
[
:callback
][
:c
].
should_not
be_http_status
(
405
)
...
...
@@ -467,7 +466,7 @@ describe "Publisher Properties" do
end
let
(
:accepted_methods
)
do
"GET, POST"
"GET, POST
, PUT
"
end
it_should_behave_like
"publisher location"
...
...
@@ -482,7 +481,7 @@ describe "Publisher Properties" do
{
'accept'
=>
'text/html'
}
end
let
(
:accepted_methods
)
{
"GET, POST, DELETE"
}
let
(
:accepted_methods
)
{
"GET, POST,
PUT,
DELETE"
}
it_should_behave_like
"publisher location"
...
...
misc/spec/publisher/publish_messages_spec.rb
View file @
b75a4baa
...
...
@@ -27,6 +27,23 @@ describe "Publisher Publishing Messages" do
end
end
it
"should publish a message with PUT method"
do
body
=
'published unique message'
channel
=
'ch_test_publish_messages_with_put'
nginx_run_server
(
config
,
:timeout
=>
5
)
do
|
conf
|
EventMachine
.
run
do
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
:head
=>
headers
sub
.
stream
do
|
chunk
|
chunk
.
should
eql
(
body
+
"
\r\n
"
)
EventMachine
.
stop
end
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
put
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
end
end
end
it
"should accept messages with different bytes"
do
channel
=
'ch_test_publish_messages_with_different_bytes'
...
...
src/ngx_http_push_stream_module_publisher.c
View file @
b75a4baa
...
...
@@ -43,14 +43,14 @@ ngx_http_push_stream_publisher_handler(ngx_http_request_t *r)
}
// only accept GET, POST and DELETE methods if enable publisher administration
if
((
cf
->
location_type
==
NGX_HTTP_PUSH_STREAM_PUBLISHER_MODE_ADMIN
)
&&
!
(
r
->
method
&
(
NGX_HTTP_GET
|
NGX_HTTP_POST
|
NGX_HTTP_DELETE
)))
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ALLOW
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_DELETE_METHODS
);
if
((
cf
->
location_type
==
NGX_HTTP_PUSH_STREAM_PUBLISHER_MODE_ADMIN
)
&&
!
(
r
->
method
&
(
NGX_HTTP_GET
|
NGX_HTTP_POST
|
NGX_HTTP_
PUT
|
NGX_HTTP_
DELETE
)))
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ALLOW
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
PUT_
DELETE_METHODS
);
return
ngx_http_push_stream_send_only_header_response
(
r
,
NGX_HTTP_NOT_ALLOWED
,
NULL
);
}
// only accept GET and POST methods if NOT enable publisher administration
if
((
cf
->
location_type
!=
NGX_HTTP_PUSH_STREAM_PUBLISHER_MODE_ADMIN
)
&&
!
(
r
->
method
&
(
NGX_HTTP_GET
|
NGX_HTTP_POST
)))
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ALLOW
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_METHODS
);
if
((
cf
->
location_type
!=
NGX_HTTP_PUSH_STREAM_PUBLISHER_MODE_ADMIN
)
&&
!
(
r
->
method
&
(
NGX_HTTP_GET
|
NGX_HTTP_POST
|
NGX_HTTP_PUT
)))
{
ngx_http_push_stream_add_response_header
(
r
,
&
NGX_HTTP_PUSH_STREAM_HEADER_ALLOW
,
&
NGX_HTTP_PUSH_STREAM_ALLOW_GET_POST_
PUT_
METHODS
);
return
ngx_http_push_stream_send_only_header_response
(
r
,
NGX_HTTP_NOT_ALLOWED
,
NULL
);
}
...
...
@@ -70,7 +70,7 @@ ngx_http_push_stream_publisher_handler(ngx_http_request_t *r)
// search for a existing channel with this id
channel
=
ngx_http_push_stream_find_channel
(
id
,
r
->
connection
->
log
);
if
(
r
->
method
==
NGX_HTTP_POST
)
{
if
(
r
->
method
&
(
NGX_HTTP_POST
|
NGX_HTTP_PUT
)
)
{
return
ngx_http_push_stream_publisher_handle_post
(
cf
,
r
,
id
);
}
...
...
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