From 4e62ea52d994deed44a0a5cfd15faa826cd39e85 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 12 Jul 2013 13:43:09 +0000 Subject: fix if plugin is loaded only in stub mode --- src/transport/plugin_transport_http_client.c | 2 +- src/transport/plugin_transport_http_common.c | 2 +- src/transport/plugin_transport_http_common.h | 7 ++++++- src/transport/plugin_transport_http_server.c | 7 ++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 466d05acd..8f814b590 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -1771,7 +1771,7 @@ const char *http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) { - return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen); + return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen); } /** diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index 912ba93d3..887aa6981 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c @@ -266,6 +266,7 @@ http_common_plugin_address_to_string (void *cls, char *plugin, const void *addr, const char * addr_str; char *res; + GNUNET_assert (NULL != plugin); if (NULL == addr) return NULL; @@ -277,7 +278,6 @@ http_common_plugin_address_to_string (void *cls, char *plugin, const void *addr, if (addr_str[ntohl(address->urlen) -1] != '\0') return NULL; - GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl(address->options), &address[1]); if (strlen(res) + 1 < 500) { diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h index ae37f605a..51473d73a 100644 --- a/src/transport/plugin_transport_http_common.h +++ b/src/transport/plugin_transport_http_common.h @@ -34,7 +34,6 @@ #define TESTING GNUNET_NO #if TESTING - #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) #define CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 7) @@ -43,6 +42,12 @@ #else +#if BUILD_HTTPS +#define PROTOCOL "https" +#else +#define PROTOCOL "http" +#endif + #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) #define CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 56cd12fe8..10ba80a19 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -3013,7 +3013,12 @@ const char *http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) { - return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen); +#if BUILD_HTTPS + return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen); +#else + return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen); +#endif + } /** -- cgit v1.2.3