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
10ae1427
Commit
10ae1427
authored
Apr 17, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle socket policy response in proxy itself.
parent
5d8e7ec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
wsproxy.py
wsproxy.py
+10
-5
No files found.
wsproxy.py
View file @
10ae1427
...
@@ -16,7 +16,7 @@ WebSocket-Protocol: sample\r
...
@@ -16,7 +16,7 @@ WebSocket-Protocol: sample\r
\r
\r
"""
"""
policy_response
=
"""<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>"""
policy_response
=
"""<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>
\n
"""
traffic_legend
=
"""
traffic_legend
=
"""
Traffic Legend:
Traffic Legend:
...
@@ -31,19 +31,24 @@ Traffic Legend:
...
@@ -31,19 +31,24 @@ Traffic Legend:
"""
"""
def
handshake
(
client
):
def
do_
handshake
(
client
):
handshake
=
client
.
recv
(
1024
)
handshake
=
client
.
recv
(
1024
)
print
"Handshake [
%
s]"
%
handshake
print
"Handshake [
%
s]"
%
handshake
if
handshake
.
startswith
(
"<policy-file-request/>"
):
if
handshake
.
startswith
(
"<policy-file-request/>"
):
print
"Sending:"
,
policy_response
print
"Sending:"
,
policy_response
client
.
send
(
policy_response
)
client
.
send
(
policy_response
)
handshake
=
client
.
recv
(
1024
)
client
.
close
()
print
"Handshake [
%
s]"
%
handshake
return
False
#handshake = client.recv(1024)
#if len(handshake) == 0:
# raise Exception("Policy exchange failed")
#print "Handshake [%s]" % handshake
req_lines
=
handshake
.
split
(
"
\r\n
"
)
req_lines
=
handshake
.
split
(
"
\r\n
"
)
_
,
path
,
_
=
req_lines
[
0
]
.
split
(
" "
)
_
,
path
,
_
=
req_lines
[
0
]
.
split
(
" "
)
_
,
origin
=
req_lines
[
4
]
.
split
(
" "
)
_
,
origin
=
req_lines
[
4
]
.
split
(
" "
)
_
,
host
=
req_lines
[
3
]
.
split
(
" "
)
_
,
host
=
req_lines
[
3
]
.
split
(
" "
)
client
.
send
(
server_handshake
%
(
origin
,
host
,
path
))
client
.
send
(
server_handshake
%
(
origin
,
host
,
path
))
return
True
def
traffic
(
token
=
"."
):
def
traffic
(
token
=
"."
):
sys
.
stdout
.
write
(
token
)
sys
.
stdout
.
write
(
token
)
...
@@ -137,7 +142,7 @@ def start_server(listen_port, target_host, target_port):
...
@@ -137,7 +142,7 @@ def start_server(listen_port, target_host, target_port):
print
'waiting for connection on port
%
s'
%
listen_port
print
'waiting for connection on port
%
s'
%
listen_port
csock
,
address
=
lsock
.
accept
()
csock
,
address
=
lsock
.
accept
()
print
'Got client connection from
%
s'
%
address
[
0
]
print
'Got client connection from
%
s'
%
address
[
0
]
handshake
(
csock
)
if
not
do_handshake
(
csock
):
continue
print
"Connecting to:
%
s:
%
s"
%
(
target_host
,
target_port
)
print
"Connecting to:
%
s:
%
s"
%
(
target_host
,
target_port
)
tsock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
tsock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
tsock
.
connect
((
target_host
,
target_port
))
tsock
.
connect
((
target_host
,
target_port
))
...
...
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