| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Increase coverage.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Before this change, the synchronous code would check sockets for
readability or writability before doing nonblocking read or write.
This changes them to attempt the read or write first, and then block
if the operation could not complete.
This also removes the no-longer-needed getpeername() call in tcp(),
which was needed to deal with the case where an unconnected socket was
passed in; waiting for writability would block rather than immediately
return an error. By attempting the write first, we get the error
immediately.
|
| |
|
|
|
|
| |
Previously, there was code to either use select.select or select.poll,
depending on OS. This changes it to use the selectors module, using
either SelectSelector or PollSelector, but sharing code otherwise.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing receive_udp() methods are only usable for receiving
responses, as they require an expected destination and check that the
message is from that destination.
This change makes the expected destination (and hence the check)
optional, and returns the address that the message was received from (in
the sync case, this is only done if no destination is provided, for
backwards compatibility).
New tests are added, which required adding generic getsockname() support
to the async backends.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
The sign() and validate() routines took a "first" parameter, which
indicated that this message was the first in a multi-message sequence.
This isn't needed, as it's identical to "not (ctx and multi)".
Remove the parameter from both, as well as the now-unneeded field in the
message object and message.from_wire() parameter.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
My first try at this did not play well with the refactoring of
_destination_and_source, as there will now be an af if source has one
and destination doesn't. We only want to make special literal URLs when
the destination is a literal.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now use dns.inet.low_level_address_tuple() for the low-level tuple
conversion.
We now detect mismatches between source and destination address families.
If a source_port has been specified but we have no idea about the
family, complain. (This can only happen when 'where' is a URL and no
source address has been specified either.)
'where' MUST be an address literal unless being called by DoH code, but we
tolerated failures in other cases.
In the DoH case where 'where' was a URL and source was specified, the
lack of an address family in the destination caused us to return None
for the source, and thus not set it even though the caller asked for it.
We now infer the address family from the source address in that case.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Classes inherit from object by default; there's no need to explicitly
include this.
Replace super(Foo, self) with super().
|
| | |
|
| |
|
|
|
| |
Allow passing a socket into dns.query.{udp,tcp,tls,udp_with_fallback},
and add tests for this.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
These methods (which convert a str/int into an enum/int) shouldn't be
commonly used by external code, so don't need to exist at the module
level. The make() method on the enum class (renamed from to_enum()) can
still be used, and the internal callers have been updated to use it.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
is not adding anything over https()
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Simplify code using try/finally to use context managers.
In some cases, contextlib.ExitStack() is used; this could probably be
further simplified to use contextlib.nullcontext() once Python 3.7+ is a
requirement.
|
| |\
| |
| | |
Remove "from __future__ import" statements.
|
| | |
| |
| |
| | |
None of these are needed anymore.
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|