In case of infinit redirection, if we post-increment the loop counter,
we will exit the loop when loopCounter will be 42 and increment it.
So loop counter will be 43.
Let's pre-increment the counter to still compare with 42 (more consistancy)
Fix#168
There are two kinds of search system :
- Suggestion (search in title only)
- "Classical" search (search in whole content)
The option `--suggestion` allow `kiwix-search` to search for suggestion.
Without the option, a "classical" search is made.
Fix#132.
`xapian-core.pc` is now correct stop workaround it adding extra
link args.
The workaround is broken with meson 0.44.0 and static compilation.
However, libmicrohttpd is using `librt` if present but doesn't declare
it in its `libmicrohttpd.pc` file so we must add it manually if we found
it.
The parsing of the request in the `RequestContext` constructor may be
buggy and make kiwix-serve crash.
If we print debug information only after the request is parsed, we will
never print the debug information if the parsing crash.
It is better to, at least, write that we've got a new request to avoid
us to try to debug previous request where everything were ok.
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.