gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-twister] 01/04: Make sure that upload cb is register


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] 01/04: Make sure that upload cb is registered with assert.
Date: Sun, 03 Jun 2018 21:13:27 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository twister.

commit e01669953d7a8e82a505fca2308e57e971d43c67
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed May 30 20:48:26 2018 +0200

    Make sure that upload cb is registered with assert.
---
 src/test/test_twister_webserver.c   | 30 +++++++++++++++---------------
 src/twister/taler-twister-service.c | 35 +++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/src/test/test_twister_webserver.c 
b/src/test/test_twister_webserver.c
index 7616e1e..bf32fcf 100644
--- a/src/test/test_twister_webserver.c
+++ b/src/test/test_twister_webserver.c
@@ -1,22 +1,22 @@
 /*
-     This file is part of Taler.
-     Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V.
-     Copyright (C) 2018 Taler Systems SA
+  This file is part of Taler.
+  Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V.
+  Copyright (C) 2018 Taler Systems SA
 
-     Taler is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as
-     published by the Free Software Foundation; either version 3,
-     or (at your option) any later version.
+  Taler is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3,
+  or (at your option) any later version.
 
-     Taler is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-     GNU General Public License for more details.
+  Taler is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-     You should have received a copy of the GNU General Public
-     License along with Taler; see the file COPYING.  If not,
-     write to the Free Software Foundation, Inc., 51 Franklin
-     Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  You should have received a copy of the GNU General Public
+  License along with Taler; see the file COPYING.  If not,
+  write to the Free Software Foundation, Inc., 51 Franklin
+  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
 /**
diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index 003e2f8..276b514 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -499,8 +499,7 @@ curl_upload_cb (void *buf,
   size_t to_copy;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Uploader cb, size: %u.\n",
-              (unsigned int) size);
+              "Upload cb is working...\n");
 
   if (REQUEST_STATE_UPLOAD_STARTED != hr->state)
   {
@@ -1155,7 +1154,7 @@ create_response (void *cls,
     return MHD_YES;
   }
 
-  /* Upload (from the *client*) finished,
+  /* Upload (*from the client*) finished,
    * generate curl request to the proxied service.  */
   if (NULL == hr->curl)
   {
@@ -1294,9 +1293,11 @@ create_response (void *cls,
         const char *us;
         long upload_size;
 
-        us = MHD_lookup_connection_value (con,
-                                          MHD_HEADER_KIND,
-                                          MHD_HTTP_HEADER_CONTENT_LENGTH);
+        us = MHD_lookup_connection_value
+          (con,
+           MHD_HEADER_KIND,
+           MHD_HTTP_HEADER_CONTENT_LENGTH);
+
         if ( (1 == sscanf (us,
                            "%ld",
                            &upload_size)) &&
@@ -1315,13 +1316,20 @@ create_response (void *cls,
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_POST))
     {
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Crafting a CURL POST request\n");
+
       hr->state = REQUEST_STATE_UPLOAD_STARTED;
       curl_easy_setopt (hr->curl,
                        CURLOPT_POST,
                        1L);
-      curl_easy_setopt (hr->curl,
-                        CURLOPT_READFUNCTION,
-                        &curl_upload_cb);
+      GNUNET_assert
+        (CURLE_OK == curl_easy_setopt
+          (hr->curl,
+           CURLOPT_READFUNCTION,
+           &curl_upload_cb));
+
       curl_easy_setopt (hr->curl,
                        CURLOPT_READDATA,
                        hr);
@@ -1329,9 +1337,11 @@ create_response (void *cls,
         const char *us;
         long upload_size;
 
-        us = MHD_lookup_connection_value (con,
-                                          MHD_HEADER_KIND,
-                                          MHD_HTTP_HEADER_CONTENT_LENGTH);
+        us = MHD_lookup_connection_value
+          (con,
+           MHD_HEADER_KIND,
+           MHD_HTTP_HEADER_CONTENT_LENGTH);
+
         if ( (1 == sscanf (us,
                            "%ld",
                            &upload_size)) &&
@@ -1342,6 +1352,7 @@ create_response (void *cls,
                             upload_size);
         }
       }
+
       curl_easy_setopt (hr->curl,
                         CURLOPT_WRITEFUNCTION,
                         &curl_download_cb);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]