mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-02 13:42:29 +02:00
Improve HTTP/S header handling, reorganize HTTPS.
This commit is contained in:
parent
45d27f8ddc
commit
03ecb957a5
5 changed files with 58 additions and 43 deletions
|
@ -130,7 +130,7 @@ namespace data
|
|||
{
|
||||
std::string url = host + "i2pseeds.su3";
|
||||
LogPrint (eLogInfo, "Downloading SU3 from ", host);
|
||||
std::string su3 = https ? HttpsRequest (url) : i2p::util::http::httpRequest (url);
|
||||
std::string su3 = https ? i2p::util::http::httpsRequest (url) : i2p::util::http::httpRequest (url);
|
||||
if (su3.length () > 0)
|
||||
{
|
||||
std::stringstream s(su3);
|
||||
|
@ -491,30 +491,6 @@ namespace data
|
|||
LogPrint (eLogInfo, numCertificates, " certificates loaded");
|
||||
}
|
||||
|
||||
std::string Reseeder::HttpsRequest (const std::string& address)
|
||||
{
|
||||
i2p::util::http::url u(address);
|
||||
if (u.port_ == 80) u.port_ = 443;
|
||||
TlsSession session (u.host_, u.port_);
|
||||
|
||||
if (session.IsEstablished ())
|
||||
{
|
||||
// send request
|
||||
std::stringstream ss;
|
||||
ss << "GET " << u.path_ << " HTTP/1.1\r\nHost: " << u.host_
|
||||
<< "\r\nAccept: */*\r\n" << "User-Agent: Wget/1.11.4\r\n" << "Connection: close\r\n\r\n";
|
||||
session.Send ((uint8_t *)ss.str ().c_str (), ss.str ().length ());
|
||||
|
||||
// read response
|
||||
std::stringstream rs;
|
||||
while (session.Receive (rs))
|
||||
;
|
||||
return i2p::util::http::GetHttpContent (rs);
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
template<class Hash>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue