RequestContext is now a "complex" class that handle a lot of thing for
the handlers :
- The rootLocation is correctly handle and remove from the url.
So a handler doesn't have to care about it (when parsing the url)
- Request arguments and header are stored in a map and there are access
methods to get it.
- Request arguments can be automatically convert to other type than string.
- Better parsing of the `byte` header. Related to #91.
It is to the handlers to get the right reader/searcher they want and
create correct error/default page if the name doesn't correspond to a
zim file.
The `handle_default` function has also be renamed to `build_homepage`
because it is what is done. (And it doesn't handle a request).
`humanReadableBookId`, `reader` and `searcher` are not so global that
it seems.
Let's move it out of the request object as handler may or not use them.
This use the small API of kiwix-lib and so, cannot search a text query
and filter around a geo position in the same time.
There is no way to do a search but than write directly the search url
by hand.
If the request is wrongly formatted, the search is simply not done without
error message.
Almost nothing should be relative to the executable directory.
Content coming from the user should be relative to where the user
is (its working directory).
Fixes#70.
I don't know why we are refusing the first connection.
It seems to work without this.
Moreover, this is not thread safe and it would be pretty complex to
make it thread safe.
`std::cout` stream is not thread safe at all.
Printing from different threads can lead to corrupted stream (and no
output working).
Using `printf` may still lead to interleaved output but nothing will broke.
For firefox, the file encoding must be specified in the first 1024 bytes.
If it is not, firefox will reload the page when it founds it.
By inserting the taskbar's css directly in the html, we are "moving" down
the encoding of the page, and the encoding is not inside the first 1024
bytes.
This also improve a bit the performance as the browser can cache the css
file and it's avoid us to send the css in earch html file.
Global search is made only on the global task bar.
Task bar display in the article should provide full text search only
if the zim file has associated full text index.
This is done by having a `NULL` searcher. However, commit `558a0375`
return the globalSearcher if no searcher is associated to a zim.
This commit associate a `NULL` searcher to the zim, so we will not use
the globalSearcher.
Default `protocolPrefix` for the kiwix-lib searcher is `zim:://`.
We have to change it to `/` for all searcher we create else the search's
results will have a `zim://...` url, which will obviously won't work.