Skip to content

Various enhancements

Tim Rühsen requested to merge gh-8b1a701c/121/juaristi/various-fixes into master

Created by: juaristi

I find myself in the need of these functions for HPKP, but since they're pretty generic, I put them here, in a separate patch.

  • wget_base64_get_decoded_length is a macro that computes the length a base64-decoded string will have after decoding. It basically translates to ((len + 3) / 4) * 3 + 1, but you don't have to remember it :)
  • Two new functions: wget_iri_is_ipv4_address and wget_iri_is_ipv6_address, that test whether the host part of an IRI is a literal IPv4/IPv6 address or not. These depend on inet_pton, which fortunately is part of gnulib. Actually, I notice the gnulib code is copied verbatim into the equivalent wget function, I don't know why.
  • HSTS should not add a host if it's a literal IPv4 or IPv6 address. This is mandated by the spec. The same goes for HPKP as well. And that's why the two functions above come in handy.

Merge request reports