From 587b76bf6d9ae2483abc82667a3614ee58c3f230 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Wed, 7 May 2014 17:33:38 +0200 Subject: [PATCH] + Fix deal with relative urls --- src/common/kiwix/reader.cpp | 7 ++++++- src/common/kiwix/reader.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/kiwix/reader.cpp b/src/common/kiwix/reader.cpp index e6e7f2e42..be99bdbe4 100644 --- a/src/common/kiwix/reader.cpp +++ b/src/common/kiwix/reader.cpp @@ -375,8 +375,13 @@ namespace kiwix { return this->getContentByEncodedUrl(url, content, contentLength, contentType); } + bool Reader::getContentByEncodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType, string &baseUrl) { + return this->getContentByDecodedUrl(kiwix::urlDecode(url), content, contentLength, contentType, baseUrl); + } + bool Reader::getContentByEncodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType) { - return this->getContentByDecodedUrl(kiwix::urlDecode(url), content, contentLength, contentType); + std::string stubRedirectUrl; + return this->getContentByEncodedUrl(kiwix::urlDecode(url), content, contentLength, contentType, stubRedirectUrl); } bool Reader::getContentByDecodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType) { diff --git a/src/common/kiwix/reader.h b/src/common/kiwix/reader.h index a63d55006..f35cfc0b0 100644 --- a/src/common/kiwix/reader.h +++ b/src/common/kiwix/reader.h @@ -62,6 +62,7 @@ namespace kiwix { bool getFavicon(string &content, string &mimeType); bool getPageUrlFromTitle(const string &title, string &url); bool getContentByUrl(const string &url, string &content, unsigned int &contentLength, string &contentType); + bool getContentByEncodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType, string &baseUrl); bool getContentByEncodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType); bool getContentByDecodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType, string &baseUrl); bool getContentByDecodedUrl(const string &url, string &content, unsigned int &contentLength, string &contentType);