aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_plugin_transport_http.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-07-29 15:25:35 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-07-29 15:25:35 +0000
commit336c2abe4e816bbace409e4503f87e38fb1cac40 (patch)
tree9df2aa4cf53ea4c765d29cd96a6e6f5ed6b0471f /src/transport/test_plugin_transport_http.c
parent04fb060f467b9eece66f3624b4fd966a9f12e21c (diff)
downloadgnunet-336c2abe4e816bbace409e4503f87e38fb1cac40.tar.gz
gnunet-336c2abe4e816bbace409e4503f87e38fb1cac40.zip
changed debug output
Diffstat (limited to 'src/transport/test_plugin_transport_http.c')
-rw-r--r--src/transport/test_plugin_transport_http.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c
index d3c0684ef..855dc5350 100644
--- a/src/transport/test_plugin_transport_http.c
+++ b/src/transport/test_plugin_transport_http.c
@@ -45,10 +45,11 @@
45#include <arpa/inet.h> 45#include <arpa/inet.h>
46 46
47#define VERBOSE GNUNET_NO 47#define VERBOSE GNUNET_NO
48#define DEBUG GNUNET_NO
49#define DEBUG_CURL GNUNET_NO 48#define DEBUG_CURL GNUNET_NO
50#define HTTP_BUFFER_SIZE 2048 49#define HTTP_BUFFER_SIZE 2048
51 50
51#define PROTOCOL_PREFIX "http"
52
52#define PLUGIN libgnunet_plugin_transport_template 53#define PLUGIN libgnunet_plugin_transport_template
53 54
54/** 55/**
@@ -396,22 +397,22 @@ shutdown_clean ()
396 fail = 0; 397 fail = 0;
397 if ((fail_notify_address == GNUNET_YES) || (fail_pretty_printer == GNUNET_YES) || (fail_addr_to_str == GNUNET_YES)) 398 if ((fail_notify_address == GNUNET_YES) || (fail_pretty_printer == GNUNET_YES) || (fail_addr_to_str == GNUNET_YES))
398 { 399 {
399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 0: Test plugin functions failed\n"); 400 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Phase 0: Test plugin functions failed\n");
400 fail = 1; 401 fail = 1;
401 } 402 }
402 if ((test_no_ident.test_failed == GNUNET_YES) || (test_too_short_ident.test_failed == GNUNET_YES) || (test_too_long_ident.test_failed == GNUNET_YES) || (test_valid_ident.test_failed == GNUNET_YES)) 403 if ((test_no_ident.test_failed == GNUNET_YES) || (test_too_short_ident.test_failed == GNUNET_YES) || (test_too_long_ident.test_failed == GNUNET_YES) || (test_valid_ident.test_failed == GNUNET_YES))
403 { 404 {
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 1: Test connect with wrong data failed\n"); 405 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Phase 1: Test connect with wrong data failed\n");
405 fail = 1; 406 fail = 1;
406 } 407 }
407 if ((fail_session_selection_any != GNUNET_NO) || (fail_session_selection_reliable != GNUNET_NO) || (fail_session_selection_session != GNUNET_NO) || (fail_session_selection_session_big != GNUNET_NO)) 408 if ((fail_session_selection_any != GNUNET_NO) || (fail_session_selection_reliable != GNUNET_NO) || (fail_session_selection_session != GNUNET_NO) || (fail_session_selection_session_big != GNUNET_NO))
408 { 409 {
409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 2: Test session selection failed\n"); 410 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Phase 2: Test session selection failed\n");
410 fail = 1; 411 fail = 1;
411 } 412 }
412 if ((fail_msgs_transmited_to_local_addrs != count_str_addr) || (fail_multiple_msgs_in_transmission != 2) || (fail_msg_transmited_max_size == GNUNET_YES)) 413 if ((fail_msgs_transmited_to_local_addrs != count_str_addr) || (fail_multiple_msgs_in_transmission != 2) || (fail_msg_transmited_max_size == GNUNET_YES))
413 { 414 {
414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 3: Test sending with plugin failed\n"); 415 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Phase 3: Test sending with plugin failed\n");
415 fail = 1; 416 fail = 1;
416 } 417 }
417 if (fail != 1) 418 if (fail != 1)
@@ -676,41 +677,41 @@ static void send_execute (void *cls,
676 { 677 {
677 if ((res->http_result_code==404) && (buffer_in.len==208)) 678 if ((res->http_result_code==404) && (buffer_in.len==208))
678 { 679 {
679 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer without any peer identification: test passed\n")); 680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to peer without any peer identification: test passed\n");
680 res->test_failed = GNUNET_NO; 681 res->test_failed = GNUNET_NO;
681 } 682 }
682 else 683 else
683 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer without any peer identification: test failed\n")); 684 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Connecting to peer without any peer identification: test failed\n"));
684 } 685 }
685 if (res == &test_too_short_ident) 686 if (res == &test_too_short_ident)
686 { 687 {
687 if ((res->http_result_code==404) && (buffer_in.len==208)) 688 if ((res->http_result_code==404) && (buffer_in.len==208))
688 { 689 {
689 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too short peer identification: test passed\n")); 690 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to peer with too short peer identification: test passed\n");
690 res->test_failed = GNUNET_NO; 691 res->test_failed = GNUNET_NO;
691 } 692 }
692 else 693 else
693 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too short peer identification: test failed\n")); 694 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Connecting to peer with too short peer identification: test failed\n"));
694 } 695 }
695 if (res == &test_too_long_ident) 696 if (res == &test_too_long_ident)
696 { 697 {
697 if ((res->http_result_code==404) && (buffer_in.len==208)) 698 if ((res->http_result_code==404) && (buffer_in.len==208))
698 { 699 {
699 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too long peer identification: test passed\n")); 700 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to peer with too long peer identification: test passed\n");
700 res->test_failed = GNUNET_NO; 701 res->test_failed = GNUNET_NO;
701 } 702 }
702 else 703 else
703 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too long peer identification: test failed\n")); 704 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Connecting to peer with too long peer identification: test failed\n"));
704 } 705 }
705 if (res == &test_valid_ident) 706 if (res == &test_valid_ident)
706 { 707 {
707 if ((res->http_result_code==200)) 708 if ((res->http_result_code==200))
708 { 709 {
709 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification: test passed\n")); 710 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to peer with valid peer identification: test passed\n");
710 res->test_failed = GNUNET_NO; 711 res->test_failed = GNUNET_NO;
711 } 712 }
712 else 713 else
713 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification: test failed\n")); 714 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connecting to peer with valid peer identification: test failed\n");
714 } 715 }
715 curl_easy_cleanup(curl_handle); 716 curl_easy_cleanup(curl_handle);
716 curl_handle=NULL; 717 curl_handle=NULL;
@@ -960,8 +961,8 @@ static void run_connection_tests( int phase , void * cls)
960 { 961 {
961 /* Connecting to peer without identification */ 962 /* Connecting to peer without identification */
962 char * ident = ""; 963 char * ident = "";
963 GNUNET_asprintf (&host_str, "http://%s/%s",test_addr,ident); 964 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
964 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer without any peer identification.\n")); 965 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting to peer without any peer identification.\n"));
965 test_no_ident.test_executed = GNUNET_YES; 966 test_no_ident.test_executed = GNUNET_YES;
966 send_data ( &test_no_ident, host_str); 967 send_data ( &test_no_ident, host_str);
967 GNUNET_free (host_str); 968 GNUNET_free (host_str);
@@ -971,8 +972,8 @@ static void run_connection_tests( int phase , void * cls)
971 { 972 {
972 char * ident = "AAAAAAAAAA"; 973 char * ident = "AAAAAAAAAA";
973 /* Connecting to peer with too short identification */ 974 /* Connecting to peer with too short identification */
974 GNUNET_asprintf (&host_str, "http://%s/%s",test_addr,ident); 975 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX,test_addr,ident);
975 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too short peer identification.\n")); 976 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting to peer with too short peer identification.\n"));
976 test_too_short_ident.test_executed = GNUNET_YES; 977 test_too_short_ident.test_executed = GNUNET_YES;
977 send_data ( &test_too_short_ident, host_str); 978 send_data ( &test_too_short_ident, host_str);
978 GNUNET_free (host_str); 979 GNUNET_free (host_str);
@@ -984,8 +985,8 @@ static void run_connection_tests( int phase , void * cls)
984 char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; 985 char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
985 986
986 /* Connecting to peer with too long identification */ 987 /* Connecting to peer with too long identification */
987 GNUNET_asprintf (&host_str, "http://%s/%s",test_addr,ident); 988 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
988 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too long peer identification.\n")); 989 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting to peer with too long peer identification.\n"));
989 test_too_long_ident.test_executed = GNUNET_YES; 990 test_too_long_ident.test_executed = GNUNET_YES;
990 send_data ( &test_too_long_ident, host_str); 991 send_data ( &test_too_long_ident, host_str);
991 GNUNET_free (host_str); 992 GNUNET_free (host_str);
@@ -995,8 +996,8 @@ static void run_connection_tests( int phase , void * cls)
995 { 996 {
996 struct GNUNET_CRYPTO_HashAsciiEncoded ident; 997 struct GNUNET_CRYPTO_HashAsciiEncoded ident;
997 GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident); 998 GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
998 GNUNET_asprintf (&host_str, "http://%s/%s%s",test_addr,(char *) &ident,";0"); 999 GNUNET_asprintf (&host_str, "%s://%s/%s%s",PROTOCOL_PREFIX, test_addr,(char *) &ident,";0");
999 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification.\n")); 1000 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting to peer with valid peer identification.\n"));
1000 test_valid_ident.test_executed = GNUNET_YES; 1001 test_valid_ident.test_executed = GNUNET_YES;
1001 send_data ( &test_valid_ident, host_str); 1002 send_data ( &test_valid_ident, host_str);
1002 GNUNET_free (host_str); 1003 GNUNET_free (host_str);
@@ -1005,7 +1006,7 @@ static void run_connection_tests( int phase , void * cls)
1005 } 1006 }
1006 if (phase==1) 1007 if (phase==1)
1007 { 1008 {
1008 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("\nPhase 1: transmit data to all suggested addresses\n\n")); 1009 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\nPhase 1: transmit data to all suggested addresses\n\n");
1009 /* Using one of the addresses the plugin proposed */ 1010 /* Using one of the addresses the plugin proposed */
1010 GNUNET_assert (addr_head->addr != NULL); 1011 GNUNET_assert (addr_head->addr != NULL);
1011 1012
@@ -1052,7 +1053,7 @@ static void run_connection_tests( int phase , void * cls)
1052 struct Session * session = cls; 1053 struct Session * session = cls;
1053 msg = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader)); 1054 msg = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader));
1054 1055
1055 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("\nPhase 2: session selection\n\n")); 1056 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 2: session selection\n\n");
1056 size = sizeof(struct GNUNET_MessageHeader); 1057 size = sizeof(struct GNUNET_MessageHeader);
1057 msg->size=htons(size); 1058 msg->size=htons(size);
1058 msg->type = htons(20); 1059 msg->type = htons(20);
@@ -1082,12 +1083,12 @@ static void run_connection_tests( int phase , void * cls)
1082 if (phase==3) 1083 if (phase==3)
1083 { 1084 {
1084 1085
1085 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("\nPhase 3: send multiple or big messages after disconnect\n\n")); 1086 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 3: send multiple or big messages after disconnect\n\n");
1086 /* disconnect from peer, so new connections are created */ 1087 /* disconnect from peer, so new connections are created */
1087 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Disconnect from peer: `%s'\n", GNUNET_i2s(&my_identity)); 1088 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Disconnect from peer: `%s'\n", GNUNET_i2s(&my_identity));
1088 api->disconnect(api->cls, &my_identity); 1089 api->disconnect(api->cls, &my_identity);
1089 1090
1090 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Phase 3: sending messages\n")); 1091 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Phase 3: sending messages\n");
1091 /* send a multiple GNUNET_messages at a time*/ 1092 /* send a multiple GNUNET_messages at a time*/
1092 size = 2 * sizeof(struct GNUNET_MessageHeader); 1093 size = 2 * sizeof(struct GNUNET_MessageHeader);
1093 msg = GNUNET_malloc( 2* size); 1094 msg = GNUNET_malloc( 2* size);
@@ -1160,8 +1161,7 @@ run (void *cls,
1160 "HOSTKEY", &keyfile))) 1161 "HOSTKEY", &keyfile)))
1161 { 1162 {
1162 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1163 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1163 _ 1164 _("Transport service is lacking key configuration settings. Exiting.\n"));
1164 ("Transport service is lacking key configuration settings. Exiting.\n"));
1165 GNUNET_SCHEDULER_shutdown (s); 1165 GNUNET_SCHEDULER_shutdown (s);
1166 fail = 1; 1166 fail = 1;
1167 return; 1167 return;
@@ -1219,7 +1219,7 @@ run (void *cls,
1219 1219
1220 /* testing plugin functionality */ 1220 /* testing plugin functionality */
1221 GNUNET_assert (0!=fail_notify_address_count); 1221 GNUNET_assert (0!=fail_notify_address_count);
1222 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Transport plugin returned %u addresses to connect to\n"), fail_notify_address_count); 1222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport plugin returned %u addresses to connect to\n", fail_notify_address_count);
1223 1223
1224 /* testing pretty printer with all addresses obtained from the plugin*/ 1224 /* testing pretty printer with all addresses obtained from the plugin*/
1225 cur = addr_head; 1225 cur = addr_head;
@@ -1293,7 +1293,7 @@ run (void *cls,
1293 1293
1294 test_addr = (char *) api->address_to_string (api->cls,addr_head->addr,addr_head->addrlen); 1294 test_addr = (char *) api->address_to_string (api->cls,addr_head->addr,addr_head->addrlen);
1295 1295
1296 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("\nPhase 0\n\n")); 1296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Phase 0\n\n"));
1297 run_connection_tests(0, NULL); 1297 run_connection_tests(0, NULL);
1298 1298
1299 /* testing finished */ 1299 /* testing finished */