diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-18 13:32:46 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-18 13:32:46 +0000 |
commit | e66c03e8b940a7b39b7531d2ae25c107cfc89b4b (patch) | |
tree | d2a0afe22f887ffcc4fd3ceb7177b7e76f6def0a /src/transport/plugin_transport_http_client.c | |
parent | a0b1e4ae909d99bacac9ecaa52449d6c940d5947 (diff) | |
download | gnunet-e66c03e8b940a7b39b7531d2ae25c107cfc89b4b.tar.gz gnunet-e66c03e8b940a7b39b7531d2ae25c107cfc89b4b.zip |
- fixes for http reverse proxying
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 39 |
1 files changed, 30 insertions, 9 deletions
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); |