changes
authorMatthias Wachs <wachs@net.in.tum.de>
Wed, 29 Aug 2012 13:18:28 +0000 (13:18 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Wed, 29 Aug 2012 13:18:28 +0000 (13:18 +0000)
src/transport/plugin_transport_http_client.c
src/transport/plugin_transport_http_server.c
src/transport/test_plugin_transport.c

index 1f08d7bbbaf27e6ffc070697ae31d848a39dc676..e2bc39f0e47a3ff79ba5e55445b7d364b097e7da 100644 (file)
@@ -33,7 +33,7 @@
 #endif
 
 
-#define VERBOSE_CURL GNUNET_NO
+#define VERBOSE_CURL GNUNET_YES
 
 #include "platform.h"
 #include "gnunet_protocols.h"
@@ -322,10 +322,25 @@ client_exist_session (struct HTTP_Client_Plugin *plugin, struct Session *s)
 static int
 client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls)
 {
-  if (type == CURLINFO_TEXT)
+  char *ttype;
+  if ((type == CURLINFO_TEXT) || (type == CURLINFO_HEADER_IN) || (type == CURLINFO_HEADER_OUT))
   {
     char text[size + 2];
 
+    switch (type) {
+      case CURLINFO_TEXT:
+        ttype = "TEXT";
+        break;
+      case CURLINFO_HEADER_IN:
+        ttype = "HEADER_IN";
+        break;
+      case CURLINFO_HEADER_OUT:
+        ttype = "HEADER_OUT";
+        break;
+      default:
+        break;
+    }
+
     memcpy (text, data, size);
     if (text[size - 1] == '\n')
       text[size] = '\0';
@@ -336,10 +351,10 @@ client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls)
     }
 #if BUILD_HTTPS
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https_client",
-                     "Connection: %p - %s", cls, text);
+                     "Connection %p %s: %s", cls, ttype, text);
 #else
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http_client",
-                     "Connection %p: - %s", cls, text);
+                     "Connection %p %s: %s", cls, ttype, text);
 #endif
   }
   return 0;
@@ -918,7 +933,6 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   client_schedule (plugin, GNUNET_NO);
 }
 
-
 static int
 client_connect (struct Session *s)
 {
@@ -989,8 +1003,13 @@ client_connect (struct Session *s)
   curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 0);
 #endif
   curl_easy_setopt (s->client_put, CURLOPT_URL, url);
-  curl_easy_setopt (s->client_put, CURLOPT_PUT, 1L);
-  //curl_easy_setopt (s->client_put, CURLOPT_HEADERFUNCTION, &curl_put_header_cb);
+  curl_easy_setopt (s->client_put, CURLOPT_UPLOAD, 1L);
+  /*
+  struct curl_slist *m_headerlist;
+  m_headerlist = NULL;
+  m_headerlist = curl_slist_append(m_headerlist, "Transfer-Encoding: chunked");
+  curl_easy_setopt(s->client_put, CURLOPT_HTTPHEADER, m_headerlist);*/
+  //curl_easy_setopt (s->client_put, CURLOPT_HEADERFUNCTION, &client_curl_header);
   //curl_easy_setopt (s->client_put, CURLOPT_WRITEHEADER, ps);
   curl_easy_setopt (s->client_put, CURLOPT_READFUNCTION, client_send_cb);
   curl_easy_setopt (s->client_put, CURLOPT_READDATA, s);
index 6ec0c77a02ea22266a6cc799d10dd4b741df4621..f89e2210af479a2824b209e81004a9d2f5e0066e 100644 (file)
@@ -1152,6 +1152,12 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
   struct Session *s;
   struct MHD_Response *response;
 
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+                   _("Access from connection %p (%u of %u) for %s %s url `%s' \n"),
+                   sc,
+                   plugin->cur_connections, plugin->max_connections,
+                   method, version, url);
+
   GNUNET_assert (cls != NULL);
   if (sc == NULL)
   {
@@ -1363,7 +1369,13 @@ server_accept_cb (void *cls, const struct sockaddr *addr, socklen_t addr_len)
   struct HTTP_Server_Plugin *plugin = cls;
 
   if (plugin->cur_connections <= plugin->max_connections)
+  {
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+                     _("Accepting connection (%u of %u) from `%s'\n"),
+                     plugin->cur_connections, plugin->max_connections,
+                     GNUNET_a2s (addr, addr_len));
     return MHD_YES;
+  }
   else
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name,
index 4934dcdade00cda00dcb7ac556fb52fd2b51c4a9..dae1130df8d9361c4ff10963ccbbc493a4b9e547 100644 (file)
@@ -144,6 +144,7 @@ end ()
 {
   struct AddressWrapper *w;
   int c = 0;
+  ok = 0;
 
   if (GNUNET_SCHEDULER_NO_TASK != timeout_task)
   {
@@ -169,6 +170,7 @@ end ()
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               _("Plugin did not remove %u addresses \n"), c);
+    ok = 1;
   }
 
 
@@ -182,8 +184,6 @@ end ()
     GNUNET_HELPER_stop (suid_helper);
     suid_helper = NULL;
   }
-
-  ok = 0;
 }
 
 static void