diff --git a/doc/TESTING b/doc/TESTING index 7e28927..f570fe5 100644 --- a/doc/TESTING +++ b/doc/TESTING @@ -8,3 +8,12 @@ git checkout tor-improve autoreconf ./configure PKG_CONFIG_PATH=`pwd` make + + +To test from command line using curl +- ssh -ND 5001 localhost +- run the server on ports 5000->5001 +- run client on 4999->5000 +- curl --socks4 localhost:4999 http://1112.net/lastpage +- curl -x socks4://127.0.0.1:4999 http://download.thinkbroadband.com/1MB.zip -o /dev/null +- curl -x socks4://127.0.0.1:4999 http://download.thinkbroadband.com/1GB.zip -o /dev/null diff --git a/src/main.cc b/src/main.cc index 7f03620..30dfa24 100644 --- a/src/main.cc +++ b/src/main.cc @@ -364,6 +364,10 @@ main(int, const char *const *argv) if (!*begin || !config_is_supported(*begin)) usage(); + //crypto should be initialized before protocol so the protocols + //can use encryption + init_crypto(); + do { end = begin+1; while (*end && !config_is_supported(*end)) @@ -401,8 +405,6 @@ main(int, const char *const *argv) log_warn("failed to create pid-file '%s': %s", pf.pathname().c_str(), pf.errmsg()); - init_crypto(); - /* Ugly method to fix a Windows problem: http://archives.seul.org/libevent/users/Oct-2010/msg00049.html */ #ifdef _WIN32 diff --git a/src/protocol/chop.cc b/src/protocol/chop.cc index 98c3d02..e728b79 100644 --- a/src/protocol/chop.cc +++ b/src/protocol/chop.cc @@ -232,7 +232,7 @@ chop_config_t::chop_config_t() ignore_socks_destination = true; trace_packets = false; trace_packet_data = true; - encryption = false; + encryption = true; retransmit = true; noise2signal = 0; } @@ -775,13 +775,11 @@ chop_circuit_t::send_all_steg_data() return 0; } - //It makes sense to check if there is any steg data to be sent - //otherwise we can just return. - //Now we check if the protocol_data has any data - size_t avail = evbuffer_get_length(target->steg->cfg()->protocol_data_out); - if (avail == 0) - return 0; - + // you might think that it makes sense to check if there is any steg data to be sent + //otherwise we can just return. but we can't do that cause each connection has + //its own steg module and some of the steg module might have steg data and others might + //not + bool no_target_connection = true; //TODO: Instead of re-implementing pick connection here I should @@ -807,6 +805,8 @@ chop_circuit_t::send_all_steg_data() size_t avail0; + //Now we check if the protocol_data has any data + size_t avail = evbuffer_get_length(target->steg->cfg()->protocol_data_out); //we try to send all data //we don't send random block or retransmit from the transmit //queue because we are called by the this->send which will diff --git a/src/steg/apache_payload_server.cc b/src/steg/apache_payload_server.cc index 81f0e7c..52a9755 100644 --- a/src/steg/apache_payload_server.cc +++ b/src/steg/apache_payload_server.cc @@ -68,6 +68,11 @@ ApachePayloadServer::ApachePayloadServer(MachineSide init_side, const string& da while (payload_info_stream >> file_id) { PayloadInfo cur_payload_info; + if (_payload_database.payloads.find(cur_payload_info.url_hash) != _payload_database.payloads.end()) { + log_warn("duplicate url in the url list: %s", cur_payload_info.url.c_str()); + continue; + } + payload_info_stream >> cur_payload_info.type; payload_info_stream >> cur_payload_info.url_hash; payload_info_stream >> cur_payload_info.capacity; @@ -76,6 +81,7 @@ ApachePayloadServer::ApachePayloadServer(MachineSide init_side, const string& da payload_info_stream >> cur_payload_info.absolute_url_is_absolute; payload_info_stream >> cur_payload_info.absolute_url; + _payload_database.payloads.insert(pair(cur_payload_info.url_hash, cur_payload_info)); _payload_database.sorted_payloads.push_back(EfficiencyIndicator(cur_payload_info.url_hash, cur_payload_info.length));