Fix #303
This commit is contained in:
parent
ba7c7dc4a3
commit
1bf616d653
10
httplib.h
10
httplib.h
@ -1967,7 +1967,7 @@ inline std::string encode_url(const std::string &s) {
|
|||||||
case '\n': result += "%0A"; break;
|
case '\n': result += "%0A"; break;
|
||||||
case '\'': result += "%27"; break;
|
case '\'': result += "%27"; break;
|
||||||
case ',': result += "%2C"; break;
|
case ',': result += "%2C"; break;
|
||||||
case ':': result += "%3A"; break;
|
// case ':': result += "%3A"; break; // ok? probably...
|
||||||
case ';': result += "%3B"; break;
|
case ';': result += "%3B"; break;
|
||||||
default:
|
default:
|
||||||
auto c = static_cast<uint8_t>(s[i]);
|
auto c = static_cast<uint8_t>(s[i]);
|
||||||
@ -3666,13 +3666,7 @@ inline bool Client::write_request(Stream &strm, const Request &req,
|
|||||||
BufferStream bstrm;
|
BufferStream bstrm;
|
||||||
|
|
||||||
// Request line
|
// Request line
|
||||||
const static std::regex re(
|
const auto& path = detail::encode_url(req.path);
|
||||||
R"(^((?:[^:/?#]+://)?(?:[^/?#]*)?)?([^?#]*(?:\?[^#]*)?(?:#.*)?))");
|
|
||||||
|
|
||||||
std::smatch m;
|
|
||||||
if (!regex_match(req.path, m, re)) { return false; }
|
|
||||||
|
|
||||||
auto path = m[1].str() + detail::encode_url(m[2].str());
|
|
||||||
|
|
||||||
bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str());
|
bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user