From 2b9c6d7aa188d9666104d52d5ffb3338521fd27e Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 16 Sep 2011 22:08:45 +0000 Subject: [PATCH] fixes --- src/transport/Makefile.am | 4 ++-- src/transport/plugin_transport_http_client.c | 6 ++++-- src/transport/plugin_transport_http_new.c | 17 +++++++++-------- src/transport/plugin_transport_http_server.c | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 4089a195a..528a2f37e 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -213,7 +213,7 @@ libgnunet_plugin_transport_unix_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) libgnunet_plugin_transport_http_la_SOURCES = \ - plugin_transport_http.c + plugin_transport_http_new.c plugin_transport_http_client.c plugin_transport_http_server.c libgnunet_plugin_transport_http_la_LIBADD = \ $(top_builddir)/src/hello/libgnunethello.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ @@ -230,7 +230,7 @@ libgnunet_plugin_transport_http_la_CPPFLAGS = \ @LIBCURL_CPPFLAGS@ libgnunet_plugin_transport_https_la_SOURCES = \ - plugin_transport_http.c + plugin_transport_http_new.c plugin_transport_http_client.c plugin_transport_http_server.c libgnunet_plugin_transport_https_la_LIBADD = \ $(top_builddir)/src/hello/libgnunethello.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 224adb474..715125dd0 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -171,10 +171,12 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) while ((msg = curl_multi_info_read(plugin->client_mh, &msgs_left))) { CURL *easy_h = msg->easy_handle; - struct Session *s; + struct Session *s = NULL; + char * d = (char *) s; GNUNET_assert (easy_h != NULL); - GNUNET_assert (CURLE_OK == curl_easy_getinfo(easy_h, CURLINFO_PRIVATE, &s)); + GNUNET_assert (CURLE_OK == curl_easy_getinfo(easy_h, CURLINFO_PRIVATE, &d)); + s = (struct Session *) d; GNUNET_assert (s != NULL); if (msg->msg == CURLMSG_DONE) diff --git a/src/transport/plugin_transport_http_new.c b/src/transport/plugin_transport_http_new.c index e998636b2..3cdb40dad 100644 --- a/src/transport/plugin_transport_http_new.c +++ b/src/transport/plugin_transport_http_new.c @@ -327,8 +327,6 @@ http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, const char * http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) { - struct Plugin *plugin = cls; - const struct IPv4HttpAddress *t4; const struct IPv6HttpAddress *t6; struct sockaddr_in a4; @@ -336,9 +334,7 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) char *address; static char rbuf[INET6_ADDRSTRLEN + 13]; uint16_t port; - int res; - - GNUNET_assert (plugin != NULL); + int res = 0; if (addrlen == sizeof (struct IPv6HttpAddress)) { @@ -361,12 +357,17 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) /* invalid address */ return NULL; } +#if !BUILD_HTTPS + char * protocol = "http"; +#else + char * protocol = "https"; +#endif GNUNET_assert (strlen (address) + 7 < (INET6_ADDRSTRLEN + 13)); - if (addrlen == sizeof (struct IPv6HttpAddress)) - res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://[%s]:%u/", plugin->protocol, address, port); + if (addrlen == sizeof (struct IPv6HttpAddress)) + res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://[%s]:%u/", protocol, address, port); else if (addrlen == sizeof (struct IPv4HttpAddress)) - res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://%s:%u/", plugin->protocol, address, port); + res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://%s:%u/", protocol, address, port); GNUNET_free (address); GNUNET_assert (res != 0); diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 0c2ab54cf..3754240f1 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -331,7 +331,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, /* new connection */ if (sc == NULL) { - uint32_t tag; + uint32_t tag = 0; const union MHD_ConnectionInfo *conn_info; size_t addrlen; struct GNUNET_PeerIdentity target; -- 2.25.1