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
deef92fe
Commit
deef92fe
authored
Oct 13, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move get_client_addr to MixinHandler
parent
e66e5f20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
handler.py
webssh/handler.py
+4
-7
No files found.
webssh/handler.py
View file @
deef92fe
...
...
@@ -48,6 +48,10 @@ class MixinHandler(object):
raise
InvalidValueError
(
'Missing value {}'
.
format
(
name
))
return
value
def
get_client_addr
(
self
):
return
self
.
get_real_client_addr
()
or
self
.
request
.
connection
.
context
.
\
address
def
get_real_client_addr
(
self
):
ip
=
self
.
request
.
remote_ip
...
...
@@ -194,10 +198,6 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
logging
.
debug
(
args
)
return
args
def
get_client_addr
(
self
):
return
self
.
get_real_client_addr
()
or
self
.
request
.
connection
.
stream
.
\
socket
.
getpeername
()
def
get_default_encoding
(
self
,
ssh
):
try
:
_
,
stdout
,
_
=
ssh
.
exec_command
(
'locale charmap'
)
...
...
@@ -277,9 +277,6 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
self
.
loop
=
loop
self
.
worker_ref
=
None
def
get_client_addr
(
self
):
return
self
.
get_real_client_addr
()
or
self
.
stream
.
socket
.
getpeername
()
def
open
(
self
):
self
.
src_addr
=
self
.
get_client_addr
()
logging
.
info
(
'Connected from {}:{}'
.
format
(
*
self
.
src_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