aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/plugin_transport_http.c44
-rw-r--r--src/transport/plugin_transport_https.c46
2 files changed, 47 insertions, 43 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 702f1e0a1..fe43ca0d8 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -613,6 +613,7 @@ process_interfaces (void *cls,
613 return GNUNET_OK; 613 return GNUNET_OK;
614 } 614 }
615 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress)); 615 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress));
616 GNUNET_assert(t6 != NULL);
616 if (plugin->bind6_address != NULL) 617 if (plugin->bind6_address != NULL)
617 { 618 {
618 if (0 == memcmp(&plugin->bind6_address->sin6_addr, &bnd_cmp6, sizeof (struct in6_addr))) 619 if (0 == memcmp(&plugin->bind6_address->sin6_addr, &bnd_cmp6, sizeof (struct in6_addr)))
@@ -685,8 +686,9 @@ static void mhd_write_mst_cb (void *cls,
685{ 686{
686 687
687 struct Session *ps = cls; 688 struct Session *ps = cls;
688 struct HTTP_PeerContext *pc = ps->peercontext;
689 GNUNET_assert(ps != NULL); 689 GNUNET_assert(ps != NULL);
690
691 struct HTTP_PeerContext *pc = ps->peercontext;
690 GNUNET_assert(pc != NULL); 692 GNUNET_assert(pc != NULL);
691#if DEBUG_HTTP 693#if DEBUG_HTTP
692 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 694 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -798,7 +800,7 @@ mdh_access_cb (void *cls,
798 int res = GNUNET_NO; 800 int res = GNUNET_NO;
799 int send_error_to_client; 801 int send_error_to_client;
800 void * addr; 802 void * addr;
801 size_t addr_len; 803 size_t addr_len = 0 ;
802 804
803 GNUNET_assert(cls !=NULL); 805 GNUNET_assert(cls !=NULL);
804 send_error_to_client = GNUNET_NO; 806 send_error_to_client = GNUNET_NO;
@@ -1289,7 +1291,7 @@ static size_t curl_send_cb(void *stream, size_t size, size_t nmemb, void *ptr)
1289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos); 1291 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos);
1290#endif 1292#endif
1291 /* Calling transmit continuation */ 1293 /* Calling transmit continuation */
1292 if (( NULL != ps->pending_msgs_tail) && (NULL != ps->pending_msgs_tail->transmit_cont)) 1294 if (NULL != ps->pending_msgs_tail->transmit_cont)
1293 msg->transmit_cont (ps->pending_msgs_tail->transmit_cont_cls,&(ps->peercontext)->identity,GNUNET_OK); 1295 msg->transmit_cont (ps->pending_msgs_tail->transmit_cont_cls,&(ps->peercontext)->identity,GNUNET_OK);
1294 remove_http_message(ps, msg); 1296 remove_http_message(ps, msg);
1295 } 1297 }
@@ -2410,26 +2412,26 @@ libgnunet_plugin_transport_http_init (void *cls)
2410 if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg, 2412 if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
2411 "transport-http", "BINDTO6"))) 2413 "transport-http", "BINDTO6")))
2412 { 2414 {
2413 GNUNET_break (GNUNET_OK == 2415 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (env->cfg,
2414 GNUNET_CONFIGURATION_get_value_string (env->cfg,
2415 "transport-http", 2416 "transport-http",
2416 "BINDTO6", 2417 "BINDTO6",
2417 &plugin->bind_hostname)); 2418 &plugin->bind_hostname))
2418
2419 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6));
2420 plugin->bind6_address->sin6_family = AF_INET6;
2421 plugin->bind6_address->sin6_port = htons (port);
2422
2423 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2424 { 2419 {
2425 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2420 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6));
2426 "http", 2421 plugin->bind6_address->sin6_family = AF_INET6;
2427 _("Misconfigured address to bind to in configuration!\n"), 2422 plugin->bind6_address->sin6_port = htons (port);
2428 "transport-http"); 2423
2429 GNUNET_free(plugin->bind6_address); 2424 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2430 GNUNET_free(plugin->bind_hostname); 2425 {
2431 plugin->bind_hostname = NULL; 2426 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2432 plugin->bind6_address = NULL; 2427 "http",
2428 _("Misconfigured address to bind to in configuration!\n"),
2429 "transport-http");
2430 GNUNET_free(plugin->bind6_address);
2431 GNUNET_free(plugin->bind_hostname);
2432 plugin->bind_hostname = NULL;
2433 plugin->bind6_address = NULL;
2434 }
2433 } 2435 }
2434 } 2436 }
2435 2437
@@ -2500,7 +2502,7 @@ libgnunet_plugin_transport_http_init (void *cls)
2500 } 2502 }
2501 else 2503 else
2502 { 2504 {
2503 char * tmp; 2505 char * tmp = NULL;
2504 if ((plugin->use_ipv6 == GNUNET_YES) && (plugin->use_ipv4 == GNUNET_YES)) 2506 if ((plugin->use_ipv6 == GNUNET_YES) && (plugin->use_ipv4 == GNUNET_YES))
2505 GNUNET_asprintf(&tmp,"with IPv4 and IPv6 enabled"); 2507 GNUNET_asprintf(&tmp,"with IPv4 and IPv6 enabled");
2506 if ((plugin->use_ipv6 == GNUNET_NO) && (plugin->use_ipv4 == GNUNET_YES)) 2508 if ((plugin->use_ipv6 == GNUNET_NO) && (plugin->use_ipv4 == GNUNET_YES))
diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c
index 6d0753e4d..aa25d7ac4 100644
--- a/src/transport/plugin_transport_https.c
+++ b/src/transport/plugin_transport_https.c
@@ -622,6 +622,7 @@ process_interfaces (void *cls,
622 return GNUNET_OK; 622 return GNUNET_OK;
623 } 623 }
624 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress)); 624 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress));
625 GNUNET_assert(t6 != NULL);
625 if (plugin->bind6_address != NULL) 626 if (plugin->bind6_address != NULL)
626 { 627 {
627 if (0 == memcmp(&plugin->bind6_address->sin6_addr, &bnd_cmp6, sizeof (struct in6_addr))) 628 if (0 == memcmp(&plugin->bind6_address->sin6_addr, &bnd_cmp6, sizeof (struct in6_addr)))
@@ -694,8 +695,9 @@ static void mhd_write_mst_cb (void *cls,
694{ 695{
695 696
696 struct Session *ps = cls; 697 struct Session *ps = cls;
697 struct HTTP_PeerContext *pc = ps->peercontext;
698 GNUNET_assert(ps != NULL); 698 GNUNET_assert(ps != NULL);
699
700 struct HTTP_PeerContext *pc = ps->peercontext;
699 GNUNET_assert(pc != NULL); 701 GNUNET_assert(pc != NULL);
700#if DEBUG_HTTPS 702#if DEBUG_HTTPS
701 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 703 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -807,7 +809,7 @@ mdh_access_cb (void *cls,
807 int res = GNUNET_NO; 809 int res = GNUNET_NO;
808 int send_error_to_client; 810 int send_error_to_client;
809 void * addr; 811 void * addr;
810 size_t addr_len; 812 size_t addr_len = 0;
811 813
812 GNUNET_assert(cls !=NULL); 814 GNUNET_assert(cls !=NULL);
813 send_error_to_client = GNUNET_NO; 815 send_error_to_client = GNUNET_NO;
@@ -1300,7 +1302,7 @@ static size_t curl_send_cb(void *stream, size_t size, size_t nmemb, void *ptr)
1300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos); 1302 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos);
1301#endif 1303#endif
1302 /* Calling transmit continuation */ 1304 /* Calling transmit continuation */
1303 if (( NULL != ps->pending_msgs_tail) && (NULL != ps->pending_msgs_tail->transmit_cont)) 1305 if (NULL != ps->pending_msgs_tail->transmit_cont)
1304 msg->transmit_cont (ps->pending_msgs_tail->transmit_cont_cls,&(ps->peercontext)->identity,GNUNET_OK); 1306 msg->transmit_cont (ps->pending_msgs_tail->transmit_cont_cls,&(ps->peercontext)->identity,GNUNET_OK);
1305 remove_http_message(ps, msg); 1307 remove_http_message(ps, msg);
1306 } 1308 }
@@ -2514,30 +2516,30 @@ libgnunet_plugin_transport_https_init (void *cls)
2514 GNUNET_asprintf(&cert_file,"https.cert"); 2516 GNUNET_asprintf(&cert_file,"https.cert");
2515 } 2517 }
2516 2518
2517 /* Reading ipv4 addresse to bind to from config file */ 2519 /* Should plugin use ipv6? */
2518 if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg, 2520 if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
2519 "transport-https", "BINDTO6"))) 2521 "transport-https", "BINDTO6")))
2520 { 2522 {
2521 GNUNET_break (GNUNET_OK == 2523 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (env->cfg,
2522 GNUNET_CONFIGURATION_get_value_string (env->cfg,
2523 "transport-https", 2524 "transport-https",
2524 "BINDTO6", 2525 "BINDTO6",
2525 &plugin->bind_hostname)); 2526 &plugin->bind_hostname))
2526
2527 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6));
2528 plugin->bind6_address->sin6_family = AF_INET6;
2529 plugin->bind6_address->sin6_port = htons (port);
2530
2531 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2532 { 2527 {
2533 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2528 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6));
2534 "http", 2529 plugin->bind6_address->sin6_family = AF_INET6;
2535 _("Misconfigured address to bind to in configuration!\n"), 2530 plugin->bind6_address->sin6_port = htons (port);
2536 "transport-https"); 2531
2537 GNUNET_free(plugin->bind6_address); 2532 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2538 GNUNET_free(plugin->bind_hostname); 2533 {
2539 plugin->bind_hostname = NULL; 2534 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2540 plugin->bind6_address = NULL; 2535 "http",
2536 _("Misconfigured address to bind to in configuration!\n"),
2537 "transport-https");
2538 GNUNET_free(plugin->bind6_address);
2539 GNUNET_free(plugin->bind_hostname);
2540 plugin->bind_hostname = NULL;
2541 plugin->bind6_address = NULL;
2542 }
2541 } 2543 }
2542 } 2544 }
2543 2545
@@ -2674,7 +2676,7 @@ libgnunet_plugin_transport_https_init (void *cls)
2674 } 2676 }
2675 else 2677 else
2676 { 2678 {
2677 char * tmp; 2679 char * tmp = NULL;
2678 if ((plugin->use_ipv6 == GNUNET_YES) && (plugin->use_ipv4 == GNUNET_YES)) 2680 if ((plugin->use_ipv6 == GNUNET_YES) && (plugin->use_ipv4 == GNUNET_YES))
2679 GNUNET_asprintf(&tmp,"with IPv4 and IPv6 enabled"); 2681 GNUNET_asprintf(&tmp,"with IPv4 and IPv6 enabled");
2680 if ((plugin->use_ipv6 == GNUNET_NO) && (plugin->use_ipv4 == GNUNET_YES)) 2682 if ((plugin->use_ipv6 == GNUNET_NO) && (plugin->use_ipv4 == GNUNET_YES))