stuff
[oweals/gnunet.git] / src / transport / test_plugin_transport_http.c
index 73a9c950a1ba828b203134951964019acbbc11e6..5ba8c573a37e24735ef2fb431074c93f92726da6 100644 (file)
@@ -386,6 +386,8 @@ static CURLM *multi_handle;
  */
 static GNUNET_SCHEDULER_TaskIdentifier http_task_send;
 
+static char * servicehome;
+
 /**
  * Shutdown testcase
  */
@@ -401,7 +403,7 @@ shutdown_clean ()
        (fail_addr_to_str == GNUNET_YES))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
-                 "Phase 0: Test plugin functions failed\n");
+                  "Phase 0: Test plugin functions failed\n");
       fail = 1;
     }
   if ( (test_no_ident.test_failed == GNUNET_YES) || 
@@ -410,7 +412,7 @@ shutdown_clean ()
        (test_valid_ident.test_failed == GNUNET_YES) )
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
-               "Phase 1: Test connect with wrong data failed\n");
+                "Phase 1: Test connect with wrong data failed\n");
     fail = 1;
   }
   if ( (fail_session_selection_any != GNUNET_NO) || 
@@ -419,7 +421,7 @@ shutdown_clean ()
        (fail_session_selection_session_big != GNUNET_NO) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
-                 "Phase 2: Test session selection failed\n");
+                  "Phase 2: Test session selection failed\n");
       fail = 1;
     }
   if ( (fail_msgs_transmited_to_local_addrs != count_str_addr) ||
@@ -427,13 +429,13 @@ shutdown_clean ()
        (fail_msg_transmited_max_size == GNUNET_YES) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
-                 "Phase 3: Test sending with plugin failed\n");
+                  "Phase 3: Test sending with plugin failed\n");
       fail = 1;
     }
   if (fail != 1)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                 "All tests successful\n");
+                  "All tests successful\n");
     }
   
   api->disconnect(api->cls,&my_identity);
@@ -472,14 +474,21 @@ shutdown_clean ()
 
   GNUNET_free(test_addr);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-             "Unloading http plugin\n");
+              "Unloading http plugin\n");
   GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_gnunet_transport_plugin_http", api));
 
   GNUNET_SCHEDULER_shutdown();
   GNUNET_DISK_directory_remove ("/tmp/test_gnunet_transport_plugin_http");
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-             "Exiting testcase\n");
+              "Exiting testcase\n");
+
+  if (servicehome != NULL)
+  {
+    GNUNET_DISK_directory_remove (servicehome);
+    GNUNET_free (servicehome);
+  }
+
   exit(fail);
   return;
 }
@@ -494,13 +503,13 @@ shutdown_clean ()
 
 static void
 task_send_cont (void *cls,
-               const struct GNUNET_PeerIdentity * target,
-               int result)
+                const struct GNUNET_PeerIdentity * target,
+                int result)
 {
   if ((cls == &fail_msg_transmited_bigger_max_size) && (result == GNUNET_SYSERR))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                 "Message bigger max msg size was not sent!\n");
+                  "Message bigger max msg size was not sent!\n");
       fail_msg_transmited_bigger_max_size = GNUNET_NO;
       return;
     }
@@ -508,8 +517,8 @@ task_send_cont (void *cls,
   if ((cls == &fail_msg_transmited_max_size) && (result == GNUNET_OK))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                 "Message with max msg size succesfully sent!\n",
-                 fail_msgs_transmited_to_local_addrs);
+                  "Message with max msg size succesfully sent!\n",
+                  fail_msgs_transmited_to_local_addrs);
       fail_msg_transmited_max_size = GNUNET_NO;
     }
 }
@@ -530,18 +539,18 @@ receive (void *cls, const struct GNUNET_PeerIdentity *peer,
         uint16_t sender_address_len)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Testcase recieved new message from peer `%s' with type %u and length %u, session %X\n",
-             GNUNET_i2s(peer), 
-             ntohs(message->type), 
-             ntohs(message->size),
-             session);
+              "Testcase recieved new message from peer `%s' with type %u and length %u, session %X\n",
+              GNUNET_i2s(peer),
+              ntohs(message->type),
+              ntohs(message->size),
+              session);
 
   if ( (ntohs(message->type)>=10) && 
        (ntohs(message->type)<20) )
     {
       fail_msgs_transmited_to_local_addrs++;
       if (fail_msgs_transmited_to_local_addrs == count_str_addr)
-       run_connection_tests(2, session);
+        run_connection_tests(2, session);
     }
   if ((ntohs(message->type)==20))
     {
@@ -616,8 +625,8 @@ header_function( void *ptr, size_t size, size_t nmemb, void *stream)
     tmp[len-2]= '\0';
 #if DEBUG_CURL
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Header: `%s'\n",
-             tmp);
+              "Header: `%s'\n",
+              tmp);
 #endif
   if (0==strcmp (tmp,"HTTP/1.1 100 Continue"))
     {
@@ -651,7 +660,7 @@ send_prepare( struct HTTP_Transfer * result);
 
 static void 
 send_execute (void *cls,
-             const struct GNUNET_SCHEDULER_TaskContext *tc)
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct HTTP_Transfer *res;
 
@@ -702,50 +711,50 @@ send_execute (void *cls,
                   if (res == &test_no_ident)
                   {
                     if  ((res->http_result_code==404) && (buffer_in.len==208))
-                     {
+                      {
                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                                 "Connecting to peer without any peer identification: test passed\n");
+                                  "Connecting to peer without any peer identification: test passed\n");
                       res->test_failed = GNUNET_NO;
                     }
                     else
                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                 _("Connecting to peer without any peer identification: test failed\n"));
+                                  _("Connecting to peer without any peer identification: test failed\n"));
                   }
                   if (res == &test_too_short_ident)
                   {
                     if  ((res->http_result_code==404) && (buffer_in.len==208))
                     {
                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                                 "Connecting to peer with too short peer identification: test passed\n");
+                                  "Connecting to peer with too short peer identification: test passed\n");
                       res->test_failed = GNUNET_NO;
                     }
                     else
                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                 _("Connecting to peer with too short peer identification: test failed\n"));
+                                  _("Connecting to peer with too short peer identification: test failed\n"));
                   }
                   if (res == &test_too_long_ident)
                   {
                     if  ((res->http_result_code==404) && (buffer_in.len==208))
                       {
                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                                 "Connecting to peer with too long peer identification: test passed\n");
+                                  "Connecting to peer with too long peer identification: test passed\n");
                       res->test_failed = GNUNET_NO;
                       }
                     else
                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                 _("Connecting to peer with too long peer identification: test failed\n"));
+                                  _("Connecting to peer with too long peer identification: test failed\n"));
                   }
                   if (res == &test_valid_ident)
                   {
                     if  ((res->http_result_code==200))
                     {
                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                                 "Connecting to peer with valid peer identification: test passed\n");
+                                  "Connecting to peer with valid peer identification: test passed\n");
                       res->test_failed = GNUNET_NO;
                     }
                     else
                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                 "Connecting to peer with valid peer identification: test failed\n");
+                                  "Connecting to peer with valid peer identification: test failed\n");
                   }
                   curl_easy_cleanup(curl_handle);
                   curl_handle=NULL;
@@ -811,12 +820,12 @@ send_prepare( struct HTTP_Transfer * result)
   GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1);
   GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1);
   http_task_send = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                               GNUNET_SCHEDULER_NO_TASK,
-                                               GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0),
-                                               grs,
-                                               gws,
-                                               &send_execute,
-                                               result);
+                                                GNUNET_SCHEDULER_NO_TASK,
+                                                GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0),
+                                                grs,
+                                                gws,
+                                                &send_execute,
+                                                result);
   GNUNET_NETWORK_fdset_destroy (gws);
   GNUNET_NETWORK_fdset_destroy (grs);
 
@@ -829,7 +838,7 @@ send_prepare( struct HTTP_Transfer * result)
  */
 static int 
 send_data(struct HTTP_Transfer * result,
-         char * url)
+          char * url)
 {
 
   curl_handle = curl_easy_init();
@@ -865,10 +874,9 @@ send_data(struct HTTP_Transfer * result,
  */
 static void
 notify_address (void *cls,
-                const char *name,
+                int add_remove,
                 const void *addr,
-                uint16_t addrlen,
-                struct GNUNET_TIME_Relative expires)
+                size_t addrlen)
 {
   char address[INET6_ADDRSTRLEN];
   unsigned int port;
@@ -895,9 +903,9 @@ notify_address (void *cls,
       return;
     }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             _("Transport plugin notification for address: `%s':%u\n"),
-             address,
-             port);
+              _("Transport plugin notification for address: `%s':%u\n"),
+              address,
+              port);
   pl_addr = GNUNET_malloc (sizeof (struct Plugin_Address) );
   pl_addr->addrlen = addrlen;
   pl_addr->addr = GNUNET_malloc(addrlen);
@@ -912,9 +920,9 @@ notify_address (void *cls,
     {
       cur = addr_head;
       while (NULL != cur->next)
-       {
-         cur = cur->next;
-       }
+        {
+          cur = cur->next;
+        }
       cur->next = pl_addr;
     }
   fail_notify_address_count++;
@@ -923,13 +931,13 @@ notify_address (void *cls,
 
 static void
 plugin_env_session_end (void *cls,
-                       const struct GNUNET_PeerIdentity *peer,
-                       struct Session *session)
+                        const struct GNUNET_PeerIdentity *peer,
+                        struct Session *session)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Pluging tells me: session %X to peer `%s' ended\n", 
-             session, 
-             GNUNET_i2s(peer));
+              "Pluging tells me: session %X to peer `%s' ended\n",
+              session,
+              GNUNET_i2s(peer));
 }
 
 
@@ -970,13 +978,13 @@ task_timeout (void *cls,
 
 static void 
 pretty_printer_cb (void *cls,
-                  const char *address)
+                   const char *address)
 {
   if (NULL==address)
     return;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Plugin returned pretty address: `%s'\n",
-             address);
+              "Plugin returned pretty address: `%s'\n",
+              address);
   fail_pretty_printer_count++;
 }
 
@@ -1003,71 +1011,71 @@ run_connection_tests( int phase , void * cls)
 
     if (test_no_ident.test_executed == GNUNET_NO)
       {
-       /* Connecting to peer without identification */
-       const char * ident = "";
-       GNUNET_asprintf (&host_str,
-                        "%s://%s/%s",
-                        PROTOCOL_PREFIX, 
-                        test_addr,ident);
-       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                   _("Connecting to peer without any peer identification.\n"));
-       test_no_ident.test_executed = GNUNET_YES;
-       send_data ( &test_no_ident, host_str);
-       GNUNET_free (host_str);
-       return;
+        /* Connecting to peer without identification */
+        const char * ident = "";
+        GNUNET_asprintf (&host_str,
+                         "%s://%s/%s",
+                         PROTOCOL_PREFIX,
+                         test_addr,ident);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    _("Connecting to peer without any peer identification.\n"));
+        test_no_ident.test_executed = GNUNET_YES;
+        send_data ( &test_no_ident, host_str);
+        GNUNET_free (host_str);
+        return;
       }
     if (test_too_short_ident.test_executed == GNUNET_NO)
       {
-       const char * ident = "AAAAAAAAAA";
-       /* Connecting to peer with too short identification */
-       GNUNET_asprintf (&host_str, 
-                        "%s://%s/%s",
-                        PROTOCOL_PREFIX,
-                        test_addr,
-                        ident);
-       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                   _("Connecting to peer with too short peer identification.\n"));
-       test_too_short_ident.test_executed = GNUNET_YES;
-       send_data ( &test_too_short_ident, host_str);
-       GNUNET_free (host_str);
-       return;
+        const char * ident = "AAAAAAAAAA";
+        /* Connecting to peer with too short identification */
+        GNUNET_asprintf (&host_str,
+                         "%s://%s/%s",
+                         PROTOCOL_PREFIX,
+                         test_addr,
+                         ident);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    _("Connecting to peer with too short peer identification.\n"));
+        test_too_short_ident.test_executed = GNUNET_YES;
+        send_data ( &test_too_short_ident, host_str);
+        GNUNET_free (host_str);
+        return;
       }
 
     if (test_too_long_ident.test_executed == GNUNET_NO)
       {
-       const char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
-       
-       /* Connecting to peer with too long identification */
-       GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
-       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                   _("Connecting to peer with too long peer identification.\n"));
-       test_too_long_ident.test_executed = GNUNET_YES;
-       send_data ( &test_too_long_ident, host_str);
-       GNUNET_free (host_str);
-       return;
+        const char * ident = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+
+        /* Connecting to peer with too long identification */
+        GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX, test_addr,ident);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    _("Connecting to peer with too long peer identification.\n"));
+        test_too_long_ident.test_executed = GNUNET_YES;
+        send_data ( &test_too_long_ident, host_str);
+        GNUNET_free (host_str);
+        return;
     }
     if (test_valid_ident.test_executed == GNUNET_NO)
       {
-       struct GNUNET_CRYPTO_HashAsciiEncoded ident;
-       GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
-       GNUNET_asprintf (&host_str, 
-                        "%s://%s/%s%s",
-                        PROTOCOL_PREFIX, 
-                        test_addr,
-                        (char *) &ident,
-                        ";0");
-       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                   _("Connecting to peer with valid peer identification.\n"));
-       test_valid_ident.test_executed = GNUNET_YES;
-       send_data ( &test_valid_ident, host_str);
-       GNUNET_free (host_str);
-       return;
+        struct GNUNET_CRYPTO_HashAsciiEncoded ident;
+        GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
+        GNUNET_asprintf (&host_str,
+                         "%s://%s/%s%s",
+                         PROTOCOL_PREFIX,
+                         test_addr,
+                         (char *) &ident,
+                         ";0");
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    _("Connecting to peer with valid peer identification.\n"));
+        test_valid_ident.test_executed = GNUNET_YES;
+        send_data ( &test_valid_ident, host_str);
+        GNUNET_free (host_str);
+        return;
       }
   }
   if (phase==1)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "\nPhase 1: transmit data to all suggested addresses\n\n");
+                  "\nPhase 1: transmit data to all suggested addresses\n\n");
       /* Using one of the addresses the plugin proposed */
       GNUNET_assert (addr_head->addr != NULL);
       
@@ -1084,41 +1092,41 @@ run_connection_tests( int phase , void * cls)
       
       int count = 0;
       while (tmp_addr != NULL)
-       {
-         if (tmp_addr->addrlen == (sizeof (struct IPv4HttpAddress)))
-           {
-             inet_ntop(AF_INET, (struct in_addr *) tmp_addr->addr,address,INET_ADDRSTRLEN);
-             port = ntohs(((struct IPv4HttpAddress *) tmp_addr->addr)->u_port);
-             GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                         "Sending message to addres no. %u: `%s':%u\n", 
-                         count,
-                         address, 
-                         port);
-           }
-         if (tmp_addr->addrlen == (sizeof (struct IPv6HttpAddress)))
-           {
-             inet_ntop(AF_INET6, (struct in6_addr *) tmp_addr->addr,address,INET6_ADDRSTRLEN);
-             port = ntohs(((struct IPv6HttpAddress *) tmp_addr->addr)->u6_port);
-             GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                         "Sending message to addres no. %u: `%s':%u\n", 
-                         count,
-                         address,
-                         port);
-           }
-         msg.type=htons(type);
-         memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader));
-         api->send(api->cls,
-                   &my_identity, 
-                   tmp, sizeof(struct GNUNET_MessageHeader), 
-                   0, TIMEOUT, 
-                   NULL, 
-                   tmp_addr->addr, tmp_addr->addrlen, 
-                   GNUNET_YES, 
-                   &task_send_cont, &fail_msgs_transmited_to_local_addrs);
-         tmp_addr = tmp_addr->next;      
-         count++;
-         type++;
-       }
+        {
+          if (tmp_addr->addrlen == (sizeof (struct IPv4HttpAddress)))
+            {
+              inet_ntop(AF_INET, (struct in_addr *) tmp_addr->addr,address,INET_ADDRSTRLEN);
+              port = ntohs(((struct IPv4HttpAddress *) tmp_addr->addr)->u_port);
+              GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                          "Sending message to addres no. %u: `%s':%u\n",
+                          count,
+                          address,
+                          port);
+            }
+          if (tmp_addr->addrlen == (sizeof (struct IPv6HttpAddress)))
+            {
+              inet_ntop(AF_INET6, (struct in6_addr *) tmp_addr->addr,address,INET6_ADDRSTRLEN);
+              port = ntohs(((struct IPv6HttpAddress *) tmp_addr->addr)->u6_port);
+              GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                          "Sending message to addres no. %u: `%s':%u\n",
+                          count,
+                          address,
+                          port);
+            }
+          msg.type=htons(type);
+          memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader));
+          api->send(api->cls,
+                    &my_identity,
+                    tmp, sizeof(struct GNUNET_MessageHeader),
+                    0, TIMEOUT,
+                    NULL,
+                    tmp_addr->addr, tmp_addr->addrlen,
+                    GNUNET_YES,
+                    &task_send_cont, &fail_msgs_transmited_to_local_addrs);
+          tmp_addr = tmp_addr->next;
+          count++;
+          type++;
+        }
       GNUNET_free(tmp);
       return;
     }
@@ -1129,32 +1137,32 @@ run_connection_tests( int phase , void * cls)
       msg = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader));
       
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                 "Phase 2: session selection\n\n");
+                  "Phase 2: session selection\n\n");
       size = sizeof(struct GNUNET_MessageHeader);
       msg->size=htons(size);
       msg->type = htons(20);
       api->send(api->cls, 
-               &my_identity,
-               (const char *) msg, size, 
-               0, TIMEOUT, NULL, NULL, 0, GNUNET_NO, 
-               &task_send_cont, NULL);
+                &my_identity,
+                (const char *) msg, size,
+                0, TIMEOUT, NULL, NULL, 0, GNUNET_NO,
+                &task_send_cont, NULL);
       
       msg->type = htons(21);
       api->send(api->cls, 
-               &my_identity,
-               (const char *) msg, size, 
-               0, TIMEOUT, NULL, NULL, 0, GNUNET_SYSERR,
-               &task_send_cont, NULL);
+                &my_identity,
+                (const char *) msg, size,
+                0, TIMEOUT, NULL, NULL, 0, GNUNET_SYSERR,
+                &task_send_cont, NULL);
       
       /* answer on session*/
       size = sizeof( struct GNUNET_MessageHeader);
       msg->size = htons(size);
       msg->type = htons(22);
       api->send(api->cls, 
-               &my_identity,
-               (const char *) msg, size,
-               0, TIMEOUT, session, NULL, 0, GNUNET_SYSERR, 
-               &task_send_cont, NULL);      
+                &my_identity,
+                (const char *) msg, size,
+                0, TIMEOUT, session, NULL, 0, GNUNET_SYSERR,
+                &task_send_cont, NULL);
       GNUNET_free(msg);
       
       /* answer on session with big message not fitting in mhd send buffer*/
@@ -1163,10 +1171,10 @@ run_connection_tests( int phase , void * cls)
       msg->size=htons(size);
       msg->type = htons(23);
       api->send(api->cls,
-               &my_identity,
-               (const char *) msg, size,
-               0, TIMEOUT, session, NULL, 0, GNUNET_NO, 
-               &task_send_cont, NULL);
+                &my_identity,
+                (const char *) msg, size,
+                0, TIMEOUT, session, NULL, 0, GNUNET_NO,
+                &task_send_cont, NULL);
       GNUNET_free(msg);
       return;
     }
@@ -1175,7 +1183,7 @@ run_connection_tests( int phase , void * cls)
     {
       
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-               "Phase 3: send multiple or big messages after disconnect\n\n");
+                "Phase 3: send multiple or big messages after disconnect\n\n");
     /* disconnect from peer, so new connections are created */
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Disconnect from peer: `%s'\n", GNUNET_i2s(&my_identity));
     api->disconnect(api->cls, &my_identity);
@@ -1190,12 +1198,12 @@ run_connection_tests( int phase , void * cls)
     msg2->size = htons(2 * sizeof(struct GNUNET_MessageHeader));
     msg2->type = htons(31);
     api->send(api->cls,
-             &my_identity, 
-             (const char *) msg, 4 * sizeof(struct GNUNET_MessageHeader), 
-             0, TIMEOUT, NULL, 
-             addr_head->addr, addr_head->addrlen, 
-             GNUNET_NO,
-             &task_send_cont, &fail_multiple_msgs_in_transmission);
+              &my_identity,
+              (const char *) msg, 4 * sizeof(struct GNUNET_MessageHeader),
+              0, TIMEOUT, NULL,
+              addr_head->addr, addr_head->addrlen,
+              GNUNET_NO,
+              &task_send_cont, &fail_multiple_msgs_in_transmission);
     GNUNET_free(msg);
     /* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE-1  */
 
@@ -1204,15 +1212,15 @@ run_connection_tests( int phase , void * cls)
     msg->size = htons(size);
     msg->type = htons(32);
     api->send(api->cls,
-             &my_identity, 
-             (const char *) msg, size,
-             0, TIMEOUT, NULL,
-             addr_head->addr, addr_head->addrlen, 
-             GNUNET_NO, 
-             &task_send_cont, &fail_msg_transmited_max_size);
+              &my_identity,
+              (const char *) msg, size,
+              0, TIMEOUT, NULL,
+              addr_head->addr, addr_head->addrlen,
+              GNUNET_NO,
+              &task_send_cont, &fail_msg_transmited_max_size);
     GNUNET_free(msg);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "No more tests to run\n");
+                "No more tests to run\n");
   }
 }
 
@@ -1252,6 +1260,9 @@ run (void *cls,
   addr_head = NULL;
   count_str_addr = 0;
   /* parse configuration */
+  if (GNUNET_CONFIGURATION_have_value (c,"PATHS", "SERVICEHOME"))
+      GNUNET_CONFIGURATION_get_value_string (c, "PATHS", "SERVICEHOME", &servicehome);
+
   if ((GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_number (c,
                                               "TRANSPORT",
@@ -1305,8 +1316,8 @@ run (void *cls,
   setup_plugin_environment ();
   GNUNET_asprintf (&libname, "libgnunet_plugin_transport_http");
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, 
-             _("Loading HTTP transport plugin `%s'\n"),
-             libname);
+              _("Loading HTTP transport plugin `%s'\n"),
+              libname);
   api = GNUNET_PLUGIN_load (libname, &env);
   GNUNET_free (libname);
   if (api == NULL)
@@ -1323,16 +1334,16 @@ run (void *cls,
   /* testing plugin functionality */
   GNUNET_assert (0!=fail_notify_address_count);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-             "Transport plugin returned %u addresses to connect to\n", 
-             fail_notify_address_count);
+              "Transport plugin returned %u addresses to connect to\n",
+              fail_notify_address_count);
 
   /* testing pretty printer with all addresses obtained from the plugin*/
   cur = addr_head;
   while (cur != NULL)
   {
     api->address_pretty_printer (api->cls, "http",
-                                cur->addr,cur->addrlen, GNUNET_NO,TEST_TIMEOUT, 
-                                &pretty_printer_cb, NULL);
+                                 cur->addr,cur->addrlen, GNUNET_NO,TEST_TIMEOUT,
+                                 &pretty_printer_cb, NULL);
     addr_str = api->address_to_string (api->cls, cur->addr, cur->addrlen);
     suggest_res = api->check_address (api->cls, cur->addr, cur->addrlen);
 
@@ -1434,13 +1445,26 @@ main (int argc, char *const *argv)
 #endif
                     NULL);
 
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg, "test_plugin_transport_data_http.conf"));
+  if (GNUNET_CONFIGURATION_have_value (cfg,"PATHS", "SERVICEHOME"))
+      GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME", &servicehome);
+  GNUNET_DISK_directory_remove (servicehome);
+  GNUNET_CONFIGURATION_destroy (cfg);
+
   ret = (GNUNET_OK ==
          GNUNET_PROGRAM_run (5,
                              argv_prog,
                              "test_gnunet_transport_plugin_http",
                              "testcase", options, &run, NULL)) ? GNUNET_NO : GNUNET_YES;
 
-  GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http");
+  if (servicehome != NULL)
+  {
+    GNUNET_DISK_directory_remove (servicehome);
+    GNUNET_free (servicehome);
+  }
   if (ret != GNUNET_OK)
     return 1;
   return fail;