saghul / pycares

Python interface for c-ares
https://pypi.org/project/pycares/
MIT License
162 stars 74 forks source link

Update ares_query_txt_result_chunk to return bytes rather than str #160

Open maelp opened 3 years ago

maelp commented 3 years ago

The RFC1035 specification says that TXT records are allowed to contain data made of arbitrary binary data, but right now aiodns is parsing it as a str, and therefore will stop on a null byte, this PR fixes this

saghul commented 3 years ago

I think we need to apply the same to ares_query_txt_result, don't we? Also, I wonder why the GH action with the tests didn't run...

maelp commented 3 years ago

I’m on holidays for a few days but I can do it when I come back

On 11 Aug 2021, at 09:52, Saúl Ibarra Corretgé @.***> wrote:

 I think we need to apply the same to ares_query_txt_result, don't we? Also, I wonder why the GH action with the tests didn't run...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

saghul commented 3 years ago

Sure thing, no rush, and thanks for helping out with this!

maelp commented 3 years ago

@saghul I guess that now that both return bytes it should work as expected

maelp commented 3 years ago

It seems that the test_query_txt_multiple_chunked_with_non_ascii_content test fails because it is checking the server txt-non-ascii.dns-test.hmnid.ru which does not respond

https://mxtoolbox.com/SuperTool.aspx?action=txt%3atxt-non-ascii.dns-test.hmnid.ru&run=toolpage

maelp commented 3 years ago

Also the test_idna_encoding_query_a test seems to fail because the A query to españa.icom.museum seems to respond with a NXDOMAIN and SOA response (non-existent domain)

; <<>> DiG 9.10.6 <<>> españa.icom.museum
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 15201
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;espa\195\177a.icom.museum.     IN      A

;; AUTHORITY SECTION:
icom.museum.            600     IN      SOA     ns.oxymium.net. hostmaster.oxymium.net. 2021072901 28800 3600 604800 7200

;; Query time: 432 msec
;; SERVER: 172.20.10.1#53(172.20.10.1)
;; WHEN: Tue Aug 17 14:33:51 CEST 2021
;; MSG SIZE  rcvd: 109