gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (10931144 -> c8b7b8fe)


From: gnunet
Subject: [libmicrohttpd] branch master updated (10931144 -> c8b7b8fe)
Date: Wed, 08 Jun 2022 15:54:09 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 10931144 test_str: fixed code style
     new 72e6f27f MHD_queue_basic_auth_fail_response3(): new function for RFC 
7617 support
     new 929e0462 MHD_basic_auth_get_username_password3(): added new public API 
function
     new c8b7b8fe test_basicauth: added two additional tests for the new API

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/microhttpd.h      |  83 ++++++++++++++++++++-
 src/microhttpd/basicauth.c    | 170 +++++++++++++++++++++++++++++++++++++++---
 src/testcurl/.gitignore       |   2 +
 src/testcurl/Makefile.am      |   9 ++-
 src/testcurl/test_basicauth.c | 156 +++++++++++++++++++++++++++++---------
 5 files changed, 370 insertions(+), 50 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d6445b77..ada9af5d 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097515
+#define MHD_VERSION 0x00097517
 
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t',
@@ -4633,6 +4633,52 @@ MHD_queue_auth_fail_response (struct MHD_Connection 
*connection,
                               int signal_stale);
 
 
+/**
+ * Information decoded from Basic Authentication client's header.
+ *
+ * The username and the password are technically allowed to have binary zeros,
+ * username_len and password_len could be used to detect such situations.
+ *
+ * The buffers pointed by username and password members are freed
+ * when #MHD_free() is called for pointer to this structure.
+ *
+ * Application may modify buffers as needed until #MHD_free() is called for
+ * pointer to this structure
+ */
+struct MHD_BasicAuthInfo
+{
+  /**
+   * The username, cannot be NULL
+   */
+  char *username;
+  /**
+   * The length of the @a username, not including zero-termination
+   */
+  size_t username_len;
+  /**
+   * The password, may be NULL if password is not encoded by the client
+   */
+  char *password;
+  /**
+   * The length of the @a password, not including zero-termination
+   */
+  size_t password_len;
+};
+
+/**
+ * Get the username and password from the Basic Authorisation header
+ * sent by the client
+ *
+ * @param connection the MHD connection structure
+ * @return NULL not valid Basic Authentication header is present in
+ *         current request, or pointer to structure with username and
+ *         password, which must be freed by #MHD_free().
+ * @note Available since #MHD_VERSION 0x00097517
+ * @ingroup authentication
+ */
+_MHD_EXTERN struct MHD_BasicAuthInfo *
+MHD_basic_auth_get_username_password3 (struct MHD_Connection *connection);
+
 /**
  * Get the username and password from the basic authorization header sent by 
the client
  *
@@ -4640,6 +4686,7 @@ MHD_queue_auth_fail_response (struct MHD_Connection 
*connection,
  * @param[out] password a pointer for the password, free using #MHD_free().
  * @return NULL if no username could be found, a pointer
  *      to the username if found, free using #MHD_free().
+ * @deprecated use #MHD_basic_auth_get_username_password3()
  * @ingroup authentication
  */
 _MHD_EXTERN char *
@@ -4647,6 +4694,39 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
                                       char **password);
 
 
+/**
+ * Queues a response to request basic authentication from the client.
+ *
+ * The given response object is expected to include the payload for
+ * the response; the "WWW-Authenticate" header will be added and the
+ * response queued with the 'UNAUTHORIZED' status code.
+ *
+ * See RFC 7617#section-2 for details.
+ *
+ * The @a response is modified by this function. The modified response object
+ * can be used to respond subsequent requests by #MHD_queue_response()
+ * function with status code #MHD_HTTP_UNAUTHORIZED and must not be used again
+ * with MHD_queue_basic_auth_fail_response3() function. The response could
+ * be destroyed right after call of this function.
+ *
+ * @param connection the MHD connection structure
+ * @param realm the realm presented to the client
+ * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ *                    be added, indicating for client that UTF-8 encoding
+ *                    is preferred
+ * @param response the response object to modify and queue; the NULL
+ *                 is tolerated
+ * @return #MHD_YES on success, #MHD_NO otherwise
+ * @note Available since #MHD_VERSION 0x00097516
+ * @ingroup authentication
+ */
+_MHD_EXTERN enum MHD_Result
+MHD_queue_basic_auth_fail_response3 (struct MHD_Connection *connection,
+                                     const char *realm,
+                                     int prefer_utf8,
+                                     struct MHD_Response *response);
+
+
 /**
  * Queues a response to request basic authentication from the client
  * The given response object is expected to include the payload for
@@ -4657,6 +4737,7 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
  * @param realm the realm presented to the client
  * @param response response object to modify and queue; the NULL is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
+ * @deprecated use MHD_queue_basic_auth_fail_response3()
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index 5151dc03..fb7bed0f 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -55,6 +55,97 @@ get_rq_bauth_params (struct MHD_Connection *connection)
 }
 
 
+/**
+ * Get the username and password from the Basic Authorisation header
+ * sent by the client
+ *
+ * @param connection the MHD connection structure
+ * @return NULL not valid Basic Authentication header is present in
+ *         current request, or pointer to structure with username and
+ *         password, which must be freed by #MHD_free().
+ * @note Available since #MHD_VERSION 0x00097517
+ * @ingroup authentication
+ */
+_MHD_EXTERN struct MHD_BasicAuthInfo *
+MHD_basic_auth_get_username_password3 (struct MHD_Connection *connection)
+{
+  const struct MHD_RqBAuth *params;
+  char *decoded;
+  size_t decoded_len;
+  struct MHD_BasicAuthInfo *ret;
+  size_t username_len;
+  char *colon;
+  size_t password_pos;
+  size_t password_len;
+
+  params = get_rq_bauth_params (connection);
+
+  if (NULL == params)
+    return NULL;
+
+  if ((NULL == params->token68.str) || (0 == params->token68.len))
+    return NULL;
+
+  decoded = BASE64Decode (params->token68.str, params->token68.len,
+                          &decoded_len);
+  if ((NULL == decoded) || (0 == decoded_len))
+  {
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (connection->daemon,
+              _ ("Error decoding Basic Authorization authentication.\n"));
+#endif /* HAVE_MESSAGES */
+    if (NULL != decoded)
+      free (decoded);
+    return NULL;
+  }
+  colon = memchr (decoded, ':', decoded_len);
+  if (NULL != colon)
+  {
+    username_len = (size_t) (colon - decoded);
+    password_pos = username_len + 1;
+    password_len = decoded_len - password_pos;
+  }
+  else
+    username_len = decoded_len;
+
+  ret = (struct MHD_BasicAuthInfo *) malloc (sizeof(struct MHD_BasicAuthInfo)
+                                             + decoded_len + 1);
+  if (NULL == ret)
+  {
+    free (decoded);
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (connection->daemon,
+              _ ("Failed to allocate memory to process " \
+                 "Basic Authorization authentication.\n"));
+#endif /* HAVE_MESSAGES */
+    return NULL;
+  }
+
+  ret->username = (char *) (ret + 1);
+  memcpy (ret->username, decoded, decoded_len);
+  free (decoded);
+  ret->username[username_len] = 0; /* Zero-terminate the string */
+  ret->username_len = username_len;
+  if (NULL != colon)
+  {
+    mhd_assert (decoded_len >= password_pos);
+    mhd_assert (decoded_len > password_pos || 0 == password_len);
+    mhd_assert (decoded_len > password_len);
+    mhd_assert (decoded_len > username_len);
+    ret->password = ret->username + password_pos;
+    ret->password[password_len] = 0; /* Zero-terminate the string */
+    ret->password_len = password_len;
+  }
+  else
+  {
+    ret->password = NULL;
+    ret->password_len = 0;
+  }
+
+  return ret;
+}
+
+
 /**
  * Get the username and password from the basic authorization header sent by 
the client
  *
@@ -62,6 +153,7 @@ get_rq_bauth_params (struct MHD_Connection *connection)
  * @param[out] password a pointer for the password, free using #MHD_free().
  * @return NULL if no username could be found, a pointer
  *      to the username if found, free using #MHD_free().
+ * @deprecated use #MHD_basic_auth_get_username_password3()
  * @ingroup authentication
  */
 _MHD_EXTERN char *
@@ -135,28 +227,47 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
 
 
 /**
- * Queues a response to request basic authentication from the client
+ * Queues a response to request basic authentication from the client.
+ *
  * The given response object is expected to include the payload for
  * the response; the "WWW-Authenticate" header will be added and the
  * response queued with the 'UNAUTHORIZED' status code.
  *
- * @param connection The MHD connection structure
+ * See RFC 7617#section-2 for details.
+ *
+ * The @a response is modified by this function. The modified response object
+ * can be used to respond subsequent requests by #MHD_queue_response()
+ * function with status code #MHD_HTTP_UNAUTHORIZED and must not be used again
+ * with MHD_queue_basic_auth_fail_response3() function. The response could
+ * be destroyed right after call of this function.
+ *
+ * @param connection the MHD connection structure
  * @param realm the realm presented to the client
- * @param response response object to modify and queue; the NULL is tolerated
+ * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ *                    be added, indicating for client that UTF-8 encoding
+ *                    is preferred
+ * @param response the response object to modify and queue; the NULL
+ *                 is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
+ * @note Available since #MHD_VERSION 0x00097516
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
-MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
-                                    const char *realm,
-                                    struct MHD_Response *response)
+MHD_queue_basic_auth_fail_response3 (struct MHD_Connection *connection,
+                                     const char *realm,
+                                     int prefer_utf8,
+                                     struct MHD_Response *response)
 {
-  enum MHD_Result ret;
-  char *h_str;
   static const char prefix[] = "Basic realm=\"";
+  static const char suff_charset[] = "\", charset=\"UTF-8\"";
   static const size_t prefix_len = MHD_STATICSTR_LEN_ (prefix);
-  static const size_t suffix_len = MHD_STATICSTR_LEN_ ("\"");
+  static const size_t suff_simple_len = MHD_STATICSTR_LEN_ ("\"");
+  static const size_t suff_charset_len =
+    MHD_STATICSTR_LEN_ (suff_charset);
+  enum MHD_Result ret;
+  char *h_str;
   size_t h_maxlen;
+  size_t suffix_len;
   size_t realm_len;
   size_t realm_quoted_len;
   size_t pos;
@@ -164,8 +275,10 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
   if (NULL == response)
     return MHD_NO;
 
+  suffix_len = (0 == prefer_utf8) ? suff_simple_len : suff_charset_len;
   realm_len = strlen (realm);
   h_maxlen = prefix_len + realm_len * 2 + suffix_len;
+
   h_str = (char *) malloc (h_maxlen + 1);
   if (NULL == h_str)
   {
@@ -181,9 +294,19 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
                                     h_maxlen - prefix_len - suffix_len);
   pos += realm_quoted_len;
   mhd_assert (pos + suffix_len <= h_maxlen);
-  h_str[pos++] = '\"';
-  h_str[pos++] = 0; /* Zero terminate the result */
-  mhd_assert (pos <= h_maxlen + 1);
+  if (0 == prefer_utf8)
+  {
+    h_str[pos++] = '\"';
+    h_str[pos++] = 0; /* Zero terminate the result */
+    mhd_assert (pos <= h_maxlen + 1);
+  }
+  else
+  {
+    /* Copy with the final zero-termination */
+    mhd_assert (pos + suff_charset_len <= h_maxlen);
+    memcpy (h_str + pos, suff_charset, suff_charset_len + 1);
+    mhd_assert (0 == h_str[pos + suff_charset_len]);
+  }
 
   ret = MHD_add_response_header (response,
                                  MHD_HTTP_HEADER_WWW_AUTHENTICATE,
@@ -206,4 +329,27 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
 }
 
 
+/**
+ * Queues a response to request basic authentication from the client
+ * The given response object is expected to include the payload for
+ * the response; the "WWW-Authenticate" header will be added and the
+ * response queued with the 'UNAUTHORIZED' status code.
+ *
+ * @param connection The MHD connection structure
+ * @param realm the realm presented to the client
+ * @param response response object to modify and queue; the NULL is tolerated
+ * @return #MHD_YES on success, #MHD_NO otherwise
+ * @deprecated use MHD_queue_basic_auth_fail_response3()
+ * @ingroup authentication
+ */
+_MHD_EXTERN enum MHD_Result
+MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
+                                    const char *realm,
+                                    struct MHD_Response *response)
+{
+  return MHD_queue_basic_auth_fail_response3 (connection, realm, MHD_NO,
+                                              response);
+}
+
+
 /* end of basicauth.c */
diff --git a/src/testcurl/.gitignore b/src/testcurl/.gitignore
index cf6a4bc3..f3ffee14 100644
--- a/src/testcurl/.gitignore
+++ b/src/testcurl/.gitignore
@@ -153,3 +153,5 @@ core
 /test_basicauth
 /test_parse_cookies_invalid
 /test_basicauth_preauth
+/test_basicauth_oldapi
+/test_basicauth_preauth_oldapi
\ No newline at end of file
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am
index aeeabb6b..3bf81e7d 100644
--- a/src/testcurl/Makefile.am
+++ b/src/testcurl/Makefile.am
@@ -153,7 +153,8 @@ endif
 
 if ENABLE_BAUTH
 check_PROGRAMS += \
-  test_basicauth test_basicauth_preauth
+  test_basicauth test_basicauth_preauth \
+  test_basicauth_oldapi test_basicauth_preauth_oldapi
 endif
 
 if HAVE_POSTPROCESSOR
@@ -239,6 +240,12 @@ test_basicauth_SOURCES = \
 test_basicauth_preauth_SOURCES = \
   test_basicauth.c
 
+test_basicauth_oldapi_SOURCES = \
+  test_basicauth.c
+
+test_basicauth_preauth_oldapi_SOURCES = \
+  test_basicauth.c
+
 test_digestauth_SOURCES = \
   test_digestauth.c
 test_digestauth_LDADD = \
diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c
index c7f1df84..e95047dd 100644
--- a/src/testcurl/test_basicauth.c
+++ b/src/testcurl/test_basicauth.c
@@ -251,6 +251,7 @@ struct CBC
 
 static int verbose;
 static int preauth;
+static int oldapi;
 
 static size_t
 copyBuffer (void *ptr,
@@ -279,8 +280,6 @@ ahc_echo (void *cls,
           void **req_cls)
 {
   struct MHD_Response *response;
-  char *username;
-  char *password;
   enum MHD_Result ret;
   static int already_called_marker;
   (void) cls; (void) url;         /* Unused. Silent compiler warning. */
@@ -298,46 +297,129 @@ ahc_echo (void *cls,
     mhdErrorExitDesc ("Unexpected HTTP method");
 
   /* require: USERNAME with password PASSWORD */
-  password = NULL;
-  username = MHD_basic_auth_get_username_password (connection,
-                                                   &password);
-  if (NULL != username)
+  if (! oldapi)
   {
-    if (0 != strcmp (username, USERNAME))
+    struct MHD_BasicAuthInfo *creds;
+
+    creds = MHD_basic_auth_get_username_password3 (connection);
+    if (NULL != creds)
+    {
+      if (NULL == creds->username)
+        mhdErrorExitDesc ("'username' is NULL");
+      else if (MHD_STATICSTR_LEN_ (USERNAME) != creds->username_len)
+      {
+        fprintf (stderr, "'username_len' does not match.\n"
+                 "Expected: %u\tRecieved: %u. ",
+                 (unsigned) MHD_STATICSTR_LEN_ (USERNAME),
+                 (unsigned) creds->username_len);
+        mhdErrorExitDesc ("Wrong 'username_len'");
+      }
+      else if (0 != memcmp (creds->username, USERNAME, creds->username_len))
+      {
+        fprintf (stderr, "'username' does not match.\n"
+                 "Expected: '%s'\tRecieved: '%.*s'. ",
+                 USERNAME,
+                 (int) creds->username_len,
+                 creds->username);
+        mhdErrorExitDesc ("Wrong 'username'");
+      }
+      else if (0 != creds->username[creds->username_len])
+        mhdErrorExitDesc ("'username' is not zero-terminated");
+      else if (NULL == creds->password)
+        mhdErrorExitDesc ("'password' is NULL");
+      else if (MHD_STATICSTR_LEN_ (PASSWORD) != creds->password_len)
+      {
+        fprintf (stderr, "'password_len' does not match.\n"
+                 "Expected: %u\tRecieved: %u. ",
+                 (unsigned) MHD_STATICSTR_LEN_ (PASSWORD),
+                 (unsigned) creds->password_len);
+        mhdErrorExitDesc ("Wrong 'password_len'");
+      }
+      else if (0 != memcmp (creds->password, PASSWORD, creds->password_len))
+      {
+        fprintf (stderr, "'password' does not match.\n"
+                 "Expected: '%s'\tRecieved: '%.*s'. ",
+                 PASSWORD,
+                 (int) creds->password_len,
+                 creds->password);
+        mhdErrorExitDesc ("Wrong 'username'");
+      }
+      else if (0 != creds->password[creds->password_len])
+        mhdErrorExitDesc ("'password' is not zero-terminated");
+
+      MHD_free (creds);
+
+      response =
+        MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (PAGE),
+                                                (const void *) PAGE);
+      if (NULL == response)
+        mhdErrorExitDesc ("Response creation failed");
+      ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+      if (MHD_YES != ret)
+        mhdErrorExitDesc ("'MHD_queue_response()' failed");
+    }
+    else
     {
-      fprintf (stderr, "'username' does not match.\n"
-               "Expected: '%s'\tRecieved: '%s'. ", USERNAME, username);
-      mhdErrorExitDesc ("Wrong 'username'");
+      response =
+        MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (DENIED),
+                                                (const void *) DENIED);
+      if (NULL == response)
+        mhdErrorExitDesc ("Response creation failed");
+      ret = MHD_queue_basic_auth_fail_response3 (connection, REALM, 1,
+                                                 response);
+      if (MHD_YES != ret)
+        mhdErrorExitDesc ("'MHD_queue_basic_auth_fail_response3()' failed");
     }
-    if (NULL == password)
-      mhdErrorExitDesc ("The password pointer is NULL");
-    if (0 != strcmp (password, PASSWORD))
-      fprintf (stderr, "'password' does not match.\n"
-               "Expected: '%s'\tRecieved: '%s'. ", PASSWORD, password);
-    response =
-      MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (PAGE),
-                                              (const void *) PAGE);
-    if (NULL == response)
-      mhdErrorExitDesc ("Response creation failed");
-    ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
-    if (MHD_YES != ret)
-      mhdErrorExitDesc ("'MHD_queue_response()' failed");
   }
   else
   {
+    char *username;
+    char *password;
+
+    password = NULL;
+    username = MHD_basic_auth_get_username_password (connection,
+                                                     &password);
+    if (NULL != username)
+    {
+      if (0 != strcmp (username, USERNAME))
+      {
+        fprintf (stderr, "'username' does not match.\n"
+                 "Expected: '%s'\tRecieved: '%s'. ", USERNAME, username);
+        mhdErrorExitDesc ("Wrong 'username'");
+      }
+      if (NULL == password)
+        mhdErrorExitDesc ("The password pointer is NULL");
+      if (0 != strcmp (password, PASSWORD))
+        fprintf (stderr, "'password' does not match.\n"
+                 "Expected: '%s'\tRecieved: '%s'. ", PASSWORD, password);
+      response =
+        MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (PAGE),
+                                                (const void *) PAGE);
+      if (NULL == response)
+        mhdErrorExitDesc ("Response creation failed");
+      ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+      if (MHD_YES != ret)
+        mhdErrorExitDesc ("'MHD_queue_response()' failed");
+    }
+    else
+    {
+      if (NULL != password)
+        mhdErrorExitDesc ("The password pointer is NOT NULL");
+      response =
+        MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (DENIED),
+                                                (const void *) DENIED);
+      if (NULL == response)
+        mhdErrorExitDesc ("Response creation failed");
+      ret = MHD_queue_basic_auth_fail_response (connection, REALM, response);
+      if (MHD_YES != ret)
+        mhdErrorExitDesc ("'MHD_queue_basic_auth_fail_response()' failed");
+    }
+    if (NULL != username)
+      MHD_free (username);
     if (NULL != password)
-      mhdErrorExitDesc ("The password pointer is NOT NULL");
-    response =
-      MHD_create_response_from_buffer_static (MHD_STATICSTR_LEN_ (DENIED),
-                                              (const void *) DENIED);
-    ret = MHD_queue_basic_auth_fail_response (connection, REALM,
-                                              response);
+      MHD_free (password);
   }
 
-  if (NULL != username)
-    MHD_free (username);
-  if (NULL != password)
-    MHD_free (password);
   MHD_destroy_response (response);
   return ret;
 }
@@ -376,6 +458,7 @@ setupCURL (void *cbc, int port, char *errbuf)
                                      ((long) TIMEOUTS_VAL))) ||
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_HTTP_VERSION,
                                      CURL_HTTP_VERSION_1_1)) ||
+      /* (CURLE_OK != curl_easy_setopt (c, CURLOPT_VERBOSE, 1L)) || */
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_FAILONERROR, 1L)) ||
 #if CURL_AT_LEAST_VERSION (7, 19, 4)
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP)) ||
@@ -386,10 +469,10 @@ setupCURL (void *cbc, int port, char *errbuf)
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_PORT, ((long) port))) ||
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_URL, url)))
     libcurlErrorExitDesc ("curl_easy_setopt() failed");
-#if CURL_AT_LEAST_VERSION(7,21,3)
+#if CURL_AT_LEAST_VERSION (7,21,3)
   if ((CURLE_OK != curl_easy_setopt (c, CURLOPT_HTTPAUTH,
-                                     CURLAUTH_BASIC |
-                                     (preauth ? 0 : CURLAUTH_ONLY))) ||
+                                     CURLAUTH_BASIC
+                                     | (preauth ? 0 : CURLAUTH_ONLY))) ||
       (CURLE_OK != curl_easy_setopt (c, CURLOPT_USERPWD,
                                      USERNAME ":" PASSWORD)))
     libcurlErrorExitDesc ("curl_easy_setopt() authorization options failed");
@@ -646,6 +729,7 @@ main (int argc, char *const *argv)
 #endif
 #endif
 #endif /* MHD_HTTPS_REQUIRE_GRYPT */
+  oldapi = has_in_name (argv[0], "_oldapi");
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
   errorCount += testBasicAuth ();

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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