From 2999a8068a882b32374d74cf725510fe12c23a41 Mon Sep 17 00:00:00 2001 From: Juan Pablo Date: Tue, 24 Sep 2013 04:02:14 -0300 Subject: [PATCH] Properly encoded parameters. Otherwise the query gets truncated. --- src/HttpReq.cpp | 22 ++++++++++++++++++++++ src/HttpReq.h | 2 ++ src/scrapers/GamesDBScraper.cpp | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/HttpReq.cpp b/src/HttpReq.cpp index 106192109..4cd4a46ec 100644 --- a/src/HttpReq.cpp +++ b/src/HttpReq.cpp @@ -5,6 +5,28 @@ boost::asio::io_service HttpReq::io_service; +std::string HttpReq::urlEncode(const std::string &s) +{ + const std::string unreserved = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"; + + std::string escaped=""; + for(size_t i=0; i GamesDBScraper::makeHttpReq(ScraperSearchParams params) if(cleanName.empty()) cleanName = params.game->getCleanName(); - path += "name=" + cleanName; + path += "name=" + HttpReq::urlEncode(cleanName); //platform TODO, should use some params.system get method return std::make_shared("thegamesdb.net", path);