Typedefs sha256_pin_t & getdns_log_config multiple declaration in context.h,
tls.h and tls_internal.h causes build error with some gnu99 compilers, even
if the redefinition is identical.
One possible way is to protect each occurence with ifdefs, but it seems too
brute, other one is to keep typedef in context.h only and use struct types
in recently added tls* scope.
Error example:
../libtool --quiet --tag=CC --mode=compile arm-brcm-linux-uclibcgnueabi-gcc
-std=gnu99 -I. -I. -I./util/auxiliary -I./tls -I./openssl -I./../stubby/src
-Wall -Wextra -D_BSD_SOURCE -D_DEFAULT_SOURCE ... -c ./convert.c -o convert.lo
In file included from ./context.h:53:0,
from ./util-internal.h:42,
from ./convert.c:50:
./tls.h:45:27: error: redefinition of typedef 'sha256_pin_t'
./openssl/tls-internal.h:57:27: note: previous declaration of 'sha256_pin_t' was here
In file included from ./util-internal.h:42:0,
from ./convert.c:50:
./context.h:133:3: error: redefinition of typedef 'sha256_pin_t'
./tls.h:45:27: note: previous declaration of 'sha256_pin_t' was here
./context.h:267:3: error: redefinition of typedef 'getdns_log_config'
./openssl/tls-internal.h:58:34: note: previous declaration of 'getdns_log_config' was here
When calculating HTTP request buffer size tas_connect() unnecessarily adds
an extra octet for the terminating NULL byte.
The terminating NULL was already accounted for by sizeof(fmt), however,
since sizeof("123") = 4.
The extra NULL byte at the end of the anchor fetch HTTP request resulted
in an extra "501 Not implemented" HTTP response from the trust anchor
server.
tas_doc_read() uses a very short 50 msec network read timeout which makes
fetching trust anchors pretty much impossible on high-latency connections
like 3G.
Use a 2 second read timeout, just like the other tas_read_cb() callback
setter does.
On mingw64, configure does not find declarations for inet_ntop() and inet_pton(), but does find implementations, and so does not try to compile the compat versions.
On mingw32, configure find neither declarations or implementations, and so tries to compile the compat versions. However, there are declarations in ws2tcpip.h, and these do not have the same prototype as compat. The build fails, complaining about conflicting types for inet_ntop().
The declarations in ws2tcpip.h are #defines to Windows functions InetNtopA() and InetPtonA(). Which is not good, but we're stuck with it. Try to work around this by including ws2tcpip.h in the headers while checking for declarations. Unfortunately it looks like you can't do that when checking for implementations and substituting compat versions when not found. So only do that if we don't find declarations; we're already making sure that ws2tcpip.h is included via config.h in source modules.
The isxxxx() and toxxxx() functions have a limited well-defined
input value range, namely that of "unsigned char" plus EOF. Cast
args accordingly.
Bring strncasecmp() into scope by including <strings.h>.