Skip to content

Conversation

SukkaW
Copy link

@SukkaW SukkaW commented Aug 22, 2025

Follows #96, cc @lsongdev

📑 Description

  • Re-add pathname auto completion, but this time only for input w/o any /
    • So 1.0.0.1 and dns.google will become https://1.0.0.1/dns-query and https://dns.google/dns-query
    • But https://1.0.0.1 will still be https://1.0.0.1
  • URL.searchParams is mutable and manipulatable, we don't need to re-assign a string to .search
  • Prefer URL.href over URL.toString()
  • Passes URL object directly to http.get, https.get, and h2.get
    • All three implementations accept URL type; we don't need to convert the URL to a string here.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

@SukkaW SukkaW force-pushed the refactor-doh-impl branch from 39cb53f to 6775754 Compare August 22, 2025 12:18
@lsongdev
Copy link
Owner

I’m a bit concerned this behavior might be too implicit. For example, dns.google and https://dns.google would resolve differently (one gets /dns-query appended, the other not), which could be confusing.

Any thoughts please let me know.

@SukkaW
Copy link
Author

SukkaW commented Aug 27, 2025

I’m a bit concerned this behavior might be too implicit. For example, dns.google and https://dns.google would resolve differently (one gets /dns-query appended, the other not), which could be confusing.

Any thoughts please let me know.

While the vast majority of DoH servers serve at the /dns-query path, there are some edge cases where a DoH server serves at the root path. Here are a few examples:

  • dns.nextdns.io (and anycast.dns.nextdns.io)
  • zero.dns0.eu (which is also powered by NextDNS)
  • basic.rethinkdns.com

While many of those examples actually also serve on /dns-query as well, such edge cases should not be overlooked.

On the other hand, there are many DoH servers serving at other paths:

  • https://dns.bebasid.com/unfiltered
  • https://internetsehat.bebasid.com/adblock (also https://dns.bebasid.com/dns-oisd and https://dns.bebasid.com/dns-hagezi)
  • https://doh.cleanbrowsing.org/doh/family-filter (also https://doh.cleanbrowsing.org/doh/adult-filter)
  • https://freedns.controld.com/p0 (also https://freedns.controld.com/p1, https://freedns.controld.com/p2, and https://freedns.controld.com/p3)
  • https://odvr.nic.cz/doh
  • https://dns.dnswarden.com/uncensored

So we expect:

  • We can auto-complete https:// and /dns-query for the vast majority of DoH servers:
    • dns.google -> https://dns.google/dns-query
    • 1.0.0.1-> https://1.0.0.1/dns-query
    • [2a09::] -> https://[2a09::]/dns-query
  • We can not auto-complete the path for input with a specified path, but we still can auto-complete the HTTPS protocol:
    • odvr.nic.cz/doh -> https://odvr.nic.cz/doh
    • dns.bebasid.com/unfiltered -> https://dns.bebasid.com/unfiltered
    • Actually, we want this to work as well: zero.dns0.eu/ -> https://zero.dns0.eu/
  • We can not auto-complete the path for an input that looks like an exact URL (since the path might/could be explicit):
    • https://dns.google/dns-query -> do nothing
    • https://doh.cleanbrowsing.org/doh/family-filter -> do nothing
    • https://dns.nextdns.io and https://dns.nextdns.io/ -> should also do nothing because those servers serve at the root path as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants