Skip to content

Commit ab8c6f2

Browse files
Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986)
1 parent 9912486 commit ab8c6f2

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/httpserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
241241
}
242242

243243
LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n",
244-
RequestMethodString(hreq->GetRequestMethod()), SanitizeString(hreq->GetURI()).substr(0, 100), hreq->GetPeer().ToString());
244+
RequestMethodString(hreq->GetRequestMethod()), SanitizeString(hreq->GetURI(), SAFE_CHARS_URI).substr(0, 100), hreq->GetPeer().ToString());
245245

246246
// Find registered handler for prefix
247247
std::string strURI = hreq->GetURI();

src/util/strencodings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static const std::string SAFE_CHARS[] =
2020
CHARS_ALPHA_NUM + " .,;-_/:?@()", // SAFE_CHARS_DEFAULT
2121
CHARS_ALPHA_NUM + " .,;-_?@", // SAFE_CHARS_UA_COMMENT
2222
CHARS_ALPHA_NUM + ".-_", // SAFE_CHARS_FILENAME
23+
CHARS_ALPHA_NUM + "!*'();:@&=+$,/?#[]-_.~%", // SAFE_CHARS_URI
2324
};
2425

2526
std::string SanitizeString(const std::string& str, int rule)

src/util/strencodings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum SafeChars
2525
SAFE_CHARS_DEFAULT, //!< The full set of allowed chars
2626
SAFE_CHARS_UA_COMMENT, //!< BIP-0014 subset
2727
SAFE_CHARS_FILENAME, //!< Chars allowed in filenames
28+
SAFE_CHARS_URI, //!< Chars allowed in URIs (RFC 3986)
2829
};
2930

3031
/**

0 commit comments

Comments
 (0)