This commit adds `history_init`, `history_append`, `history_back`, and
`history_forward` functions.
The history is implemented as an array, HISTORY, which is appended to
with history_append when pages are visited, and a pointer, HN, which
points to the current position in the array. When history_back is
called, it moves the pointer back 2 and calls blastoff to the URL there.
When history_forward is called, it does not move the pointer and
blastsoff to the URL. Why back and forward basically have an off-by-one
error is beyond me at this time.
ISSUES:
- if the user goes back then forward, the history is not rewritten for
later URLs. for example, if the history is
1.gmi 2.gmi 3.gmi*
where the * indicates the current history position, when the user goes
back 2, it looks like this:
1.gmi* 2.gmi 3.gmi
if the user then navigates to another page:
1.gmi 4.gmi* 3.gmi
3.gmi is still in the history, so the user can go forward from 4. This
is unexpected as far as every other client that I know of goes.
When navigating to a link with the port included, request_url doesn't do
the right thing. For now I've changed the code in transform_resource to
remove the port from the authority field, but that is probably not the
right place to put it.
I'm going to deal with this later though.
URL transformation (formerly called "munging") is now (afaict) fully
compliant with the RFC spec. It's also implemented in pure bash and is
available as a library at https://git.sr.ht/~acdw/shurlie.