eventlet icon indicating copy to clipboard operation
eventlet copied to clipboard

Fix #599: Support bytes in getaddrinfo

Open Akrog opened this issue 6 years ago • 1 comments

Python's getaddrinfo supports bytes as the host parameter, but greendns's getaddrinfo doesn't and fails with the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "eventlet/support/greendns.py", line 517, in getaddrinfo
    qname, addrs = _getaddrinfo_lookup(host, family, flags)
  File "eventlet/support/greendns.py", line 479, in _getaddrinfo_lookup
    answer = resolve(host, qfamily, False, use_network=use_network)
  File "eventlet/support/greendns.py", line 425, in resolve
    use_network=use_network)
  File "eventlet/support/greendns.py", line 380, in query
    return end()
  File "eventlet/support/greendns.py", line 359, in end
    raise result[1]
  File "eventlet/support/greendns.py", line 340, in step
    a = fun(*args, **kwargs)
  File "dns/resolver.py", line 858, in query
    if qname.is_absolute():
AttributeError: 'bytes' object has no attribute 'is_absolute'

We need to take into account when we receive bytes as the type of the host parameter and decode it.

Fix #599

Akrog avatar Feb 12 '20 13:02 Akrog

CI test failures are caused by the incompatibility of the six version with the virtualenv version, as can be seen in the logs.

Virtualenv version 20.0.2 requires six version 1.12.0 or higher, as it needs the patch that adds ensure_text, but the CI has version 1.10.

Akrog avatar Feb 12 '20 13:02 Akrog

Codecov Report

Base: 38% // Head: 38% // No change to project coverage :thumbsup:

Coverage data is based on head (0e46f04) compared to base (0e46f04). Patch has no changes to coverable lines.

:exclamation: Current head 0e46f04 differs from pull request most recent head f724f4a. Consider uploading reports for the commit f724f4a to get more accurate results

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #600   +/-   ##
======================================
  Coverage      38%     38%           
======================================
  Files          88      88           
  Lines       13097   13097           
  Branches     1827    1827           
======================================
  Hits         5081    5081           
  Misses       7587    7587           
  Partials      429     429           
Flag Coverage Δ
ipv6 12% <0%> (ø)
py36epolls 51% <0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jan 20 '23 22:01 codecov[bot]

@tipabu added bytes to rest of .resolve methods, and six.binary_type. Could not quickly figure out how to add regression test to ProxyResolver.

temoto avatar Jan 20 '23 22:01 temoto

seems working, ready to merge after review

temoto avatar Jan 21 '23 23:01 temoto