gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libebics] branch master updated: Fix response code extract


From: gnunet
Subject: [GNUnet-SVN] [libebics] branch master updated: Fix response code extraction.
Date: Wed, 24 Oct 2018 13:06:12 +0200

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

marcello pushed a commit to branch master
in repository libebics.

The following commit(s) were added to refs/heads/master by this push:
     new 990b0a9  Fix response code extraction.
990b0a9 is described below

commit 990b0a9a97552e33ddf96c051facbf515242c3cf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Oct 24 13:05:14 2018 +0200

    Fix response code extraction.
    
    Plus eliminating suerfluous type definition for HTTP callbacks.
---
 src/libebics.c      | 28 +++++++++++++++++++++-------
 src/libebics.h      | 17 +++--------------
 src/sandbox_tests.c |  3 ++-
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/src/libebics.c b/src/libebics.c
index 544a061..e025c6a 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -655,13 +655,17 @@ parse_response (struct GNUNET_CURL_DownloadBuffer *db,
 {
   xmlParserCtxtPtr parser;
   xmlDocPtr doc = NULL;
-  http_status = 0;
   job = NULL;
 
   /* Trying status code extraction anyway. */
   curl_easy_getinfo (eh,
                      CURLINFO_RESPONSE_CODE,
-                     &http_status);
+                     http_status);
+
+  LOG (EBICS_LOGLEVEL_DEBUG,
+       "Raw response: '%.*s'\n",
+       (int) db->buf_size,
+       (char *) db->buf);
 
   if (0 == db->eno)
   {
@@ -786,6 +790,10 @@ EBICS_init_library (const char *key_dir,
     (NULL != (custom_headers = curl_slist_append
       (NULL,
        "Content-Type: text/xml")));
+  GNUNET_assert
+    (NULL != (custom_headers = curl_slist_append
+      (custom_headers,
+       "Expect:")));
 
   GNUNET_assert (NULL != reschedule_ctx);
   GNUNET_assert (NULL != ctx);
@@ -1067,7 +1075,7 @@ process_response (void *cls,
 int
 EBICS_send_message (const struct EBICS_genex_document *document,
                     const char *url,
-                    EBICS_ResponseCallback cb)
+                    GNUNET_CURL_JobCompletionCallback cb)
 {
 
   int size;
@@ -1118,17 +1126,23 @@ EBICS_send_message (const struct EBICS_genex_document 
*document,
           CURLOPT_HTTPHEADER,
           custom_headers);
 
-  #ifdef BENEVOLENT
   SETOPT (eh,
           CURLOPT_SSL_VERIFYPEER,
-          0L);
+  #ifdef BENEVOLENT
+          0L
+  #else
+          1L
   #endif
+          );
 
-  #ifdef EXTRA_BENEVOLENT
   SETOPT (eh,
           CURLOPT_SSL_VERIFYHOST,
-          0L);
+  #ifdef EXTRA_BENEVOLENT
+          0L
+  #else
+          1L
   #endif
+          );
 
   xmlFree (buf);
 
diff --git a/src/libebics.h b/src/libebics.h
index 06370f9..1579213 100644
--- a/src/libebics.h
+++ b/src/libebics.h
@@ -27,6 +27,8 @@
 #include <stdio.h>
 #include <fts.h>
 #include <zlib.h>
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_curl_lib.h>
 
 #define DEBUG EBICS_LOGLEVEL_DEBUG
 
@@ -147,19 +149,6 @@ EBICS_generate_message_camt053
   (struct EBICS_ARGS_build_header *header_args,
    struct EBICS_ARGS_build_content_camt053 *camt053_args);
 
-
-/**
- * Callback used to process the response of a bank.
- * 
- * @param cls closure
- * @param response_code HTTP response code
- * @param response response object - no need to free.
- */
-typedef void
-(*EBICS_ResponseCallback) (void *cls,
-                           long response_code,
-                           const void *response);
-
 /**
  * Prepare and POSTs a EBICS HTTPS message to the bank.
  *
@@ -171,6 +160,6 @@ typedef void
 int
 EBICS_send_message (const struct EBICS_genex_document *document,
                     const char *url,
-                    EBICS_ResponseCallback cb);
+                    GNUNET_CURL_JobCompletionCallback cb);
 
 #endif
diff --git a/src/sandbox_tests.c b/src/sandbox_tests.c
index dc2d6b6..d382105 100644
--- a/src/sandbox_tests.c
+++ b/src/sandbox_tests.c
@@ -32,6 +32,7 @@
 
 
 #define KEYS_DIR "./test_keys"
+// #define BANK_URL "http://127.0.0.1:4444/";
 #define BANK_URL 
"https://server-ebics.webank.fr:28103/WbkPortalFileTransfert/EbicsProtocol";
 #define E001_DIGEST "9BF804AF2B121A5B94C82BFD8E406FFB18024D3D4BF9E"
 #define X001_DIGEST "9BF804AF2B121A5B94C82BFD8E406FFB18024D3D4BF9E"
@@ -56,7 +57,7 @@ cb (void *cls,
   xmlDocPtr doc = (xmlDocPtr) response;
 
   LOG (EBICS_LOGLEVEL_INFO,
-       "Bank responded (%d)\n",
+       "Bank responded (%ld)\n",
        response_code);
 
   GNUNET_SCHEDULER_shutdown ();

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



reply via email to

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