Just when I was about to deploy it they changed the
server to return HTTP/2... lol
No big deal (I think), fix the http header parser so
if the "OK" message string is missing it'll keep
parsing.
Refactor code out into fetch_and_parse() since the
two functions were pretty much the copy paste of
the other. This should simplify the rest of the
missing implementations too.
string_views are potentially wrong if raw is very small
and stdlib has small string optimisation. Use unique_ptr
instead to force allocations in all cases.
I don't think this is very clean, but they might fix
the bug in restc-cpp that is currently holding this
project back, and I might want to go back to it.
I might refactor this into a virtual class.
curl ultimately expects null-terminated strings and
makes a copy of each, so it's pointless to mess
around with string_views and stuff if I have to make
a copy for curl at the end anyways.
This fixes the build. The make function for the moment
just takes a string since that's all that's ever needed.
This is supposed to change since the postgresql database
will need a port, an url, password etc. Maybe
connection strings are still a thing, but if not then
I'll probably need to find a way to accept arbitrary
parameters in OriginsDB::make().
Currently you can't disable it since sqlite is the only
supported backend and you must have at least one enabled
and available on the system. This will be needed for later.
Previously the code would just throw an exception and
quit (foreign key constraint violation). Add an empty
row with the missing id so it will work. When the item
list returns that item the next time, the empty row will
be filled.
This is quite a big update, the new feature is that when the
program starts it loads the next update time from the db if
present. If so it resumes the timers from there. Maximum wait
time is currently capped at 24h.
TimerOroApi is not templated on methods anymore, rather on
the new DBOperation enum. This is so that it has that enum
value to pass it to other functions. This could've been a
separate commit, but wth...
Magic enum allows me to iterate over an enum's values at
build time, it's useful for building the query in OriginsDB
for the SELECT in the access table
(see make_select_last_access_str()).