fixed GH #1260: URI encoding

This commit is contained in:
Guenter Obiltschnig 2017-02-17 09:23:36 +01:00
parent af39c8d819
commit c32e683b6c
2 changed files with 8 additions and 8 deletions

View File

@ -342,6 +342,7 @@ protected:
static const std::string RESERVED_PATH;
static const std::string RESERVED_QUERY;
static const std::string RESERVED_QUERY_PARAM;
static const std::string RESERVED_FRAGMENT;
static const std::string ILLEGAL;

View File

@ -25,10 +25,11 @@
namespace Poco {
const std::string URI::RESERVED_PATH = "?#";
const std::string URI::RESERVED_QUERY = "?#/";
const std::string URI::RESERVED_FRAGMENT = "";
const std::string URI::ILLEGAL = "%<>{}|\\\"^`";
const std::string URI::RESERVED_PATH = "?#";
const std::string URI::RESERVED_QUERY = "?#/:;+@";
const std::string URI::RESERVED_QUERY_PARAM = "?#/:;+@&=";
const std::string URI::RESERVED_FRAGMENT = "";
const std::string URI::ILLEGAL = "%<>{}|\\\"^`!*'()$,[]";
URI::URI():
@ -333,12 +334,10 @@ void URI::setQuery(const std::string& query)
void URI::addQueryParameter(const std::string& param, const std::string& val)
{
std::string reserved(RESERVED_QUERY);
reserved += "=&";
if (!_query.empty()) _query += '&';
encode(param, reserved, _query);
encode(param, RESERVED_QUERY_PARAM, _query);
_query += '=';
encode(val, reserved, _query);
encode(val, RESERVED_QUERY_PARAM, _query);
}