aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-18 13:32:46 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-18 13:32:46 +0000
commite66c03e8b940a7b39b7531d2ae25c107cfc89b4b (patch)
treed2a0afe22f887ffcc4fd3ceb7177b7e76f6def0a /src
parenta0b1e4ae909d99bacac9ecaa52449d6c940d5947 (diff)
downloadgnunet-e66c03e8b940a7b39b7531d2ae25c107cfc89b4b.tar.gz
gnunet-e66c03e8b940a7b39b7531d2ae25c107cfc89b4b.zip
- fixes for http reverse proxying
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport.c6
-rw-r--r--src/transport/plugin_transport_http_client.c39
-rw-r--r--src/transport/test_transport_api_http_reverse_peer1.conf8
3 files changed, 43 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index f9a4c7b9e..209490d21 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -579,6 +579,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
579 GNUNET_CRYPTO_rsa_key_free (GST_my_private_key); 579 GNUNET_CRYPTO_rsa_key_free (GST_my_private_key);
580 GST_my_private_key = NULL; 580 GST_my_private_key = NULL;
581 } 581 }
582 GST_server = NULL;
582} 583}
583 584
584 585
@@ -644,7 +645,10 @@ key_generation_cb (void *cls,
644 &neighbours_address_notification); 645 &neighbours_address_notification);
645 GST_clients_start (GST_server); 646 GST_clients_start (GST_server);
646 GST_validation_start (); 647 GST_validation_start ();
647 GNUNET_SERVER_resume (GST_server); 648 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
649 _("SERVER %p\n"), GST_server);
650 if (NULL != GST_server)
651 GNUNET_SERVER_resume (GST_server);
648} 652}
649 653
650 654
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 7ec0e682e..a0a3f2087 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -988,6 +988,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
988{ 988{
989 struct HTTP_Client_Plugin *plugin = cls; 989 struct HTTP_Client_Plugin *plugin = cls;
990 int running; 990 int running;
991 int http_statuscode;
991 CURLMcode mret; 992 CURLMcode mret;
992 993
993 GNUNET_assert (cls != NULL); 994 GNUNET_assert (cls != NULL);
@@ -1033,27 +1034,46 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1033 GNUNET_assert (s != NULL); 1034 GNUNET_assert (s != NULL);
1034 if (msg->msg == CURLMSG_DONE) 1035 if (msg->msg == CURLMSG_DONE)
1035 { 1036 {
1037 curl_easy_getinfo (easy_h, CURLINFO_RESPONSE_CODE, &http_statuscode);
1036 if (easy_h == s->client_put) 1038 if (easy_h == s->client_put)
1037 { 1039 {
1038 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1040 if ((0 != msg->data.result) || (http_statuscode != 200))
1039 "Session %p/connection %p: PUT connection to `%s' ended with reason %i: `%s'\n", 1041 {
1040 s, msg->easy_handle, GNUNET_i2s (&s->target), 1042 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1041 msg->data.result, 1043 "Session %p/connection %p: PUT connection to `%s' ended with status %i reason %i: `%s'\n",
1042 curl_easy_strerror (msg->data.result)); 1044 s, msg->easy_handle, GNUNET_i2s (&s->target),
1045 http_statuscode,
1046 msg->data.result,
1047 curl_easy_strerror (msg->data.result));
1048 }
1049 else
1050 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1051 "Session %p/connection %p: PUT connection to `%s' ended normal\n",
1052 s, msg->easy_handle, GNUNET_i2s (&s->target));
1043 if (s->client_get == NULL) 1053 if (s->client_get == NULL)
1044 { 1054 {
1045 /* Disconnect other transmission direction and tell transport */ 1055 /* Disconnect other transmission direction and tell transport */
1046 //client_disconnect (s);
1047 } 1056 }
1057 curl_multi_remove_handle(plugin->curl_multi_handle, easy_h);
1058 curl_easy_cleanup(easy_h);
1059 s->client_put = NULL;
1048 } 1060 }
1049 if (easy_h == s->client_get) 1061 if (easy_h == s->client_get)
1050 { 1062 {
1051 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1063 if ((0 != msg->data.result) || (http_statuscode != 200))
1052 "Session %p/connection %p: GET connection to `%s' ended with reason %i: `%s'\n", 1064 {
1065 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1066 "Session %p/connection %p: GET connection to `%s' ended with status %i reason %i: `%s'\n",
1053 s, msg->easy_handle, GNUNET_i2s (&s->target), 1067 s, msg->easy_handle, GNUNET_i2s (&s->target),
1068 http_statuscode,
1054 msg->data.result, 1069 msg->data.result,
1055 curl_easy_strerror (msg->data.result)); 1070 curl_easy_strerror (msg->data.result));
1056 1071
1072 }
1073 else
1074 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1075 "Session %p/connection %p: GET connection to `%s' ended normal\n",
1076 s, msg->easy_handle, GNUNET_i2s (&s->target));
1057 /* Disconnect other transmission direction and tell transport */ 1077 /* Disconnect other transmission direction and tell transport */
1058 client_disconnect (s); 1078 client_disconnect (s);
1059 } 1079 }
@@ -1113,7 +1133,8 @@ client_connect_put (struct Session *s)
1113{ 1133{
1114 CURLMcode mret; 1134 CURLMcode mret;
1115 /* create put connection */ 1135 /* create put connection */
1116 s->client_put = curl_easy_init (); 1136 if (NULL == s->client_put)
1137 s->client_put = curl_easy_init ();
1117#if VERBOSE_CURL 1138#if VERBOSE_CURL
1118 curl_easy_setopt (s->client_put, CURLOPT_VERBOSE, 1L); 1139 curl_easy_setopt (s->client_put, CURLOPT_VERBOSE, 1L);
1119 curl_easy_setopt (s->client_put, CURLOPT_DEBUGFUNCTION, &client_log); 1140 curl_easy_setopt (s->client_put, CURLOPT_DEBUGFUNCTION, &client_log);
diff --git a/src/transport/test_transport_api_http_reverse_peer1.conf b/src/transport/test_transport_api_http_reverse_peer1.conf
index 3093a2482..bef99cdac 100644
--- a/src/transport/test_transport_api_http_reverse_peer1.conf
+++ b/src/transport/test_transport_api_http_reverse_peer1.conf
@@ -32,3 +32,11 @@ UNIXPATH = /tmp/gnunet-p1-service-transport.sock
32PREFIX = valgrind --leak-check=full 32PREFIX = valgrind --leak-check=full
33#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args 33#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
34 34
35
36[ats]
37#DEBUG = YES
38WAN_QUOTA_IN = unlimited
39WAN_QUOTA_OUT = unlimited
40PORT = 12006
41UNIXPATH = /tmp/gnunet-http_reserver_p1-service-ats.sock
42