aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_plugin_transport_http.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-05-31 16:03:43 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-05-31 16:03:43 +0000
commit634d9504f07f6dec17bab76375e60c1a30ab12eb (patch)
tree3544480a7698aad467319166035e3fc42caa7b04 /src/transport/test_plugin_transport_http.c
parenteccba40f860a0b216814bbfca0f03c532f610b71 (diff)
downloadgnunet-634d9504f07f6dec17bab76375e60c1a30ab12eb.tar.gz
gnunet-634d9504f07f6dec17bab76375e60c1a30ab12eb.zip
Diffstat (limited to 'src/transport/test_plugin_transport_http.c')
-rw-r--r--src/transport/test_plugin_transport_http.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c
index 728ab7db3..9eb952348 100644
--- a/src/transport/test_plugin_transport_http.c
+++ b/src/transport/test_plugin_transport_http.c
@@ -394,7 +394,7 @@ static void pretty_printer_cb (void *cls,
394{ 394{
395 if (NULL==address) 395 if (NULL==address)
396 return; 396 return;
397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Plugin returned: `%s'\n",address); 397 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Plugin returnedp pretty address: `%s'\n",address);
398 fail_pretty_printer_count++; 398 fail_pretty_printer_count++;
399} 399}
400 400
@@ -421,6 +421,7 @@ run (void *cls,
421 struct Plugin_Address * tmp; 421 struct Plugin_Address * tmp;
422 const char * addr_str; 422 const char * addr_str;
423 unsigned int count_str_addr; 423 unsigned int count_str_addr;
424 unsigned int suggest_res;
424 425
425 fail_pretty_printer = GNUNET_YES; 426 fail_pretty_printer = GNUNET_YES;
426 fail_notify_address = GNUNET_YES; 427 fail_notify_address = GNUNET_YES;
@@ -485,8 +486,11 @@ run (void *cls,
485 { 486 {
486 cur = addr_head; 487 cur = addr_head;
487 488
488 api->address_pretty_printer(NULL,"http",cur->addr,cur->addrlen,GNUNET_NO,TEST_TIMEOUT,&pretty_printer_cb,NULL); 489 api->address_pretty_printer (NULL,"http",cur->addr,cur->addrlen,GNUNET_NO,TEST_TIMEOUT,&pretty_printer_cb,NULL);
489 addr_str = api->address_to_string(NULL,cur->addr,cur->addrlen); 490 addr_str = api->address_to_string (NULL,cur->addr,cur->addrlen);
491 suggest_res = api->check_address (NULL,cur->addr,cur->addrlen);
492
493 GNUNET_assert (GNUNET_OK == suggest_res);
490 GNUNET_assert (NULL != addr_str); 494 GNUNET_assert (NULL != addr_str);
491 count_str_addr++; 495 count_str_addr++;
492 496
@@ -501,6 +505,25 @@ run (void *cls,
501 fail_pretty_printer=GNUNET_NO; 505 fail_pretty_printer=GNUNET_NO;
502 fail_addr_to_str=GNUNET_NO; 506 fail_addr_to_str=GNUNET_NO;
503 507
508 /* Suggesting addresses with wrong port*/
509 struct IPv4HttpAddress failing_addr;
510 failing_addr.ipv4_addr = INADDR_LOOPBACK;
511 failing_addr.u_port = 0;
512 suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv4HttpAddress));
513 GNUNET_assert (GNUNET_SYSERR == suggest_res);
514
515 /* Suggesting addresses with wrong size*/
516 failing_addr.ipv4_addr = INADDR_LOOPBACK;
517 failing_addr.u_port = 0;
518 suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv6HttpAddress));
519 GNUNET_assert (GNUNET_SYSERR == suggest_res);
520
521 /* Suggesting addresses with wrong address*/
522 failing_addr.ipv4_addr = 0;
523 failing_addr.u_port = 12389;
524 suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv4HttpAddress));
525 GNUNET_assert (GNUNET_SYSERR == suggest_res);
526
504 /* testing finished, shutting down */ 527 /* testing finished, shutting down */
505 if ((fail_notify_address == GNUNET_NO) && (fail_pretty_printer == GNUNET_NO) && (fail_addr_to_str == GNUNET_NO) ) 528 if ((fail_notify_address == GNUNET_NO) && (fail_pretty_printer == GNUNET_NO) && (fail_addr_to_str == GNUNET_NO) )
506 fail = 0; 529 fail = 0;