Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
3a39bf60
Commit
3a39bf60
authored
Jul 07, 2011
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull IPv6 and HyBi fixes from websockify.
Pull 7ae8711 from websockify.
parent
123e5e74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
websocket.py
utils/websocket.py
+7
-5
websockify
utils/websockify
+2
-2
No files found.
utils/websocket.py
View file @
3a39bf60
...
@@ -142,15 +142,17 @@ Sec-WebSocket-Accept: %s\r
...
@@ -142,15 +142,17 @@ Sec-WebSocket-Accept: %s\r
#
#
# WebSocketServer static methods
# WebSocketServer static methods
#
#
@
staticmethod
@
staticmethod
def
addrinfo
(
host
,
port
=
None
):
def
addrinfo
(
host
,
port
=
None
):
""" Resolve a host (and optional port) to an IPv4 or IPv6 address.
""" Resolve a host (and optional port) to an IPv4 or IPv6 address.
Returns: family, socktype, proto, canonname, sockaddr
Returns: family, socktype, proto, canonname, sockaddr
"""
"""
if
not
host
:
host
=
'localhost'
addrs
=
socket
.
getaddrinfo
(
host
,
port
,
0
,
socket
.
SOCK_STREAM
,
socket
.
IPPROTO_TCP
)
addrs
=
socket
.
getaddrinfo
(
host
,
port
,
0
,
socket
.
SOCK_STREAM
,
socket
.
IPPROTO_TCP
)
if
not
addrs
:
if
not
addrs
:
raise
Exception
(
"Could resolve host '
%
s'"
%
self
.
target_
host
)
raise
Exception
(
"Could resolve host '
%
s'"
%
host
)
return
addrs
[
0
]
return
addrs
[
0
]
@
staticmethod
@
staticmethod
...
@@ -492,7 +494,7 @@ Sec-WebSocket-Accept: %s\r
...
@@ -492,7 +494,7 @@ Sec-WebSocket-Accept: %s\r
if
code
!=
None
:
if
code
!=
None
:
msg
=
struct
.
pack
(
">H
%
ds"
%
(
len
(
reason
)),
code
)
msg
=
struct
.
pack
(
">H
%
ds"
%
(
len
(
reason
)),
code
)
buf
=
self
.
encode_hybi
(
msg
,
opcode
=
0x08
,
base64
=
False
)
buf
,
h
,
t
=
self
.
encode_hybi
(
msg
,
opcode
=
0x08
,
base64
=
False
)
self
.
client
.
send
(
buf
)
self
.
client
.
send
(
buf
)
elif
self
.
version
==
"hixie-76"
:
elif
self
.
version
==
"hixie-76"
:
...
@@ -596,8 +598,8 @@ Sec-WebSocket-Accept: %s\r
...
@@ -596,8 +598,8 @@ Sec-WebSocket-Accept: %s\r
if
sys
.
hexversion
<
0x2060000
or
not
numpy
:
if
sys
.
hexversion
<
0x2060000
or
not
numpy
:
raise
self
.
EClose
(
"Python >= 2.6 and numpy module is required for HyBi-07 or greater"
)
raise
self
.
EClose
(
"Python >= 2.6 and numpy module is required for HyBi-07 or greater"
)
if
ver
==
'7'
:
if
ver
in
[
'7'
,
'8'
,
'9'
]
:
self
.
version
=
"hybi-0
7"
self
.
version
=
"hybi-0
"
+
ver
else
:
else
:
raise
self
.
EClose
(
'Unsupported protocol version
%
s'
%
ver
)
raise
self
.
EClose
(
'Unsupported protocol version
%
s'
%
ver
)
...
...
utils/websockify
View file @
3a39bf60
...
@@ -259,10 +259,10 @@ if __name__ == '__main__':
...
@@ -259,10 +259,10 @@ if __name__ == '__main__':
opts
.
listen_host
,
sep
,
opts
.
listen_port
=
args
[
0
]
.
rpartition
(
':'
)
opts
.
listen_host
,
sep
,
opts
.
listen_port
=
args
[
0
]
.
rpartition
(
':'
)
else
:
else
:
opts
.
listen_host
,
opts
.
listen_port
=
''
,
args
[
0
]
opts
.
listen_host
,
opts
.
listen_port
=
''
,
args
[
0
]
try
:
opts
.
listen_port
=
int
(
opts
.
listen_port
)
try
:
opts
.
listen_port
=
int
(
opts
.
listen_port
)
except
:
parser
.
error
(
"Error parsing listen port"
)
except
:
parser
.
error
(
"Error parsing listen port"
)
if
opts
.
wrap_cmd
:
if
opts
.
wrap_cmd
:
opts
.
target_host
=
None
opts
.
target_host
=
None
opts
.
target_port
=
None
opts
.
target_port
=
None
...
...
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