Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
c99bf9f1
Commit
c99bf9f1
authored
Jan 22, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename gevent.evdns to gevent.dns
--HG-- rename : gevent/evdns.py => gevent/dns.py
parent
0ea8c9fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
gevent/dns.py
gevent/dns.py
+0
-0
gevent/socket.py
gevent/socket.py
+6
-6
greentest/test__evdns.py
greentest/test__evdns.py
+8
-7
No files found.
gevent/
ev
dns.py
→
gevent/dns.py
View file @
c99bf9f1
File moved
gevent/socket.py
View file @
c99bf9f1
...
...
@@ -774,7 +774,7 @@ def wrap_ssl000(sock, keyfile=None, certfile=None):
return
ssl_sock
try
:
from
gevent.
ev
dns
import
resolve_ipv4
,
resolve_ipv6
from
gevent.dns
import
resolve_ipv4
,
resolve_ipv6
except
:
import
traceback
traceback
.
print_exc
()
...
...
@@ -783,11 +783,11 @@ except:
else
:
def
gethostbyname
(
hostname
):
""":func:`socket.gethostbyname` implemented using :mod:`
ev
dns`.
""":func:`socket.gethostbyname` implemented using :mod:`dns`.
Differs in the following ways:
* raises :class:`DNSError` (a subclass of :class:`socket.gaierror`) with
ev
dns error
* raises :class:`DNSError` (a subclass of :class:`socket.gaierror`) with dns error
codes instead of standard socket error codes
* does not support ``/etc/hosts`` but calls the original :func:`socket.gethostbyname`
if *hostname* has no dots
...
...
@@ -807,7 +807,7 @@ else:
def
getaddrinfo
(
host
,
port
,
*
args
,
**
kwargs
):
"""*Some* approximation of :func:`socket.getaddrinfo` implemented using :mod:`
ev
dns`.
"""*Some* approximation of :func:`socket.getaddrinfo` implemented using :mod:`dns`.
If *host* is not a string, does not has any dots or is a numeric IP address, then
the standard :func:`socket.getaddrinfo` is called.
...
...
@@ -817,7 +817,7 @@ else:
Differs in the following ways:
* raises :class:`DNSError` (a subclass of :class:`gaierror`) with
ev
dns error
* raises :class:`DNSError` (a subclass of :class:`gaierror`) with
libevent-
dns error
codes instead of standard socket error codes
* IPv6 support is untested.
* AF_UNSPEC only tries IPv4
...
...
@@ -826,7 +826,7 @@ else:
* *flags* argument is ignored
Additionally, supports *evdns_flags* keyword arguments (default ``0``) that is passed
to :mod:`
ev
dns` functions.
to :mod:`dns` functions.
"""
family
,
socktype
,
proto
,
_flags
=
args
+
(
None
,
)
*
(
4
-
len
(
args
))
if
not
isinstance
(
host
,
str
)
or
'.'
not
in
host
or
_ip4_re
.
match
(
host
):
...
...
greentest/test__evdns.py
View file @
c99bf9f1
#!/usr/bin/python
import
greentest
from
gevent
import
ev
dns
from
gevent
import
dns
from
gevent
import
core
from
gevent
import
socket
from
gevent.dns
import
DNSError
funcs
=
[
evdns
.
resolve_ipv4
,
ev
dns
.
resolve_ipv6
,
evdns
.
resolve_reverse
,
ev
dns
.
resolve_reverse_ipv6
]
funcs
=
[
dns
.
resolve_ipv4
,
dns
.
resolve_ipv6
,
dns
.
resolve_reverse
,
dns
.
resolve_reverse_ipv6
]
class
TestNoSwitch
(
greentest
.
TestCase
):
...
...
@@ -30,10 +31,10 @@ class TestSwitch(greentest.TestCase):
switch_expected
=
True
def
test_empty_string
(
self
):
self
.
assertRaises
(
evdns
.
DNSError
,
ev
dns
.
resolve_ipv4
,
''
)
self
.
assertRaises
(
evdns
.
DNSError
,
ev
dns
.
resolve_ipv6
,
''
)
self
.
assertRaises
(
evdns
.
DNSError
,
ev
dns
.
resolve_reverse
,
''
)
self
.
assertRaises
(
evdns
.
DNSError
,
ev
dns
.
resolve_reverse_ipv6
,
''
)
self
.
assertRaises
(
DNSError
,
dns
.
resolve_ipv4
,
''
)
self
.
assertRaises
(
DNSError
,
dns
.
resolve_ipv6
,
''
)
self
.
assertRaises
(
DNSError
,
dns
.
resolve_reverse
,
''
)
self
.
assertRaises
(
DNSError
,
dns
.
resolve_reverse_ipv6
,
''
)
if
__name__
==
'__main__'
:
...
...
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