gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-twister] branch master updated: 5724: remove duplica


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] branch master updated: 5724: remove duplications.
Date: Mon, 03 Jun 2019 21:08:16 +0200

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

marcello pushed a commit to branch master
in repository twister.

The following commit(s) were added to refs/heads/master by this push:
     new 23e09bc  5724: remove duplications.
23e09bc is described below

commit 23e09bc8bf0a8a7b00703220b3fff4a0d084d4fe
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Jun 3 21:07:55 2019 +0200

    5724: remove duplications.
---
 src/twister/taler-twister-service.c | 97 ++++++++++---------------------------
 1 file changed, 25 insertions(+), 72 deletions(-)

diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index 7247daa..af2551b 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -1516,11 +1516,15 @@ create_response (void *cls,
     }
 
     /* No need to check whether we're POSTing or PUTting.
-     * If not needed, this value will just be ignored.*/
+     * If not needed, one of the following values will be
+     * ignored.*/
     curl_easy_setopt (hr->curl,
                       CURLOPT_POSTFIELDSIZE,
                      hr->io_len);
     curl_easy_setopt (hr->curl,
+                      CURLOPT_INFILESIZE,
+                     hr->io_len);
+    curl_easy_setopt (hr->curl,
                       CURLOPT_HEADERFUNCTION,
                       &curl_check_hdr);
     curl_easy_setopt (hr->curl,
@@ -1544,6 +1548,22 @@ create_response (void *cls,
     curl_easy_setopt (hr->curl,
                      CURLOPT_VERBOSE,
                      0);
+
+    curl_easy_setopt (hr->curl,
+                      CURLOPT_READFUNCTION,
+                      &curl_upload_cb);
+
+    curl_easy_setopt (hr->curl,
+                      CURLOPT_READDATA,
+                      hr);
+
+    curl_easy_setopt (hr->curl,
+                      CURLOPT_WRITEFUNCTION,
+                      &curl_download_cb);
+
+    curl_easy_setopt (hr->curl,
+                      CURLOPT_WRITEDATA,
+                      hr);
     {
       char *curlurl;
 
@@ -1559,6 +1579,7 @@ create_response (void *cls,
                   curlurl);
       GNUNET_free (curlurl);
     }
+
     if (0 == strcasecmp (meth,
                         MHD_HTTP_METHOD_PUT))
     {
@@ -1566,38 +1587,11 @@ create_response (void *cls,
                   "Crafting a CURL PUT request\n");
 
       curl_easy_setopt (hr->curl,
-                       CURLOPT_UPLOAD,
+                       CURLOPT_PUT,
                        1L);
-      curl_easy_setopt (hr->curl,
-                        CURLOPT_READFUNCTION,
-                        &curl_upload_cb);
+
       hr->state = REQUEST_STATE_PROXY_UPLOAD_STARTED;
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_READDATA,
-                       hr);
-      {
-        const char *us;
-        long upload_size;
-
-        us = MHD_lookup_connection_value
-          (con,
-           MHD_HEADER_KIND,
-           MHD_HTTP_HEADER_CONTENT_LENGTH);
-
-        if ( (1 == sscanf (us,
-                           "%ld",
-                           &upload_size)) &&
-             (upload_size >= 0) )
-          curl_easy_setopt (hr->curl,
-                            CURLOPT_INFILESIZE,
-                            upload_size);
-      }
-      curl_easy_setopt (hr->curl,
-                        CURLOPT_WRITEFUNCTION,
-                        &curl_download_cb);
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_WRITEDATA,
-                       hr);
+
     }
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_POST))
@@ -1613,42 +1607,7 @@ create_response (void *cls,
                         CURLOPT_VERBOSE,
                         1L);
       hr->state = REQUEST_STATE_PROXY_UPLOAD_STARTED;
-      GNUNET_assert
-        (CURLE_OK == curl_easy_setopt
-          (hr->curl,
-           CURLOPT_READFUNCTION,
-           &curl_upload_cb));
-
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_READDATA,
-                       hr);
-      {
-        const char *us;
-        long upload_size;
-
-        us = MHD_lookup_connection_value
-          (con,
-           MHD_HEADER_KIND,
-           MHD_HTTP_HEADER_CONTENT_LENGTH);
-
-        if ( (1 == sscanf (us,
-                           "%ld",
-                           &upload_size)) &&
-             (upload_size >= 0) )
-        {
-          curl_easy_setopt (hr->curl,
-                            CURLOPT_INFILESIZE,
-                            upload_size);
-        }
-      }
-
-      curl_easy_setopt (hr->curl,
-                        CURLOPT_WRITEFUNCTION,
-                        &curl_download_cb);
 
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_WRITEDATA,
-                       hr);
     }
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_HEAD))
@@ -1673,12 +1632,6 @@ create_response (void *cls,
       curl_easy_setopt (hr->curl,
                        CURLOPT_HTTPGET,
                        1L);
-      curl_easy_setopt (hr->curl,
-                        CURLOPT_WRITEFUNCTION,
-                        &curl_download_cb);
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_WRITEDATA,
-                       hr);
     }
     else
     {

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



reply via email to

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