Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
DNS testing tools
Remoh
Commits
428bb128
Commit
428bb128
authored
Oct 20, 2020
by
Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store connection state
parent
aabc9550
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
homer.py
homer.py
+2
-1
homer/connection.py
homer/connection.py
+7
-0
No files found.
homer.py
View file @
428bb128
...
...
@@ -683,7 +683,8 @@ for ip in ip_set:
if
opts
.
ifile
is
not
None
:
input
.
close
()
conn
.
end
()
if
conn
.
state
==
'CONN_OK'
:
conn
.
end
()
if
ok
:
if
opts
.
check
or
opts
.
pipelining
:
...
...
homer/connection.py
View file @
428bb128
...
...
@@ -52,6 +52,7 @@ class Connection:
self
.
forceIPv4
=
forceIPv4
self
.
forceIPv6
=
forceIPv6
self
.
connect_to
=
connect_to
self
.
state
=
'CONN_OK'
def
__str__
(
self
):
return
self
.
server
...
...
@@ -174,15 +175,20 @@ class ConnectionDOT(Connection):
self
.
session
.
connect
((
addr
))
self
.
session
.
do_handshake
()
except
homer
.
exceptions
.
TimeoutConnectionError
:
self
.
state
=
'CONN_TIMEOUT'
raise
homer
.
ConnectionDOTException
(
"Timeout"
)
except
OSError
:
self
.
state
=
'CONN_FAILED'
raise
homer
.
ConnectionDOTException
(
"Cannot connect"
)
except
OpenSSL
.
SSL
.
SysCallError
as
e
:
self
.
state
=
e
.
args
[
1
]
raise
homer
.
ConnectionDOTException
(
"OpenSSL error: %s"
%
e
.
args
[
1
])
except
OpenSSL
.
SSL
.
ZeroReturnError
:
# see #18
self
.
state
=
'CONN_CLOSED'
raise
homer
.
ConnectionDOTException
(
"Error: The SSL connection has been closed (try with --nosni to avoid sending SNI ?)"
)
except
OpenSSL
.
SSL
.
Error
as
e
:
self
.
state
=
'CONN_ERROR'
raise
homer
.
ConnectionDOTException
(
"OpenSSL error: %s"
%
', '
.
join
(
err
[
0
][
2
]
for
err
in
e
.
args
))
# RFC 7858, section 4.2 and appendix A
...
...
@@ -429,6 +435,7 @@ class ConnectionDOH(Connection):
try
:
handle
.
perform
()
except
pycurl
.
error
as
e
:
self
.
state
=
e
.
args
[
1
]
raise
homer
.
DOHException
(
e
.
args
[
1
])
def
receive
(
self
,
handle
):
...
...
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