mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
* HTTPProxy.cpp : kill ExtractRequest()
This commit is contained in:
parent
02ac638bd4
commit
2cb5e1a6c2
@ -1,6 +1,5 @@
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
@ -52,7 +51,6 @@ namespace proxy {
|
||||
void AsyncSockRead();
|
||||
void HTTPRequestFailed(const char *message);
|
||||
void RedirectToJumpService(std::string & host);
|
||||
void ExtractRequest();
|
||||
bool ValidateHTTPRequest();
|
||||
void HandleJumpServices();
|
||||
bool CreateHTTPRequest(uint8_t *http_buff, std::size_t len);
|
||||
@ -142,19 +140,6 @@ namespace proxy {
|
||||
m_state = nstate;
|
||||
}
|
||||
|
||||
void HTTPReqHandler::ExtractRequest()
|
||||
{
|
||||
LogPrint(eLogDebug, "HTTPProxy: request: ", m_method, " ", m_url);
|
||||
i2p::http::URL url;
|
||||
url.parse (m_url);
|
||||
m_address = url.host;
|
||||
m_port = url.port;
|
||||
m_path = url.path;
|
||||
if (url.query.length () > 0) m_path += "?" + url.query;
|
||||
if (!m_port) m_port = 80;
|
||||
LogPrint(eLogDebug, "HTTPProxy: server: ", m_address, ", port: ", m_port, ", path: ", m_path);
|
||||
}
|
||||
|
||||
bool HTTPReqHandler::ValidateHTTPRequest()
|
||||
{
|
||||
if ( m_version != "HTTP/1.0" && m_version != "HTTP/1.1" )
|
||||
@ -200,7 +185,16 @@ namespace proxy {
|
||||
|
||||
bool HTTPReqHandler::CreateHTTPRequest(uint8_t *http_buff, std::size_t len)
|
||||
{
|
||||
ExtractRequest(); //TODO: parse earlier
|
||||
i2p::http::URL url;
|
||||
url.parse(m_url);
|
||||
m_address = url.host; /* < compatibility */
|
||||
m_port = url.port; /* < compatibility */
|
||||
if (!m_port) {
|
||||
m_port = (url.schema == "https") ? 443 : 80;
|
||||
}
|
||||
url.schema = "";
|
||||
url.host = "";
|
||||
m_path = url.to_string(); /* < compatibility */
|
||||
if (!ValidateHTTPRequest()) return false;
|
||||
HandleJumpServices();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user