From 74e58c920c87fb0bf1e35be86ab1ea8f055394ac Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 11 Feb 2009 15:27:19 +0000 Subject: lt sync 3253 - fix ssl trackers --- ChangeLog | 1 + libtorrent/include/libtorrent/xml_parse.hpp | 15 +++++++++++---- libtorrent/src/http_connection.cpp | 7 +++++-- libtorrent/src/torrent.cpp | 4 ---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 183015920..3e7445c28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ Deluge 1.1.3 - (In Development) Core: * Fix issue where checking queue would stop + * Fix announcing to SSL trackers Misc: * Fix issue when initializing gettext that would prevent deluge from starting diff --git a/libtorrent/include/libtorrent/xml_parse.hpp b/libtorrent/include/libtorrent/xml_parse.hpp index 4e53afeea..b65b2c1df 100644 --- a/libtorrent/include/libtorrent/xml_parse.hpp +++ b/libtorrent/include/libtorrent/xml_parse.hpp @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_XML_PARSE_HPP #include +#include namespace libtorrent { @@ -49,6 +50,12 @@ namespace libtorrent xml_parse_error }; + inline bool isspace(char c) + { + const static char* ws = " \t\n\r\f\v"; + return std::strchr(ws, c); + } + // callback(int type, char const* name, char const* val) // str2 is only used for attributes. name is element or attribute // name and val is attribute value @@ -82,7 +89,7 @@ namespace libtorrent ++p; // parse the name of the tag. - for (start = p; p != end && *p != '>' && !std::isspace(*p); ++p); + for (start = p; p != end && *p != '>' && !isspace(*p); ++p); char* tag_name_end = p; @@ -149,11 +156,11 @@ namespace libtorrent for (char* i = tag_name_end; i < tag_end; ++i) { // find start of attribute name - for (; i != tag_end && std::isspace(*i); ++i); + for (; i != tag_end && isspace(*i); ++i); if (i == tag_end) break; start = i; // find end of attribute name - for (; i != tag_end && *i != '=' && !std::isspace(*i); ++i); + for (; i != tag_end && *i != '=' && !isspace(*i); ++i); char* name_end = i; // look for equality sign @@ -169,7 +176,7 @@ namespace libtorrent } ++i; - for (; i != tag_end && std::isspace(*i); ++i); + for (; i != tag_end && isspace(*i); ++i); // check for parse error (values must be quoted) if (i == tag_end || (*i != '\'' && *i != '\"')) { diff --git a/libtorrent/src/http_connection.cpp b/libtorrent/src/http_connection.cpp index b831fa4f6..d750e92e5 100644 --- a/libtorrent/src/http_connection.cpp +++ b/libtorrent/src/http_connection.cpp @@ -399,8 +399,11 @@ void http_connection::on_read(error_code const& e TORRENT_ASSERT(m_download_quota >= 0); } - if (e == asio::error::eof) + // when using the asio SSL wrapper, it seems like + // we get the shut_down error instead of EOF + if (e == asio::error::eof || e == asio::error::shut_down) { + error_code ec = asio::error::eof; TORRENT_ASSERT(bytes_transferred == 0); char const* data = 0; std::size_t size = 0; @@ -409,7 +412,7 @@ void http_connection::on_read(error_code const& e data = m_parser.get_body().begin; size = m_parser.get_body().left(); } - callback(e, data, size); + callback(ec, data, size); close(); return; } diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index 40e2c874a..633e0ab90 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -2375,10 +2375,6 @@ namespace libtorrent } #endif - // add the newly connected peer to this torrent's peer list - m_connections.insert(boost::get_pointer(c)); - m_ses.m_connections.insert(c); - #ifndef BOOST_NO_EXCEPTIONS try { -- cgit