Compare commits

...
Author SHA1 Message Date
Morteza Bashsiz 8158ac4ddc Merge pull request #157 from MortezaBashsiz/mori
use config http version
2026-05-08 09:29:09 +02:00
Morteza Bashsiz c68f588040 use config http version 2026-05-07 09:19:20 +02:00
5 changed files with 11 additions and 11 deletions

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@ void AgentHandler::handle() {
request_->httpType() == HTTP::HttpType::connect ? "open" : "request";
std::ostringstream outer;
outer << config_->randomMethod() + " /" + config_->randomEndPoint() + " HTTP/1.1\r\n"
outer << config_->randomMethod() + " /" + config_->randomEndPoint() + " HTTP/" + config_->agent().httpVersion + "\r\n"
<< "Host: " << relayHostHeader(config_) << "\r\n"
<< "User-Agent: Mozilla/5.0\r\n"
<< "Accept: */*\r\n"
+1 -1
View File
@@ -177,7 +177,7 @@ const std::string HTTP::genHttpRestPostReqString() const {
}
const std::string HTTP::genHttpOkResString(const std::string &body) const {
return std::string("HTTP/1.1 200 OK\r\n") +
return std::string("HTTP/" + config_->agent().httpVersion + " 200 OK\r\n") +
"Content-Type: application/x-www-form-urlencoded\r\n" +
"Content-Length: " + std::to_string(body.length()) + "\r\n" +
"Connection: keep-alive\r\n" + "Cache-Control: no-cache\r\n" +
+5 -5
View File
@@ -90,7 +90,7 @@ void ServerHandler::makePlainHttpResponse(const std::string &body,
const std::string &connection) {
std::ostringstream outer;
outer << "HTTP/1.1 " << status << "\r\n"
outer << "HTTP/" << config_->agent().httpVersion << status << "\r\n"
<< "Content-Type: application/octet-stream\r\n"
<< "Content-Length: " << body.size() << "\r\n"
<< "Connection: " << connection << "\r\n"
@@ -310,7 +310,7 @@ void ServerHandler::handle() {
Log::Level::INFO);
makeEncryptedHttpResponse(
"HTTP/1.1 502 Bad Gateway\r\n\r\n",
"HTTP/" + config_->agent().httpVersion + "502 Bad Gateway\r\n\r\n",
"502 Bad Gateway",
"close");
@@ -327,7 +327,7 @@ void ServerHandler::handle() {
Log::Level::INFO);
makeEncryptedHttpResponse(
"HTTP/1.1 200 Connection Established\r\n\r\n",
"HTTP/" + config_->agent().httpVersion + " 200 Connection Established\r\n\r\n",
"200 OK",
"keep-alive");
@@ -353,7 +353,7 @@ void ServerHandler::handle() {
Log::Level::INFO);
makeEncryptedHttpResponse(
"HTTP/1.1 502 Bad Gateway\r\n\r\n",
"HTTP/" + config_->agent().httpVersion + " 502 Bad Gateway\r\n\r\n",
"502 Bad Gateway",
"close");
@@ -381,7 +381,7 @@ void ServerHandler::handle() {
}
makeEncryptedHttpResponse(
"HTTP/1.1 200 Connection Established\r\n\r\n",
"HTTP/" + config_->agent().httpVersion + " 200 Connection Established\r\n\r\n",
"200 OK",
"close");
+3 -3
View File
@@ -167,14 +167,14 @@ bool TCPClient::doHandshakeClient() {
if (SSL_set_alpn_protos(sslSocket_->native_handle(),
alpn, sizeof(alpn)) != 0) {
log_->write("[" + to_string(uuid_) +
"] [TLS] Failed to set ALPN http/1.1",
"] [TLS] Failed to set ALPN http/" + config_->agent().httpVersion,
Log::Level::ERROR);
return false;
}
log_->write("[" + to_string(uuid_) +
"] [TLS] Using SNI/ALPN host: " + sniHost +
" [ALPN http/1.1]",
" [ALPN http/" + config_->agent().httpVersion + "]",
Log::Level::DEBUG);
}
}
@@ -193,7 +193,7 @@ bool TCPClient::doHandshakeClient() {
"] [TLS] Negotiated ALPN: " + negotiated,
Log::Level::DEBUG);
if (negotiated != "http/1.1") {
if (negotiated != "http/" + config_->agent().httpVersion) {
log_->write("[" + to_string(uuid_) +
"] [TLS] Unsupported negotiated ALPN: " + negotiated,
Log::Level::ERROR);
+1 -1
View File
@@ -404,7 +404,7 @@ std::string TCPConnection::postTunnelAction(const std::string &action, const std
const std::string encodedBody = encode64(enc.message);
std::ostringstream req;
req << config_->randomMethod() + " /" + config_->randomEndPoint() + " HTTP/1.1\r\n"
req << config_->randomMethod() + " /" + config_->randomEndPoint() + " HTTP/" + config_->agent().httpVersion + "\r\n"
<< "Host: " << makeRelayHostHeader() << "\r\n"
<< "User-Agent: Mozilla/5.0\r\n"
<< "Accept: */*\r\n"