Fix #635. HTTPS request stucked with proxy (#637)

This commit is contained in:
yhirose 2020-09-03 12:17:53 -04:00 committed by GitHub
parent b0fd4befb1
commit 69e75f4a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,6 +384,7 @@ struct Request {
struct Response {
std::string version;
int status = -1;
std::string reason;
Headers headers;
std::string body;
@ -4621,12 +4622,13 @@ inline bool ClientImpl::read_response_line(Stream &strm, Response &res) {
if (!line_reader.getline()) { return false; }
const static std::regex re("(HTTP/1\\.[01]) (\\d+).*?\r\n");
const static std::regex re("(HTTP/1\\.[01]) (\\d+) (.*?)\r\n");
std::cmatch m;
if (std::regex_match(line_reader.ptr(), m, re)) {
res.version = std::string(m[1]);
res.status = std::stoi(std::string(m[2]));
res.reason = std::string(m[3]);
}
return true;
@ -5035,7 +5037,7 @@ inline bool ClientImpl::process_request(Stream &strm, const Request &req,
}
if (res.get_header_value("Connection") == "close" ||
res.version == "HTTP/1.0") {
(res.version == "HTTP/1.0" && res.reason != "Connection established")) {
stop_core();
}