aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-07-29 15:39:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-07-29 15:39:01 +0000
commitfe89565ba923f9ef70b6715196bcbf8b34f5f260 (patch)
treedb66dbbc6fd7ec74860fb86c46395b13e52a7ae0 /src
parent336c2abe4e816bbace409e4503f87e38fb1cac40 (diff)
downloadgnunet-fe89565ba923f9ef70b6715196bcbf8b34f5f260.tar.gz
gnunet-fe89565ba923f9ef70b6715196bcbf8b34f5f260.zip
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http.c6
-rw-r--r--src/transport/plugin_transport_https.c6
-rw-r--r--src/transport/test_plugin_transport_http.c2
-rw-r--r--src/transport/test_plugin_transport_https.c37
4 files changed, 28 insertions, 23 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 99b6053cf..9893cd27c 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -48,6 +48,8 @@
48#define INBOUND GNUNET_NO 48#define INBOUND GNUNET_NO
49#define OUTBOUND GNUNET_YES 49#define OUTBOUND GNUNET_YES
50 50
51#define PROTOCOL_PREFIX "http"
52
51/** 53/**
52 * Text of the response sent back after the last bytes of a PUT 54 * Text of the response sent back after the last bytes of a PUT
53 * request have been received (just to formally obey the HTTP 55 * request have been received (just to formally obey the HTTP
@@ -418,7 +420,7 @@ static char * create_url(void * cls, const void * addr, size_t addrlen, size_t i
418 420
419 GNUNET_assert ((addr!=NULL) && (addrlen != 0)); 421 GNUNET_assert ((addr!=NULL) && (addrlen != 0));
420 GNUNET_asprintf(&url, 422 GNUNET_asprintf(&url,
421 "http://%s/%s;%u", 423 "%s://%s/%s;%u", PROTOCOL_PREFIX,
422 http_plugin_address_to_string(NULL, addr, addrlen), 424 http_plugin_address_to_string(NULL, addr, addrlen),
423 (char *) (&plugin->my_ascii_hash_ident),id); 425 (char *) (&plugin->my_ascii_hash_ident),id);
424 426
@@ -2116,7 +2118,7 @@ http_plugin_address_pretty_printer (void *cls,
2116 asc (asc_cls, NULL); 2118 asc (asc_cls, NULL);
2117 return; 2119 return;
2118 } 2120 }
2119 res = GNUNET_asprintf(&ret,"http://%s:%u/",address,port); 2121 res = GNUNET_asprintf(&ret,"%s://%s:%u/", PROTOCOL_PREFIX, address, port);
2120 GNUNET_free (address); 2122 GNUNET_free (address);
2121 GNUNET_assert(res != 0); 2123 GNUNET_assert(res != 0);
2122 asc (asc_cls, ret); 2124 asc (asc_cls, ret);
diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c
index b37cd4970..7017b41b3 100644
--- a/src/transport/plugin_transport_https.c
+++ b/src/transport/plugin_transport_https.c
@@ -49,6 +49,8 @@
49#define INBOUND GNUNET_NO 49#define INBOUND GNUNET_NO
50#define OUTBOUND GNUNET_YES 50#define OUTBOUND GNUNET_YES
51 51
52#define PROTOCOL_PREFIX "https"
53
52/** 54/**
53 * Text of the response sent back after the last bytes of a PUT 55 * Text of the response sent back after the last bytes of a PUT
54 * request have been received (just to formally obey the HTTP 56 * request have been received (just to formally obey the HTTP
@@ -424,7 +426,7 @@ static char * create_url(void * cls, const void * addr, size_t addrlen, size_t i
424 426
425 GNUNET_assert ((addr!=NULL) && (addrlen != 0)); 427 GNUNET_assert ((addr!=NULL) && (addrlen != 0));
426 GNUNET_asprintf(&url, 428 GNUNET_asprintf(&url,
427 "https://%s/%s;%u", 429 "%s://%s/%s;%u", PROTOCOL_PREFIX,
428 http_plugin_address_to_string(NULL, addr, addrlen), 430 http_plugin_address_to_string(NULL, addr, addrlen),
429 (char *) (&plugin->my_ascii_hash_ident),id); 431 (char *) (&plugin->my_ascii_hash_ident),id);
430 432
@@ -2133,7 +2135,7 @@ http_plugin_address_pretty_printer (void *cls,
2133 asc (asc_cls, NULL); 2135 asc (asc_cls, NULL);
2134 return; 2136 return;
2135 } 2137 }
2136 res = GNUNET_asprintf(&ret,"https://%s:%u/",address,port); 2138 res = GNUNET_asprintf(&ret,"%s://%s:%u/", PROTOCOL_PREFIX, address,port);
2137 GNUNET_free (address); 2139 GNUNET_free (address);
2138 GNUNET_assert(res != 0); 2140 GNUNET_assert(res != 0);
2139 asc (asc_cls, ret); 2141 asc (asc_cls, ret);
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c
index 855dc5350..c192dc08f 100644
--- a/src/transport/test_plugin_transport_http.c
+++ b/src/transport/test_plugin_transport_http.c
@@ -55,7 +55,7 @@
55/** 55/**
56 * How long until we give up on transmitting the message? 56 * How long until we give up on transmitting the message?
57 */ 57 */
58#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90) 58#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
59 59
60/** 60/**
61 * Testcase timeout 61 * Testcase timeout
diff --git a/src/transport/test_plugin_transport_https.c b/src/transport/test_plugin_transport_https.c
index 0e35bfc34..58817005a 100644
--- a/src/transport/test_plugin_transport_https.c
+++ b/src/transport/test_plugin_transport_https.c
@@ -45,16 +45,17 @@
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
52#define PLUGIN libgnunet_plugin_transport_template 51#define PLUGIN libgnunet_plugin_transport_template
53 52
53#define PROTOCOL_PREFIX "https"
54
54/** 55/**
55 * How long until we give up on transmitting the message? 56 * How long until we give up on transmitting the message?
56 */ 57 */
57#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90) 58#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
58 59
59/** 60/**
60 * Testcase timeout 61 * Testcase timeout
@@ -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_INFO, "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_INFO, "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_INFO, "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_INFO, "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;
@@ -963,7 +964,7 @@ static void run_connection_tests( int phase , void * cls)
963 { 964 {
964 /* Connecting to peer without identification */ 965 /* Connecting to peer without identification */
965 char * ident = ""; 966 char * ident = "";
966 GNUNET_asprintf (&host_str, "https://%s/%s",test_addr,ident); 967 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
967 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer without any peer identification.\n")); 968 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer without any peer identification.\n"));
968 test_no_ident.test_executed = GNUNET_YES; 969 test_no_ident.test_executed = GNUNET_YES;
969 send_data ( &test_no_ident, host_str); 970 send_data ( &test_no_ident, host_str);
@@ -974,7 +975,7 @@ static void run_connection_tests( int phase , void * cls)
974 { 975 {
975 char * ident = "AAAAAAAAAA"; 976 char * ident = "AAAAAAAAAA";
976 /* Connecting to peer with too short identification */ 977 /* Connecting to peer with too short identification */
977 GNUNET_asprintf (&host_str, "https://%s/%s",test_addr,ident); 978 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
978 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too short peer identification.\n")); 979 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too short peer identification.\n"));
979 test_too_short_ident.test_executed = GNUNET_YES; 980 test_too_short_ident.test_executed = GNUNET_YES;
980 send_data ( &test_too_short_ident, host_str); 981 send_data ( &test_too_short_ident, host_str);
@@ -987,7 +988,7 @@ static void run_connection_tests( int phase , void * cls)
987 char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; 988 char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
988 989
989 /* Connecting to peer with too long identification */ 990 /* Connecting to peer with too long identification */
990 GNUNET_asprintf (&host_str, "https://%s/%s",test_addr,ident); 991 GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
991 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too long peer identification.\n")); 992 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with too long peer identification.\n"));
992 test_too_long_ident.test_executed = GNUNET_YES; 993 test_too_long_ident.test_executed = GNUNET_YES;
993 send_data ( &test_too_long_ident, host_str); 994 send_data ( &test_too_long_ident, host_str);
@@ -998,7 +999,7 @@ static void run_connection_tests( int phase , void * cls)
998 { 999 {
999 struct GNUNET_CRYPTO_HashAsciiEncoded ident; 1000 struct GNUNET_CRYPTO_HashAsciiEncoded ident;
1000 GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident); 1001 GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
1001 GNUNET_asprintf (&host_str, "https://%s/%s%s",test_addr,(char *) &ident,";0"); 1002 GNUNET_asprintf (&host_str, "%s://%s/%s%s",PROTOCOL_PREFIX, test_addr,(char *) &ident,";0");
1002 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification.\n")); 1003 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connecting to peer with valid peer identification.\n"));
1003 test_valid_ident.test_executed = GNUNET_YES; 1004 test_valid_ident.test_executed = GNUNET_YES;
1004 send_data ( &test_valid_ident, host_str); 1005 send_data ( &test_valid_ident, host_str);