Skip to content

Commit

Permalink
HTTP 1.1 for addressbook
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Dec 24, 2014
1 parent 7b5e8a9 commit e349fac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion AddressBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ namespace client
if (!s.length()) continue; // skip empty line
m_Subscriptions.push_back (new AddressBookSubscription (*this, s));
}
LogPrint (eLogInfo, m_Subscriptions.size (), " subscriptions loaded");
}
else
LogPrint (eLogWarning, "subscriptions.txt not found");
Expand Down Expand Up @@ -419,6 +420,7 @@ namespace client
void AddressBookSubscription::Request ()
{
// must be run in separate thread
LogPrint (eLogInfo, "Downloading hosts from ", m_Link);
bool success = false;
i2p::util::http::url u (m_Link);
i2p::data::IdentHash ident;
Expand All @@ -435,7 +437,7 @@ namespace client
{
std::stringstream request, response;
// standard header
request << "GET " << u.path_ << " HTTP/1.0\r\nHost: " << u.host_
request << "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";
if (m_Etag.length () > 0) // etag
request << i2p::util::http::ETAG << ": " << m_Etag << "\r\n";
Expand Down Expand Up @@ -493,6 +495,7 @@ namespace client
isChunked = !header.compare (colon + 1, std::string::npos, "chunked");
}
}
LogPrint (eLogInfo, m_Link, " ETag: ", m_Etag, " Last-Modified: ", m_LastModified);
if (!response.eof ())
{
success = true;
Expand All @@ -515,6 +518,7 @@ namespace client
}
else
LogPrint (eLogError, "Can't resolve ", u.host_);
LogPrint (eLogInfo, "Download complete ", success ? "Success" : "Failed");
m_Book.DownloadComplete (success);
}
}
Expand Down

0 comments on commit e349fac

Please sign in to comment.