2008-07-01 20:59:13 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 2008, Arvid Norberg
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in
|
|
|
|
the documentation and/or other materials provided with the distribution.
|
|
|
|
* Neither the name of the author nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived
|
|
|
|
from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-02-20 02:42:12 +01:00
|
|
|
#include "libtorrent/session.hpp"
|
|
|
|
#include "libtorrent/hasher.hpp"
|
|
|
|
#include "libtorrent/file_pool.hpp"
|
|
|
|
#include "libtorrent/storage.hpp"
|
2007-08-21 03:17:42 +02:00
|
|
|
#include "libtorrent/bencode.hpp"
|
2008-05-14 07:29:42 +02:00
|
|
|
#include "libtorrent/create_torrent.hpp"
|
2009-11-02 03:00:41 +01:00
|
|
|
#include "libtorrent/thread.hpp"
|
2013-08-19 05:54:45 +02:00
|
|
|
#include "libtorrent/alert_types.hpp"
|
2007-02-20 02:42:12 +01:00
|
|
|
#include <boost/tuple/tuple.hpp>
|
2007-08-21 03:17:42 +02:00
|
|
|
#include <fstream>
|
2009-12-15 14:11:07 +01:00
|
|
|
#include <iostream>
|
2007-02-20 02:42:12 +01:00
|
|
|
|
|
|
|
#include "test.hpp"
|
|
|
|
#include "setup_transfer.hpp"
|
|
|
|
|
|
|
|
using namespace libtorrent;
|
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
int peer_disconnects = 0;
|
|
|
|
|
|
|
|
bool on_alert(alert* a)
|
|
|
|
{
|
|
|
|
if (alert_cast<peer_disconnected_alert>(a))
|
|
|
|
++peer_disconnects;
|
|
|
|
else if (alert_cast<peer_error_alert>(a))
|
|
|
|
++peer_disconnects;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-11-28 01:16:14 +01:00
|
|
|
// proxy: 0=none, 1=socks4, 2=socks5, 3=socks5_pw 4=http 5=http_pw
|
2013-08-19 05:54:45 +02:00
|
|
|
void test_transfer(session& ses, boost::intrusive_ptr<torrent_info> torrent_file
|
2012-03-24 02:29:31 +01:00
|
|
|
, int proxy, int port, char const* protocol, bool url_seed, bool chunked_encoding, bool test_ban)
|
2007-02-20 02:42:12 +01:00
|
|
|
{
|
|
|
|
using namespace libtorrent;
|
2007-11-28 01:16:14 +01:00
|
|
|
|
2009-10-26 02:29:39 +01:00
|
|
|
error_code ec;
|
2012-03-17 20:06:11 +01:00
|
|
|
remove_all("tmp2_web_seed", ec);
|
2007-11-28 01:16:14 +01:00
|
|
|
|
|
|
|
char const* test_name[] = {"no", "SOCKS4", "SOCKS5", "SOCKS5 password", "HTTP", "HTTP password"};
|
|
|
|
|
2012-03-24 02:29:31 +01:00
|
|
|
fprintf(stderr, "\n\n ==== TESTING === proxy: %s ==== protocol: %s ==== seed: %s === transfer-encoding: %s === corruption: %s\n\n\n"
|
|
|
|
, test_name[proxy], protocol, url_seed ? "URL seed" : "HTTP seed", chunked_encoding ? "chunked": "none", test_ban ? "yes" : "no");
|
2013-08-19 05:54:45 +02:00
|
|
|
|
|
|
|
proxy_settings ps;
|
2007-02-20 02:42:12 +01:00
|
|
|
|
2007-11-28 01:16:14 +01:00
|
|
|
if (proxy)
|
|
|
|
{
|
2012-06-09 18:58:16 +02:00
|
|
|
ps.port = start_proxy(proxy);
|
2007-11-28 01:16:14 +01:00
|
|
|
ps.hostname = "127.0.0.1";
|
|
|
|
ps.username = "testuser";
|
|
|
|
ps.password = "testpass";
|
|
|
|
ps.type = (proxy_settings::proxy_type)proxy;
|
2010-08-23 08:27:18 +02:00
|
|
|
ses.set_proxy(ps);
|
2007-11-28 01:16:14 +01:00
|
|
|
}
|
|
|
|
|
2009-12-16 11:42:34 +01:00
|
|
|
add_torrent_params p;
|
2012-03-19 05:02:13 +01:00
|
|
|
p.flags &= ~add_torrent_params::flag_paused;
|
|
|
|
p.flags &= ~add_torrent_params::flag_auto_managed;
|
2009-12-16 11:42:34 +01:00
|
|
|
p.ti = torrent_file;
|
2012-03-17 20:06:11 +01:00
|
|
|
p.save_path = "tmp2_web_seed";
|
2013-02-16 09:26:55 +01:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2009-12-16 11:42:34 +01:00
|
|
|
p.storage_mode = storage_mode_compact;
|
2013-02-16 09:26:55 +01:00
|
|
|
#endif
|
2009-12-16 11:42:34 +01:00
|
|
|
torrent_handle th = ses.add_torrent(p, ec);
|
2007-11-28 01:16:14 +01:00
|
|
|
|
|
|
|
std::vector<announce_entry> empty;
|
|
|
|
th.replace_trackers(empty);
|
|
|
|
|
2008-06-03 17:17:09 +02:00
|
|
|
const size_type total_size = torrent_file->total_size();
|
|
|
|
|
|
|
|
float rate_sum = 0.f;
|
|
|
|
float ses_rate_sum = 0.f;
|
|
|
|
|
2009-06-15 00:48:07 +02:00
|
|
|
cache_status cs;
|
|
|
|
|
2011-11-26 21:48:31 +01:00
|
|
|
file_storage const& fs = torrent_file->files();
|
2012-03-15 08:16:30 +01:00
|
|
|
int pad_file_size = 0;
|
2011-11-26 21:48:31 +01:00
|
|
|
for (int i = 0; i < fs.num_files(); ++i)
|
|
|
|
{
|
|
|
|
file_entry f = fs.at(i);
|
|
|
|
if (f.pad_file) pad_file_size += f.size;
|
|
|
|
}
|
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
peer_disconnects = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 40; ++i)
|
2007-11-28 01:16:14 +01:00
|
|
|
{
|
|
|
|
torrent_status s = th.status();
|
2008-06-03 17:17:09 +02:00
|
|
|
session_status ss = ses.status();
|
2009-04-28 19:49:17 +02:00
|
|
|
rate_sum += s.download_payload_rate;
|
|
|
|
ses_rate_sum += ss.payload_download_rate;
|
2009-06-10 10:30:55 +02:00
|
|
|
|
2009-06-15 00:48:07 +02:00
|
|
|
cs = ses.get_cache_status();
|
2009-06-10 10:30:55 +02:00
|
|
|
if (cs.blocks_read < 1) cs.blocks_read = 1;
|
|
|
|
if (cs.blocks_written < 1) cs.blocks_written = 1;
|
2012-03-24 02:29:31 +01:00
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
print_ses_rate(i / 10.f, &s, NULL);
|
|
|
|
|
|
|
|
print_alerts(ses, " >> ses", test_ban, false, false, &on_alert);
|
|
|
|
|
|
|
|
if (test_ban && th.url_seeds().empty() && th.http_seeds().empty())
|
2012-03-24 02:29:31 +01:00
|
|
|
{
|
|
|
|
// when we don't have any web seeds left, we know we successfully banned it
|
|
|
|
break;
|
|
|
|
}
|
2007-11-28 01:16:14 +01:00
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
// if (test_ban && peer_disconnects >= 1) break;
|
|
|
|
|
2010-10-30 19:23:30 +02:00
|
|
|
if (s.is_seeding /* && ss.download_rate == 0.f*/)
|
2008-06-03 17:17:09 +02:00
|
|
|
{
|
2011-11-26 21:48:31 +01:00
|
|
|
TEST_EQUAL(s.total_payload_download - s.total_redundant_bytes, total_size - pad_file_size);
|
2009-12-29 18:49:24 +01:00
|
|
|
// we need to sleep here a bit to let the session sync with the torrent stats
|
2013-08-19 05:54:45 +02:00
|
|
|
// commented out because it takes such a long time
|
|
|
|
// test_sleep(1000);
|
|
|
|
// TEST_EQUAL(ses.status().total_payload_download - ses.status().total_redundant_bytes
|
|
|
|
// , total_size - pad_file_size);
|
2008-06-03 17:17:09 +02:00
|
|
|
break;
|
|
|
|
}
|
2013-08-19 05:54:45 +02:00
|
|
|
test_sleep(100);
|
2007-11-28 01:16:14 +01:00
|
|
|
}
|
|
|
|
|
2012-03-24 02:29:31 +01:00
|
|
|
// for test_ban tests, make sure we removed
|
|
|
|
// the url seed (i.e. banned it)
|
2013-08-19 05:54:45 +02:00
|
|
|
TEST_CHECK(!test_ban || (th.url_seeds().empty() && th.http_seeds().empty()));
|
2012-03-24 02:29:31 +01:00
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
TEST_EQUAL(cs.cache_size, 0);
|
|
|
|
TEST_EQUAL(cs.total_used_buffers, 0);
|
2009-06-15 00:48:07 +02:00
|
|
|
|
2008-06-03 17:17:09 +02:00
|
|
|
std::cerr << "total_size: " << total_size
|
|
|
|
<< " rate_sum: " << rate_sum
|
|
|
|
<< " session_rate_sum: " << ses_rate_sum
|
2009-12-25 17:00:15 +01:00
|
|
|
<< " session total download: " << ses.status().total_payload_download
|
|
|
|
<< " torrent total download: " << th.status().total_payload_download
|
2010-06-22 20:09:04 +02:00
|
|
|
<< " redundant: " << th.status().total_redundant_bytes
|
2008-06-03 17:17:09 +02:00
|
|
|
<< std::endl;
|
|
|
|
|
|
|
|
// the rates for each second should sum up to the total, with a 10% error margin
|
2009-12-25 17:00:15 +01:00
|
|
|
// TEST_CHECK(fabs(rate_sum - total_size) < total_size * .1f);
|
|
|
|
// TEST_CHECK(fabs(ses_rate_sum - total_size) < total_size * .1f);
|
2008-06-03 17:17:09 +02:00
|
|
|
|
2012-03-24 02:29:31 +01:00
|
|
|
// if test_ban is true, we're not supposed to have completed the download
|
|
|
|
// otherwise, we are supposed to have
|
|
|
|
TEST_CHECK(th.status().is_seeding == !test_ban);
|
2007-11-28 01:16:14 +01:00
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
if (proxy) stop_proxy(ps.port);
|
|
|
|
|
|
|
|
ses.remove_torrent(th);
|
|
|
|
|
|
|
|
// call this to synchronize with the network thread
|
|
|
|
ses.status();
|
|
|
|
|
|
|
|
print_alerts(ses, " >> ses", true, true, false, &on_alert, true);
|
2007-11-28 01:16:14 +01:00
|
|
|
|
2013-08-12 09:30:57 +02:00
|
|
|
TEST_CHECK(exists(combine_path("tmp2_web_seed", torrent_file->files().file_path(0))) || test_ban);
|
2012-03-17 20:06:11 +01:00
|
|
|
remove_all("tmp2_web_seed", ec);
|
2007-11-28 01:16:14 +01:00
|
|
|
}
|
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
void save_file(char const* filename, char const* data, int size)
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
file out(filename, file::write_only, ec);
|
|
|
|
TEST_CHECK(!ec);
|
|
|
|
if (ec)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "ERROR opening file '%s': %s\n", filename, ec.message().c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
file::iovec_t b = { (void*)data, size };
|
|
|
|
out.writev(0, &b, 1, ec);
|
|
|
|
TEST_CHECK(!ec);
|
|
|
|
if (ec)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "ERROR writing file '%s': %s\n", filename, ec.message().c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-18 02:46:15 +02:00
|
|
|
sha1_hash file_hash(std::string const& name)
|
|
|
|
{
|
|
|
|
std::vector<char> buf;
|
2011-01-19 11:07:51 +01:00
|
|
|
error_code ec;
|
|
|
|
load_file(name, buf, ec);
|
2010-10-18 02:46:15 +02:00
|
|
|
if (buf.empty()) return sha1_hash(0);
|
|
|
|
hasher h(&buf[0], buf.size());
|
|
|
|
return h.final();
|
|
|
|
}
|
|
|
|
|
2013-08-19 05:54:45 +02:00
|
|
|
const int num_pieces = 9;
|
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
// test_url_seed determines whether to use url-seed or http-seed
|
2012-03-24 02:29:31 +01:00
|
|
|
int run_suite(char const* protocol, bool test_url_seed, bool chunked_encoding, bool test_ban)
|
2007-11-28 01:16:14 +01:00
|
|
|
{
|
|
|
|
using namespace libtorrent;
|
|
|
|
|
2009-10-26 02:29:39 +01:00
|
|
|
error_code ec;
|
2012-03-17 20:06:11 +01:00
|
|
|
create_directories("tmp1_web_seed/test_torrent_dir", ec);
|
2008-11-02 01:26:13 +01:00
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
file_storage fs;
|
2010-10-18 02:46:15 +02:00
|
|
|
std::srand(10);
|
2011-11-26 21:48:31 +01:00
|
|
|
int piece_size = 0x4000;
|
2012-03-24 02:29:31 +01:00
|
|
|
static const int file_sizes[] =
|
|
|
|
{ 5, 16 - 5, 16000, 17, 10, 8000, 8000, 1,1,1,1,1,100,1,1,1,1,100,1,1,1,1,1,1
|
|
|
|
,1,1,1,1,1,1,13,65000,34,75,2,30,400,500,23000,900,43000,400,4300,6, 4};
|
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
if (test_url_seed)
|
2010-06-22 20:09:04 +02:00
|
|
|
{
|
2013-01-06 05:53:26 +01:00
|
|
|
create_random_files("tmp1_web_seed/test_torrent_dir", file_sizes, sizeof(file_sizes)/sizeof(file_sizes[0]));
|
2012-03-17 20:06:11 +01:00
|
|
|
add_files(fs, "tmp1_web_seed/test_torrent_dir");
|
2010-10-17 18:15:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-30 21:45:50 +02:00
|
|
|
piece_size = 64 * 1024;
|
2013-08-19 05:54:45 +02:00
|
|
|
char* random_data = (char*)malloc(64 * 1024 * num_pieces);
|
|
|
|
std::generate(random_data, random_data + 64 * 1024 * num_pieces, &std::rand);
|
|
|
|
save_file("tmp1_web_seed/seed", random_data, 64 * 1024 * num_pieces);
|
|
|
|
fs.add_file("seed", 64 * 1024 * num_pieces);
|
2010-11-08 09:50:30 +01:00
|
|
|
free(random_data);
|
2010-10-17 18:15:32 +02:00
|
|
|
}
|
2008-05-28 10:44:40 +02:00
|
|
|
|
2010-10-27 08:39:18 +02:00
|
|
|
int port = start_web_server(strcmp(protocol, "https") == 0, chunked_encoding);
|
2007-02-20 02:42:12 +01:00
|
|
|
|
2011-11-26 21:48:31 +01:00
|
|
|
// generate a torrent with pad files to make sure they
|
|
|
|
// are not requested web seeds
|
|
|
|
libtorrent::create_torrent t(fs, piece_size, 0x4000, libtorrent::create_torrent::optimize
|
|
|
|
| libtorrent::create_torrent::calculate_file_hashes);
|
2012-03-24 02:29:31 +01:00
|
|
|
|
2010-01-24 00:57:11 +01:00
|
|
|
char tmp[512];
|
2010-10-17 18:15:32 +02:00
|
|
|
if (test_url_seed)
|
|
|
|
{
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s://127.0.0.1:%d/tmp1_web_seed", protocol, port);
|
|
|
|
t.add_url_seed(tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-09-10 07:36:38 +02:00
|
|
|
snprintf(tmp, sizeof(tmp), "%s://127.0.0.1:%d/seed", protocol, port);
|
2010-10-17 18:15:32 +02:00
|
|
|
t.add_http_seed(tmp);
|
|
|
|
}
|
2011-09-10 07:36:38 +02:00
|
|
|
fprintf(stderr, "testing: %s\n", tmp);
|
|
|
|
|
2011-11-26 21:48:31 +01:00
|
|
|
for (int i = 0; i < fs.num_files(); ++i)
|
|
|
|
{
|
|
|
|
file_entry f = fs.at(i);
|
|
|
|
fprintf(stderr, " %04x: %d %s\n", int(f.offset), f.pad_file, f.path.c_str());
|
|
|
|
}
|
|
|
|
|
2008-05-14 07:29:42 +02:00
|
|
|
// calculate the hash for all pieces
|
2012-03-17 20:06:11 +01:00
|
|
|
set_piece_hashes(t, "tmp1_web_seed", ec);
|
2010-10-17 18:15:32 +02:00
|
|
|
|
|
|
|
if (ec)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "error creating hashes for test torrent: %s\n"
|
|
|
|
, ec.message().c_str());
|
|
|
|
TEST_CHECK(false);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-24 02:29:31 +01:00
|
|
|
if (test_ban)
|
|
|
|
{
|
|
|
|
// corrupt the files now, so that the web seed will be banned
|
|
|
|
if (test_url_seed)
|
|
|
|
{
|
2013-01-06 05:53:26 +01:00
|
|
|
create_random_files("tmp1_web_seed/test_torrent_dir", file_sizes, sizeof(file_sizes)/sizeof(file_sizes[0]));
|
2012-03-24 02:29:31 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
piece_size = 64 * 1024;
|
2013-08-19 05:54:45 +02:00
|
|
|
char* random_data = (char*)malloc(64 * 1024 * num_pieces);
|
|
|
|
std::generate(random_data, random_data + 64 * 1024 * num_pieces, &std::rand);
|
|
|
|
save_file("tmp1_web_seed/seed", random_data, 64 * 1024 * num_pieces);
|
2012-03-24 02:29:31 +01:00
|
|
|
free(random_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-05 07:27:23 +01:00
|
|
|
std::vector<char> buf;
|
|
|
|
bencode(std::back_inserter(buf), t.generate());
|
|
|
|
boost::intrusive_ptr<torrent_info> torrent_file(new torrent_info(&buf[0], buf.size(), ec));
|
2007-02-20 02:42:12 +01:00
|
|
|
|
2012-03-24 02:29:31 +01:00
|
|
|
// no point in testing the hashes since we know the data is corrupt
|
|
|
|
if (!test_ban)
|
2010-10-18 02:46:15 +02:00
|
|
|
{
|
2012-03-24 02:29:31 +01:00
|
|
|
// verify that the file hashes are correct
|
|
|
|
for (int i = 0; i < torrent_file->num_files(); ++i)
|
|
|
|
{
|
|
|
|
sha1_hash h1 = torrent_file->file_at(i).filehash;
|
|
|
|
sha1_hash h2 = file_hash(combine_path("tmp1_web_seed"
|
|
|
|
, torrent_file->file_at(i).path));
|
|
|
|
// fprintf(stderr, "%s: %s == %s\n"
|
|
|
|
// , torrent_file->file_at(i).path.c_str()
|
|
|
|
// , to_hex(h1.to_string()).c_str(), to_hex(h2.to_string()).c_str());
|
|
|
|
TEST_EQUAL(h1, h2);
|
|
|
|
}
|
2010-10-18 02:46:15 +02:00
|
|
|
}
|
|
|
|
|
2010-10-17 18:15:32 +02:00
|
|
|
{
|
2013-08-19 05:54:45 +02:00
|
|
|
session ses(fingerprint(" ", 0,0,0,0), 0);
|
|
|
|
session_settings settings;
|
|
|
|
settings.max_queued_disk_bytes = 256 * 1024;
|
|
|
|
ses.set_settings(settings);
|
|
|
|
ses.set_alert_mask(~(alert::progress_notification | alert::stats_notification));
|
|
|
|
error_code ec;
|
|
|
|
ses.listen_on(std::make_pair(51000, 52000), ec);
|
|
|
|
if (ec) fprintf(stderr, "listen_on failed: %s\n", ec.message().c_str());
|
|
|
|
|
|
|
|
for (int i = 0; i < 6; ++i)
|
|
|
|
test_transfer(ses, torrent_file, i, port, protocol, test_url_seed, chunked_encoding, test_ban);
|
|
|
|
|
|
|
|
if (test_url_seed)
|
|
|
|
{
|
|
|
|
torrent_file->rename_file(0, "tmp2_web_seed/test_torrent_dir/renamed_test1");
|
|
|
|
test_transfer(ses, torrent_file, 0, port, protocol, test_url_seed, chunked_encoding, test_ban);
|
|
|
|
}
|
2010-10-17 18:15:32 +02:00
|
|
|
}
|
2008-12-24 21:07:34 +01:00
|
|
|
|
2010-01-24 00:57:11 +01:00
|
|
|
stop_web_server();
|
2012-03-17 20:06:11 +01:00
|
|
|
remove_all("tmp1_web_seed", ec);
|
2007-02-20 02:42:12 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-10-12 10:57:43 +02:00
|
|
|
int test_main()
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2012-03-24 02:29:31 +01:00
|
|
|
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
2010-10-17 18:15:32 +02:00
|
|
|
{
|
2012-03-24 02:29:31 +01:00
|
|
|
for (int chunked = 0; chunked < 2; ++chunked)
|
2010-10-27 08:39:18 +02:00
|
|
|
{
|
2012-03-24 02:29:31 +01:00
|
|
|
for (int ban = 0; ban < 2; ++ban)
|
|
|
|
{
|
2010-10-12 10:57:43 +02:00
|
|
|
#ifdef TORRENT_USE_OPENSSL
|
2012-03-24 02:29:31 +01:00
|
|
|
run_suite("https", url_seed, chunked, ban);
|
2010-10-12 10:57:43 +02:00
|
|
|
#endif
|
2012-03-24 02:29:31 +01:00
|
|
|
run_suite("http", url_seed, chunked, ban);
|
|
|
|
}
|
2010-10-27 08:39:18 +02:00
|
|
|
}
|
2010-10-17 18:15:32 +02:00
|
|
|
}
|
2010-10-12 10:57:43 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|