mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-02 13:42:29 +02:00
Refactor URL parser.
This commit is contained in:
parent
1e7d4eb711
commit
66db088761
4 changed files with 140 additions and 112 deletions
|
@ -466,7 +466,7 @@ namespace client
|
|||
bool success = false;
|
||||
i2p::util::http::url u (m_Link);
|
||||
i2p::data::IdentHash ident;
|
||||
if (m_Book.GetIdentHash (u.host_, ident) && m_Book.getSharedLocalDestination())
|
||||
if (m_Book.GetIdentHash (u.m_host, ident) && m_Book.getSharedLocalDestination())
|
||||
{
|
||||
std::condition_variable newDataReceived;
|
||||
std::mutex newDataReceivedMutex;
|
||||
|
@ -487,13 +487,13 @@ namespace client
|
|||
{
|
||||
std::stringstream request, response;
|
||||
// standard header
|
||||
request << i2p::util::http::httpHeader(u.path_, u.host_, "1.1");
|
||||
request << i2p::util::http::httpHeader(u.m_path, u.m_host, "1.1");
|
||||
if (m_Etag.length () > 0) // etag
|
||||
request << i2p::util::http::IF_NONE_MATCH << ": \"" << m_Etag << "\"\r\n";
|
||||
if (m_LastModified.length () > 0) // if modified since
|
||||
request << i2p::util::http::IF_MODIFIED_SINCE << ": " << m_LastModified << "\r\n";
|
||||
request << "\r\n"; // end of header
|
||||
auto stream = m_Book.getSharedLocalDestination()->CreateStream (leaseSet, u.port_);
|
||||
auto stream = m_Book.getSharedLocalDestination()->CreateStream (leaseSet, u.m_port);
|
||||
stream->Send ((uint8_t *)request.str ().c_str (), request.str ().length ());
|
||||
|
||||
uint8_t buf[4096];
|
||||
|
@ -569,10 +569,10 @@ namespace client
|
|||
LogPrint (eLogWarning, "Addressbook HTTP response ", status);
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "Address ", u.host_, " not found");
|
||||
LogPrint (eLogError, "Address ", u.m_host, " not found");
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "Can't resolve ", u.host_);
|
||||
LogPrint (eLogError, "Can't resolve ", u.m_host);
|
||||
LogPrint (eLogInfo, "Download complete ", success ? "Success" : "Failed");
|
||||
m_Book.DownloadComplete (success);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue