mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-17 19:59:57 +00:00
persist etag
This commit is contained in:
parent
10e45ac493
commit
74efdb95e8
@ -158,7 +158,10 @@ namespace client
|
|||||||
std::string fname = etagsPath + i2p::fs::dirSep + subscription.ToBase32 () + ".txt";
|
std::string fname = etagsPath + i2p::fs::dirSep + subscription.ToBase32 () + ".txt";
|
||||||
std::ofstream f (fname, std::ofstream::out | std::ofstream::trunc);
|
std::ofstream f (fname, std::ofstream::out | std::ofstream::trunc);
|
||||||
if (f)
|
if (f)
|
||||||
f << etag << lastModified;
|
{
|
||||||
|
f << etag << std::endl;
|
||||||
|
f<< lastModified << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@ -363,6 +366,7 @@ namespace client
|
|||||||
nextUpdateTimeout = CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT;
|
nextUpdateTimeout = CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT;
|
||||||
else
|
else
|
||||||
m_IsLoaded = true;
|
m_IsLoaded = true;
|
||||||
|
if (m_Storage) m_Storage->SaveEtag (subscription, etag, lastModified);
|
||||||
}
|
}
|
||||||
if (m_SubscriptionsUpdateTimer)
|
if (m_SubscriptionsUpdateTimer)
|
||||||
{
|
{
|
||||||
@ -483,7 +487,7 @@ namespace client
|
|||||||
<< "X-Accept-Encoding: x-i2p-gzip;q=1.0, identity;q=0.5, deflate;q=0, gzip;q=0, *;q=0\r\n"
|
<< "X-Accept-Encoding: x-i2p-gzip;q=1.0, identity;q=0.5, deflate;q=0, gzip;q=0, *;q=0\r\n"
|
||||||
<< "Connection: close\r\n";
|
<< "Connection: close\r\n";
|
||||||
if (m_Etag.length () > 0) // etag
|
if (m_Etag.length () > 0) // etag
|
||||||
request << i2p::util::http::IF_NONE_MATCH << ": \"" << m_Etag << "\"\r\n";
|
request << i2p::util::http::IF_NONE_MATCH << ": " << m_Etag << "\r\n";
|
||||||
if (m_LastModified.length () > 0) // if-modfief-since
|
if (m_LastModified.length () > 0) // if-modfief-since
|
||||||
request << i2p::util::http::IF_MODIFIED_SINCE << ": " << m_LastModified << "\r\n";
|
request << i2p::util::http::IF_MODIFIED_SINCE << ": " << m_LastModified << "\r\n";
|
||||||
request << "\r\n"; // end of header
|
request << "\r\n"; // end of header
|
||||||
|
@ -99,6 +99,7 @@ namespace client
|
|||||||
|
|
||||||
AddressBook& m_Book;
|
AddressBook& m_Book;
|
||||||
std::string m_Link, m_Etag, m_LastModified;
|
std::string m_Link, m_Etag, m_LastModified;
|
||||||
|
// m_Etag must be surrounded by ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user