fixed bug in url encoder and in client test

This commit is contained in:
Arvid Norberg 2010-03-29 00:31:30 +00:00
parent e22c6cdf62
commit 9977480f02
4 changed files with 14 additions and 7 deletions

View File

@ -24,6 +24,8 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed bug in url encoder where $ would not be encoded
0.15 release
* introduced a session state save mechanism. load_state() and save_state().

View File

@ -559,6 +559,11 @@ void add_torrent(libtorrent::session& ses
p.duplicate_is_error = false;
p.auto_managed = true;
torrent_handle h = ses.add_torrent(p, ec);
if (ec)
{
fprintf(stderr, "failed to add torrent: %s\n", ec.message().c_str());
return;
}
handles.insert(std::pair<const std::string, torrent_handle>(
monitored_dir?std::string(torrent):std::string(), h));
@ -839,7 +844,7 @@ int main(int argc, char* argv[])
// interpret this as a torrent
// first see if this is a torrentless download
if (std::strstr("magnet:", argv[i]) == argv[i])
if (std::strstr(argv[i], "magnet:") == argv[i])
{
add_torrent_params p;
p.save_path = save_path;
@ -883,7 +888,7 @@ int main(int argc, char* argv[])
torrent_handle h = ses.add_torrent(p, ec);
if (ec)
{
fprintf(stderr, "%s\n", ec.message().c_str());
fprintf(stderr, "failed to add torrent: %s\n", ec.message().c_str());
continue;
}

View File

@ -136,7 +136,7 @@ namespace libtorrent
int piece_size(int index) const;
void set_name(std::string const& n) { m_name = n; }
const std::string& name() const { TORRENT_ASSERT(m_piece_length > 0); return m_name; }
const std::string& name() const { return m_name; }
void swap(file_storage& ti)
{

View File

@ -212,10 +212,10 @@ namespace libtorrent
// % should be ok
"%+"
// reserved
";?:@=&/"
";?:@=&,$/"
// unreserved (special characters) ' excluded,
// since some buggy trackers fail with those
"$-_.!~*(),"
"-_!.~*()"
// unreserved (alphanumerics)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
"0123456789";
@ -250,12 +250,12 @@ namespace libtorrent
std::string escape_string(const char* str, int len)
{
return escape_string_impl(str, len, 9);
return escape_string_impl(str, len, 11);
}
std::string escape_path(const char* str, int len)
{
return escape_string_impl(str, len, 8);
return escape_string_impl(str, len, 10);
}
bool need_encoding(char const* str, int len)