There was a misconception about how the ALPN API worked. It was actually
necessary to force a handshake so ALPN could be negotiated and
br_ssl_engine_get_selected_protocol() could possibly return any
information.
send_and_receive() now has a small diagnostics output for ALPN
and purr itself now forces the handshake before assembling the HTTP
requests, so it can use the ALPN results for that. The requests were
also reworked a bit.
It should be duplicated by who's going to use it, otherwise the
duplicated string will simply leak. Add function to free it, because why
not.
This also fixes a compiler warning about losing the const qualifier.
This was enabled by duplicating the socket fd and creating a write
stream for it using fdopen(). Pushing the write() error checking to libc
is much better than avoiding the additional allocation.
Redirects are implemented as a callback_header function pointer, so each
application using "PURRLIB" can have its own callbacks. However, when
and how the callbacks are called is defined by ssl_to_mmap, according to
the protocol.
Probably won't continue work on this, since I discovered.
https://github.com/MasterQ32/gurl . It also can't use TOFU, depends on
proper certificate chain.
Also fixed up makefile.
The changes here at least make it possible to support protocols other
than HTTP in the receiving functions.
Add base64 encoding per the pattern expected by the web interface.
Fix some pointers and file size things in purr/files.
TODO: files are cut off at random points, despite the efforts to remove
verification of null characters in libbaseencode.