wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wget-dev] wget2 | GSoC'18: Support DNS over HTTPS - Discussions (#3


From: Tim Rühsen
Subject: Re: [Wget-dev] wget2 | GSoC'18: Support DNS over HTTPS - Discussions (#378)
Date: Fri, 17 Aug 2018 09:37:38 +0000

base64url is base64 with small differences (char index 62 and 63 are different, 
the trailing '=' are omitted). See https://en.wikipedia.org/wiki/Base64. I just 
amended our decoder to also recognize '-' and '_' for char index 62 and 63, so 
just making it a bit more lenient to input.

For encoding there now is wget_base64_urlencode(), but it still pads with '='.

AFAIK, there is no `dns wire format` to `struct addrinfo` parser, you'll have 
to write your own (this is the fun part, isn't it !?). Of course there might 
be, e.g. in the glibc. But ripping it might always be copyright problematic. 
But here is some code written by me that you can use as starter, at least the 
parser part (I just copy the basics, not compilable).

```
ns_initparse(buf, n, &msg);
n = ns_msg_count(msg, ns_s_an);

for (int it = 0; it < n; it++) {
        if (ns_parserr(&msg, ns_s_an, it, &rr)) {
                fprintf(stderr, "ns_parserr: Failed at %d\n", it);
                continue;
        }

        const uint8_t *data = ns_rr_rdata(rr);

        ttl = ns_rr_ttl(rr);
        order = ns_get16(data); data += 2;
        pref = ns_get16(data); data += 2;

        ...
}
```

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/issues/378#note_95093951
You're receiving this email because of your account on gitlab.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]