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
61773c9e
Commit
61773c9e
authored
Apr 14, 2013
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix extract domain name to works on IE8
parent
7a676397
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
forever_iframe.textile
docs/examples/forever_iframe.textile
+2
-2
pushstream.js
misc/js/pushstream.js
+3
-3
nginx.conf
misc/nginx.conf
+2
-1
No files found.
docs/examples/forever_iframe.textile
View file @
61773c9e
...
@@ -25,7 +25,7 @@ Create a html page with the content on **Client** part, access it from browser a
...
@@ -25,7 +25,7 @@ Create a html page with the content on **Client** part, access it from browser a
set $push_stream_channels_path $1;
set $push_stream_channels_path $1;
# header to be sent when receiving new subscriber connection
# header to be sent when receiving new subscriber connection
push_stream_header_template "
<html><head><meta
http-equiv=
\"Content-Type\"
content=
\"text/html;
charset=
utf-8\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-store\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Pragma\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Expires\"
content=
\"Thu,
1
Jan
1970
00:00:00
GMT
\"
>
\r\n
<script
type=
\"text/javascript\"
>
\
r
\
nwindow
.
onError
=
null
;
\
r
\
ntry
{
document
.
domain
=
(
window
.
location
.
hostname
.
match
(
/^
(\d{1,3}\.){3}\d{1,3}
$/
))
?
window
.
location
.
hostname
:
window
.
location
.
hostname
.
split
(
'
.
'
).
slice
(
-
1
*
Math
.
max
(
window
.
location
.
hostname
.
split
(
'
.
'
).
length
-
1
,
2
)).
join
(
'
.
'
);}
catch
(
e
){}
\
r
\
nparent
.
PushStream
.
register
(
this
);
\
r
\
n
</script>
\r\n
</head>
\r\n
<body>
";
push_stream_header_template "
<html><head><meta
http-equiv=
\"Content-Type\"
content=
\"text/html;
charset=
utf-8\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-store\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Pragma\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Expires\"
content=
\"Thu,
1
Jan
1970
00:00:00
GMT
\"
>
\r\n
<script
type=
\"text/javascript\"
>
\
r
\
nwindow
.
onError
=
null
;
\
r
\
ntry
{
document
.
domain
=
(
window
.
location
.
hostname
.
match
(
/^
(\d{1,3}\.){3}\d{1,3}
$/
))
?
window
.
location
.
hostname
:
window
.
location
.
hostname
.
split
(
'
.
'
).
slice
(
-
1
*
Math
.
max
(
window
.
location
.
hostname
.
split
(
'
.
'
).
length
-
1
,
(
window
.
location
.
hostname
.
match
(
/
(\w{4,}\.\w{2}
|
\.\w{3,})
$/
)
?
2
:
3
)
)).
join
(
'
.
'
);}
catch
(
e
){}
\
r
\
nparent
.
PushStream
.
register
(
this
);
\
r
\
n
</script>
\r\n
</head>
\r\n
<body>
";
# message template
# message template
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
# footer to be sent when finishing subscriber connection
# footer to be sent when finishing subscriber connection
...
@@ -97,7 +97,7 @@ If needed you can change this behavior changing the javascript usage, like the e
...
@@ -97,7 +97,7 @@ If needed you can change this behavior changing the javascript usage, like the e
set $push_stream_channels_path $arg_channels;
set $push_stream_channels_path $arg_channels;
# header to be sent when receiving new subscriber connection
# header to be sent when receiving new subscriber connection
push_stream_header_template "
<html><head><meta
http-equiv=
\"Content-Type\"
content=
\"text/html;
charset=
utf-8\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-store\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Pragma\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Expires\"
content=
\"Thu,
1
Jan
1970
00:00:00
GMT
\"
>
\r\n
<script
type=
\"text/javascript\"
>
\
r
\
nwindow
.
onError
=
null
;
\
r
\
ntry
{
document
.
domain
=
(
window
.
location
.
hostname
.
match
(
/^
(\d{1,3}\.){3}\d{1,3}
$/
))
?
window
.
location
.
hostname
:
window
.
location
.
hostname
.
split
(
'
.
'
).
slice
(
-
1
*
Math
.
max
(
window
.
location
.
hostname
.
split
(
'
.
'
).
length
-
1
,
2
)).
join
(
'
.
'
);}
catch
(
e
){}
\
r
\
nparent
.
PushStream
.
register
(
this
);
\
r
\
n
</script>
\r\n
</head>
\r\n
<body>
";
push_stream_header_template "
<html><head><meta
http-equiv=
\"Content-Type\"
content=
\"text/html;
charset=
utf-8\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-store\"
>
\r\n
<meta
http-equiv=
\"Cache-Control\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Pragma\"
content=
\"no-cache\"
>
\r\n
<meta
http-equiv=
\"Expires\"
content=
\"Thu,
1
Jan
1970
00:00:00
GMT
\"
>
\r\n
<script
type=
\"text/javascript\"
>
\
r
\
nwindow
.
onError
=
null
;
\
r
\
ntry
{
document
.
domain
=
(
window
.
location
.
hostname
.
match
(
/^
(\d{1,3}\.){3}\d{1,3}
$/
))
?
window
.
location
.
hostname
:
window
.
location
.
hostname
.
split
(
'
.
'
).
slice
(
-
1
*
Math
.
max
(
window
.
location
.
hostname
.
split
(
'
.
'
).
length
-
1
,
(
window
.
location
.
hostname
.
match
(
/
(\w{4,}\.\w{2}
|
\.\w{3,})
$/
)
?
2
:
3
)
)).
join
(
'
.
'
);}
catch
(
e
){}
\
r
\
nparent
.
PushStream
.
register
(
this
);
\
r
\
n
</script>
\r\n
</head>
\r\n
<body>
";
# message template
# message template
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
# footer to be sent when finishing subscriber connection
# footer to be sent when finishing subscriber connection
...
...
misc/js/pushstream.js
View file @
61773c9e
...
@@ -384,9 +384,9 @@
...
@@ -384,9 +384,9 @@
}
}
var
domainParts
=
domain
.
split
(
'
.
'
);
var
domainParts
=
domain
.
split
(
'
.
'
);
//
window.domain="com.au" fails (illegal) on firefox we need to keep more than 2 parts in this case
//
if the domain ends with 3 chars or 2 chars preceded by more than 4 chars,
//
always keep 2 domain parts , if 3 provided cut to 2, if 4 cut to 3.
//
we can keep only 2 parts, else we have to keep at least 3 (or all domain name)
var
keepNumber
=
Math
.
max
(
domainParts
.
length
-
1
,
2
);
var
keepNumber
=
Math
.
max
(
domainParts
.
length
-
1
,
(
domain
.
match
(
/
(\w{4,}\.\w{2}
|
\.\w{3,})
$/
)
?
2
:
3
)
);
return
domainParts
.
slice
(
-
1
*
keepNumber
).
join
(
'
.
'
);
return
domainParts
.
slice
(
-
1
*
keepNumber
).
join
(
'
.
'
);
};
};
...
...
misc/nginx.conf
View file @
61773c9e
...
@@ -100,7 +100,8 @@ http {
...
@@ -100,7 +100,8 @@ http {
set
$push_stream_channels_path
$1
;
set
$push_stream_channels_path
$1
;
# header to be sent when receiving new subscriber connection
# header to be sent when receiving new subscriber connection
push_stream_header_template
"<html><head><meta
http-equiv=
\
"Content-Type
\
"
content=
\
"text/html
;
charset=utf-8\">\r\n<meta
http-equiv=
\
"Cache-Control
\
"
content=
\
"no-store
\
">
\
r
\
n<meta
http-equiv=
\
"Cache-Control
\
"
content=
\
"no-cache
\
">
\
r
\
n<meta
http-equiv=
\
"Pragma
\
"
content=
\
"no-cache
\
">
\
r
\
n<meta
http-equiv=
\
"Expires
\
"
content=
\
"Thu,
1
Jan
1970
00
:
00
:
00
GMT
\
">
\
r
\
n<script
type=
\
"text/javascript
\
">
\
r
\
nwindow.onError
=
null
;
\r\ntry
{
document.domain
=
(window.location.hostname.match(/^(
\
d
{
1,3
}\
.)
{
3
}\
d
{
1,3
}
$
/
))
?
window.location.hostname
:
window.location.hostname.split('.').slice(-1
*
Math.max(window.location.hostname.split('.').length
-
1
,
2
)).join('.')
;}
catch
(e)
{}
\r\nparent.PushStream.register
(this)
;
\r\n</script>\r\n</head>\r\n<body>"
;
push_stream_header_template
"<html><head><meta
http-equiv=
\
"Content-Type
\
"
content=
\
"text/html
;
charset=utf-8\">\r\n<meta
http-equiv=
\
"Cache-Control
\
"
content=
\
"no-store
\
">
\
r
\
n<meta
http-equiv=
\
"Cache-Control
\
"
content=
\
"no-cache
\
">
\
r
\
n<meta
http-equiv=
\
"Pragma
\
"
content=
\
"no-cache
\
">
\
r
\
n<meta
http-equiv=
\
"Expires
\
"
content=
\
"Thu,
1
Jan
1970
00
:
00
:
00
GMT
\
">
\
r
\
n<script
type=
\
"text/javascript
\
">
\
r
\
nwindow.onError
=
null
;
\r\ntry
{
document.domain
=
(window.location.hostname.match(/^(
\
d
{
1,3
}\
.)
{
3
}\
d
{
1,3
}
$
/
))
?
window.location.hostname
:
window.location.hostname.split('.').slice(-1
*
Math.max(window.location.hostname.split('.').length
-
1
,
(window.location.hostname.match(/(
\
w
{
4,
}\
.
\
w
{
2
}
|
\
.
\
w
{
3,
}
)
$
/
)
?
2
:
3
))).join('.')
;}
catch
(e)
{}
\r\nparent.PushStream.register
(this)
;
\r\n</script>\r\n</head>\r\n<body>"
;
# message template
# message template
#push_stream_message_template "<script>p(~id~,'~channel~','~text~','~event-id~');</script>";
#push_stream_message_template "<script>p(~id~,'~channel~','~text~','~event-id~');</script>";
push_stream_message_template
"<script>p(~id~,'~channel~','~text~')
;
</script>"
;
push_stream_message_template
"<script>p(~id~,'~channel~','~text~')
;
</script>"
;
...
...
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