Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
24de6477
Commit
24de6477
authored
Apr 11, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed get_client_addr to get_real_client_addr
parent
f157be5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
handler.py
handler.py
+4
-5
No files found.
handler.py
View file @
24de6477
...
@@ -21,7 +21,7 @@ DELAY = 3
...
@@ -21,7 +21,7 @@ DELAY = 3
class
MixinHandler
(
object
):
class
MixinHandler
(
object
):
def
get_client_addr
(
self
):
def
get_
real_
client_addr
(
self
):
ip
=
self
.
request
.
headers
.
get
(
'X-Real-Ip'
)
ip
=
self
.
request
.
headers
.
get
(
'X-Real-Ip'
)
port
=
self
.
request
.
headers
.
get
(
'X-Real-Port'
)
port
=
self
.
request
.
headers
.
get
(
'X-Real-Port'
)
addr
=
None
addr
=
None
...
@@ -103,8 +103,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -103,8 +103,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
return
args
return
args
def
get_client_addr
(
self
):
def
get_client_addr
(
self
):
return
s
uper
(
IndexHandler
,
self
)
.
get_client_addr
()
or
self
.
request
.
\
return
s
elf
.
get_real_client_addr
()
or
self
.
request
.
connection
.
stream
.
\
connection
.
stream
.
socket
.
getpeername
()
socket
.
getpeername
()
def
ssh_connect
(
self
):
def
ssh_connect
(
self
):
ssh
=
paramiko
.
SSHClient
()
ssh
=
paramiko
.
SSHClient
()
...
@@ -173,8 +173,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
...
@@ -173,8 +173,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
self
.
worker_ref
=
None
self
.
worker_ref
=
None
def
get_client_addr
(
self
):
def
get_client_addr
(
self
):
return
super
(
WsockHandler
,
self
)
.
get_client_addr
()
or
self
.
stream
.
\
return
self
.
get_real_client_addr
()
or
self
.
stream
.
socket
.
getpeername
()
socket
.
getpeername
()
def
open
(
self
):
def
open
(
self
):
self
.
src_addr
=
self
.
get_client_addr
()
self
.
src_addr
=
self
.
get_client_addr
()
...
...
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