When kiwix-serve is started with a non-empty --urlRootLocation parameter and
a request for a URL *not* starting with the specified URL prefix is
received, the message in the error response contains a wrong URL. For
example if the URL root location is set to '/abc', and '/klmn/xyz' is
requested the error message reads:
The requested URL "/abcINVALID URL" was not found on this server.
It turns out that the C preprocessor doesn't complain about undefined
macros used in the arithmetic expressions in `#if` directives (treating
those conditions simply as not satisfied). As a result, PR #1293 had
a slightly different effect from that which was intended. Now taking
the opportunity to correct that subtle mistake.
libmicrohttpd 1.0.5 (the version used at this point under the debian
testing distribution) seems to return an HTTP 400 (Bad Request) error
if the URL contains an invalid URI-encoding sequence, thus breaking
our unit-tests involving such URLs. Upgrading our libmicrohttpd
dependency is not easy, so this change is an optimistic attempt to fix
the build of the libkiwix package under debian testing.
Documentation of libkiwix API has been largely neglected. This commit
documents the Server API having to do with the functionality fixed in
the previous commit.
kiwix-serve without an explicitly supplied -i option can henceforth run
on IPv4-only systems. Before this fix, an "Unable to instantiate the
HTTP daemon." error was being reported.
- Increment the iteration counter to prevent infinite loops when GetAdaptersAddresses returns ERROR_BUFFER_OVERFLOW.
- Free the previously allocated buffer before re-allocating to prevent memory leaks on retry.
Signed-off-by: shbhmexe <shubhushukla586@gmail.com>
- Fix infinite loop and memory leak in Windows network tools (networkTools.cpp)
- Improve exception safety in removeAccents using RAII (stringTools.cpp)
- Change getBookById to return by value to avoid dangling references (library.cpp)
- Use proper constant for HTTP 416 instead of magic number (response.cpp)
- Fix exception slicing in getDownload re-throw (downloader.cpp)
Signed-off-by: shbhmexe <shubhushukla586@gmail.com>