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
e15dc9ea
Commit
e15dc9ea
authored
Jul 12, 2018
by
Jason Madden
Committed by
GitHub
Jul 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1256 from gevent/issue1252
Don't pass the port when calling getaddrinfo from socket.connect.
parents
7420a0da
f5c8eeef
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
6 deletions
+36
-6
CHANGES.rst
CHANGES.rst
+8
-0
src/gevent/_socket2.py
src/gevent/_socket2.py
+1
-3
src/gevent/_socket3.py
src/gevent/_socket3.py
+1
-3
src/gevent/_socketcommon.py
src/gevent/_socketcommon.py
+26
-0
No files found.
CHANGES.rst
View file @
e15dc9ea
...
...
@@ -16,6 +16,14 @@
:class:`concurrent.futures.ThreadPoolExecutor` as well. Reported in
:issue:`1248` by wwqgtxx and :issue:`1251` by pyld.
- :meth:`gevent.socket.socket.connect` doesn't pass the port (service)
to :func:`socket.getaddrinfo` when it resolves an ``AF_INET`` or
``AF_INET6`` address. This fixes an issue on Solaris. Reported in
:issue:`1252` by wiggin15.
- :meth:`gevent.socket.socket.connect` works with more address
families, notably AF_TIPC, AF_NETLINK, AF_BLUETOOTH, AF_ALG and AF_VSOCK.
1.3.4 (2018-06-20)
==================
...
...
src/gevent/_socket2.py
View file @
e15dc9ea
...
...
@@ -228,9 +228,7 @@ class socket(object):
if
self
.
timeout
==
0.0
:
return
self
.
_sock
.
connect
(
address
)
sock
=
self
.
_sock
if
isinstance
(
address
,
tuple
):
r
=
getaddrinfo
(
address
[
0
],
address
[
1
],
sock
.
family
)
address
=
r
[
0
][
-
1
]
address
=
_socketcommon
.
_resolve_addr
(
sock
,
address
)
timer
=
Timeout
.
_start_new_or_dummy
(
self
.
timeout
,
timeout
(
'timed out'
))
try
:
...
...
src/gevent/_socket3.py
View file @
e15dc9ea
...
...
@@ -326,9 +326,7 @@ class socket(object):
def
connect
(
self
,
address
):
if
self
.
timeout
==
0.0
:
return
_socket
.
socket
.
connect
(
self
.
_sock
,
address
)
if
isinstance
(
address
,
tuple
):
r
=
getaddrinfo
(
address
[
0
],
address
[
1
],
self
.
family
)
address
=
r
[
0
][
-
1
]
address
=
_socketcommon
.
_resolve_addr
(
self
.
_sock
,
address
)
with
Timeout
.
_start_new_or_dummy
(
self
.
timeout
,
timeout
(
"timed out"
)):
while
True
:
...
...
src/gevent/_socketcommon.py
View file @
e15dc9ea
...
...
@@ -354,3 +354,29 @@ def _sendall(socket, data_memory, flags,
timeleft
=
__send_chunk
(
socket
,
chunk
,
flags
,
timeleft
,
end
)
data_sent
+=
len
(
chunk
)
# Guaranteed it sent the whole thing
# pylint:disable=no-member
_RESOLVABLE_FAMILIES
=
(
__socket__
.
AF_INET
,)
if
__socket__
.
has_ipv6
:
_RESOLVABLE_FAMILIES
+=
(
__socket__
.
AF_INET6
,)
def
_resolve_addr
(
sock
,
address
):
# Internal method: resolve the AF_INET[6] address using
# getaddrinfo.
if
sock
.
family
not
in
_RESOLVABLE_FAMILIES
or
not
isinstance
(
address
,
tuple
):
return
address
# address is (host, port) (ipv4) or (host, port, flowinfo, scopeid) (ipv6).
# We don't pass the port to getaddrinfo because the C
# socket module doesn't either (on some systems its
# illegal to do that without also passing socket type and
# protocol). Instead we join the port back at the end.
# See https://github.com/gevent/gevent/issues/1252
host
,
port
=
address
[:
2
]
r
=
getaddrinfo
(
host
,
None
,
sock
.
family
)
address
=
r
[
0
][
-
1
]
if
len
(
address
)
==
2
:
address
=
(
address
[
0
],
port
)
else
:
address
=
(
address
[
0
],
port
,
address
[
2
],
address
[
3
])
return
address
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