gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (65413082 -> 23943a2d)


From: gnunet
Subject: [libmicrohttpd] branch master updated (65413082 -> 23943a2d)
Date: Wed, 26 May 2021 20:24:31 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 65413082 md5 small optimization
     new de6922ca Added detection of HTTP version during early parsing
     new 5e029304 test_long_header: minor improvement
     new 547db430 HTTP version string processing fixes
     new 0c28412a Refactored handling of incompatible HTTP versions
     new 23943a2d Calculate size of error responses at compile time

The 5 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/microhttpd/connection.c     | 296 +++++++++++++++++++++++++++++-----------
 src/microhttpd/internal.h       |  58 ++++++++
 src/testcurl/test_long_header.c |   8 +-
 3 files changed, 275 insertions(+), 87 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 08b76eb6..4bbe2683 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -114,6 +114,26 @@
 #define INTERNAL_ERROR ""
 #endif
 
+/**
+ * Response text used when the request HTTP version is too old.
+ */
+#ifdef HAVE_MESSAGES
+#define REQ_HTTP_VER_IS_TOO_OLD \
+  "<html><head><title>Requested HTTP version is not 
supported</title></head><body>Requested HTTP version is too old and not 
supported.</body></html>"
+#else
+#define REQ_HTTP_VER_IS_TOO_OLD ""
+#endif
+
+/**
+ * Response text used when the request HTTP version is too old.
+ */
+#ifdef HAVE_MESSAGES
+#define REQ_HTTP_VER_IS_NOT_SUPPORTED \
+  "<html><head><title>Requested HTTP version is not 
supported</title></head><body>Requested HTTP version is not 
supported.</body></html>"
+#else
+#define REQ_HTTP_VER_IS_NOT_SUPPORTED ""
+#endif
+
 
 /**
  * sendfile() chuck size
@@ -632,18 +652,16 @@ need_100_continue (struct MHD_Connection *connection)
 {
   const char *expect;
 
-  return ( (NULL != connection->version) &&
-           (MHD_str_equal_caseless_ (connection->version,
-                                     MHD_HTTP_VERSION_1_1)) &&
-           (MHD_NO != MHD_lookup_connection_value_n (connection,
-                                                     MHD_HEADER_KIND,
-                                                     MHD_HTTP_HEADER_EXPECT,
-                                                     MHD_STATICSTR_LEN_ (
-                                                       MHD_HTTP_HEADER_EXPECT),
-                                                     &expect,
-                                                     NULL)) &&
-           (MHD_str_equal_caseless_ (expect,
-                                     "100-continue")) );
+  return (MHD_IS_HTTP_VER_1_1_COMPAT (connection->http_ver) &&
+          (MHD_NO != MHD_lookup_connection_value_n (connection,
+                                                    MHD_HEADER_KIND,
+                                                    MHD_HTTP_HEADER_EXPECT,
+                                                    MHD_STATICSTR_LEN_ (
+                                                      MHD_HTTP_HEADER_EXPECT),
+                                                    &expect,
+                                                    NULL)) &&
+          (MHD_str_equal_caseless_ (expect,
+                                    "100-continue")) );
 }
 
 
@@ -828,6 +846,40 @@ connection_close_error (struct MHD_Connection *connection,
 #endif
 
 
+/**
+ * A serious error occurred, check whether error response is already
+ * queued and close the connection if response wasn't queued.
+ *
+ * @param connection connection to close with error
+ * @param emsg error message (can be NULL)
+ */
+static void
+connection_close_error_check (struct MHD_Connection *connection,
+                              const char *emsg)
+{
+  if ( (NULL != connection->response) &&
+       (400 <= connection->responseCode) &&
+       (connection->read_closed) &&
+       (MHD_CONNECTION_HEADERS_SENDING == connection->state) )
+    return; /* An error response was already queued */
+
+  connection_close_error (connection, emsg);
+}
+
+
+/**
+ * Macro to only include error message in call to
+ * #connection_close_error_check() if we have HAVE_MESSAGES.
+ */
+#ifdef HAVE_MESSAGES
+#define CONNECTION_CLOSE_ERROR_CHECK(c, emsg) \
+  connection_close_error_check (c, emsg)
+#else
+#define CONNECTION_CLOSE_ERROR_CHECK(c, emsg) \
+  connection_close_error_check (c, NULL)
+#endif
+
+
 /**
  * Prepare the response buffer of this connection for
  * sending.  Assumes that the response mutex is
@@ -1072,14 +1124,11 @@ keepalive_possible (struct MHD_Connection *connection)
 {
   if (MHD_CONN_MUST_CLOSE == connection->keepalive)
     return MHD_NO;
-  if (NULL == connection->version)
-    return MHD_NO;
   if ( (NULL != connection->response) &&
        (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
     return MHD_NO;
 
-  if (MHD_str_equal_caseless_ (connection->version,
-                               MHD_HTTP_VERSION_1_1) &&
+  if (MHD_IS_HTTP_VER_1_1_COMPAT (connection->http_ver) &&
       ( (NULL == connection->response) ||
         (0 == (connection->response->flags
                & MHD_RF_HTTP_VERSION_1_0_RESPONSE) ) ) )
@@ -1096,8 +1145,7 @@ keepalive_possible (struct MHD_Connection *connection)
 
     return MHD_YES;
   }
-  if (MHD_str_equal_caseless_ (connection->version,
-                               MHD_HTTP_VERSION_1_0))
+  if (MHD_HTTP_VER_1_0 == connection->http_ver)
   {
     if (MHD_lookup_header_s_token_ci (connection,
                                       MHD_HTTP_HEADER_CONNECTION,
@@ -1272,29 +1320,31 @@ build_header_response (struct MHD_Connection 
*connection)
   bool must_add_content_length;
   bool may_add_content_length;
 
-  mhd_assert (NULL != connection->version);
-  if (0 == connection->version[0])
-  {
-    data = MHD_pool_allocate (connection->pool,
-                              0,
-                              true);
-    connection->write_buffer = data;
-    connection->write_buffer_append_offset = 0;
-    connection->write_buffer_send_offset = 0;
-    connection->write_buffer_size = 0;
-    return MHD_YES;
-  }
+  /* HTTP version must be supported.
+   * Allow limited set of error replies for unsupported HTTP versions. */
+  mhd_assert (MHD_IS_HTTP_VER_SUPPORTED (connection->http_ver) || \
+              (MHD_HTTP_BAD_REQUEST == connection->responseCode) || \
+              (MHD_HTTP_REQUEST_TIMEOUT == connection->responseCode) || \
+              (MHD_HTTP_URI_TOO_LONG == connection->responseCode) || \
+              (MHD_HTTP_TOO_MANY_REQUESTS == connection->responseCode) || \
+              (MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE == \
+               connection->responseCode) || \
+              (MHD_HTTP_NOT_IMPLEMENTED == connection->responseCode) || \
+              (MHD_HTTP_SERVICE_UNAVAILABLE == connection->responseCode) || \
+              (MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED == \
+               connection->responseCode) );
+
   rc = connection->responseCode & (~MHD_ICY_FLAG);
   if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state)
   {
     reason_phrase = MHD_get_reason_phrase_for (rc);
+    /* TODO: reply as HTTP/1.1 for HTTP/1.0 requests */
     off = MHD_snprintf_ (code,
                          sizeof (code),
                          "%s %u %s\r\n",
                          (0 != (connection->responseCode & MHD_ICY_FLAG))
                          ? "ICY"
-                         : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0,
-                                                       connection->version) ||
+                         : ( (MHD_HTTP_VER_1_0 == connection->http_ver ||
                               (0 != (connection->response->flags
                                      & MHD_RF_HTTP_VERSION_1_0_RESPONSE)) )
                              ? MHD_HTTP_VERSION_1_0
@@ -1374,8 +1424,7 @@ build_header_response (struct MHD_Connection *connection)
       /* 'close' header doesn't exist yet, see if we need to add one;
          if the client asked for a close, no need to start chunk'ing */
       if ( (MHD_NO != keepalive_possible (connection)) &&
-           (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_1,
-                                     connection->version) ) )
+           (MHD_IS_HTTP_VER_1_1_COMPAT (connection->http_ver)) )
       {
         if (NULL == have_encoding)
         {
@@ -1620,21 +1669,17 @@ build_header_response (struct MHD_Connection 
*connection)
  * @param connection the connection
  * @param status_code the response code to send (400, 413 or 414)
  * @param message the error message to send
+ * @param message_len the length of the @a message
  */
 static void
-transmit_error_response (struct MHD_Connection *connection,
-                         unsigned int status_code,
-                         const char *message)
+transmit_error_response_len (struct MHD_Connection *connection,
+                             unsigned int status_code,
+                             const char *message,
+                             size_t message_len)
 {
   struct MHD_Response *response;
   enum MHD_Result iret;
 
-  if (NULL == connection->version)
-  {
-    /* we were unable to process the full header line, so we don't
- really know what version the client speaks; assume 1.0 */
-    connection->version = MHD_HTTP_VERSION_1_0;
-  }
   connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
   connection->read_closed = true;
   if (0 != connection->read_buffer_size)
@@ -1659,7 +1704,7 @@ transmit_error_response (struct MHD_Connection 
*connection,
     MHD_destroy_response (connection->response);
     connection->response = NULL;
   }
-  response = MHD_create_response_from_buffer (strlen (message),
+  response = MHD_create_response_from_buffer (message_len,
                                               (void *) message,
                                               MHD_RESPMEM_PERSISTENT);
   if (NULL == response)
@@ -1697,6 +1742,12 @@ transmit_error_response (struct MHD_Connection 
*connection,
 }
 
 
+/**
+ * Transmit static string as error response
+ */
+#define transmit_error_response_static(c, code, msg) \
+  transmit_error_response_len (c, code, msg, MHD_STATICSTR_LEN_(msg))
+
 /**
  * Update the 'event_loop_info' field of this connection based on the state
  * that the connection is now in.  May also close the connection or
@@ -1748,11 +1799,14 @@ MHD_connection_update_event_loop_info (struct 
MHD_Connection *connection)
       if ( (connection->read_buffer_offset == connection->read_buffer_size) &&
            (! try_grow_read_buffer (connection, true)) )
       {
-        transmit_error_response (connection,
-                                 (connection->url != NULL)
-                                 ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
-                                 : MHD_HTTP_URI_TOO_LONG,
-                                 REQUEST_TOO_BIG);
+        if (connection->url != NULL)
+          transmit_error_response_static (connection,
+                                          
MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                          REQUEST_TOO_BIG);
+        else
+          transmit_error_response_static (connection,
+                                          MHD_HTTP_URI_TOO_LONG,
+                                          REQUEST_TOO_BIG);
         continue;
       }
       if (! connection->read_closed)
@@ -1788,9 +1842,9 @@ MHD_connection_update_event_loop_info (struct 
MHD_Connection *connection)
              on the connection (if a timeout is even
              set!).
              Solution: we kill the connection with an error */
-          transmit_error_response (connection,
-                                   MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                   INTERNAL_ERROR);
+          transmit_error_response_static (connection,
+                                          MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                          INTERNAL_ERROR);
           continue;
         }
       }
@@ -1896,11 +1950,14 @@ get_next_header_line (struct MHD_Connection *connection,
     if ( (connection->read_buffer_offset == connection->read_buffer_size) &&
          (! try_grow_read_buffer (connection, true)) )
     {
-      transmit_error_response (connection,
-                               (NULL != connection->url)
-                               ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
-                               : MHD_HTTP_URI_TOO_LONG,
-                               REQUEST_TOO_BIG);
+      if (NULL != connection->url)
+        transmit_error_response_static (connection,
+                                        
MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                        REQUEST_TOO_BIG);
+      else
+        transmit_error_response_static (connection,
+                                        MHD_HTTP_URI_TOO_LONG,
+                                        REQUEST_TOO_BIG);
     }
     if (line_len)
       *line_len = 0;
@@ -1954,9 +2011,9 @@ connection_add_header (struct MHD_Connection *connection,
     MHD_DLOG (connection->daemon,
               _ ("Not enough memory in pool to allocate header record!\n"));
 #endif
-    transmit_error_response (connection,
-                             MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
-                             REQUEST_TOO_BIG);
+    transmit_error_response_static (connection,
+                                    MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                    REQUEST_TOO_BIG);
     return MHD_NO;
   }
   return MHD_YES;
@@ -2001,9 +2058,9 @@ parse_cookie_header (struct MHD_Connection *connection)
     MHD_DLOG (connection->daemon,
               _ ("Not enough memory in pool to parse cookies!\n"));
 #endif
-    transmit_error_response (connection,
-                             MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
-                             REQUEST_TOO_BIG);
+    transmit_error_response_static (connection,
+                                    MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                    REQUEST_TOO_BIG);
     return MHD_NO;
   }
   memcpy (cpy,
@@ -2087,6 +2144,69 @@ parse_cookie_header (struct MHD_Connection *connection)
 }
 
 
+/**
+ * Detect HTTP version
+ *
+ * @param connection the connection
+ * @param http_string the pointer to HTTP version string
+ * @param len the length of @a http_string in bytes
+ * @return #MHD_YES if HTTP version is correct and supported,
+ *         #MHD_NO if HTTP version is not correct or unsupported.
+ */
+static enum MHD_Result
+parse_http_version (struct MHD_Connection *connection,
+                    const char*http_string,
+                    size_t len)
+{
+  const char *const h = http_string; /**< short alias */
+  mhd_assert (NULL != http_string);
+
+  /* String must starts with 'HTTP/d.d', case-sensetive match.
+   * See https://datatracker.ietf.org/doc/html/rfc7230#section-2.6 */
+  if ((len != 8) ||
+      (h[0] != 'H') || (h[1] != 'T') || (h[2] != 'T') || (h[3] != 'P') ||
+      (h[4] != '/')
+      || (h[6] != '.') ||
+      ((h[5] < '0') || (h[5] > '9')) ||
+      ((h[7] < '0') || (h[7] > '9')))
+  {
+    connection->http_ver = MHD_HTTP_VER_INVALID;
+    transmit_error_response_static (connection,
+                                    MHD_HTTP_BAD_REQUEST,
+                                    REQUEST_MALFORMED);
+    return MHD_NO;
+  }
+  if (1 == h[5] - '0')
+  {
+    /* HTTP/1.x */
+    if (1 == h[7] - '0')
+      connection->http_ver = MHD_HTTP_VER_1_1;
+    else if (0 == h[7] - '0')
+      connection->http_ver = MHD_HTTP_VER_1_0;
+    else
+      connection->http_ver = MHD_HTTP_VER_1_2__1_9;
+
+    return MHD_YES;
+  }
+
+  if (0 == h[5] - '0')
+  {
+    /* Too old major version */
+    connection->http_ver = MHD_HTTP_VER_TOO_OLD;
+    transmit_error_response_static (connection,
+                                    MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED,
+                                    REQ_HTTP_VER_IS_TOO_OLD);
+    return MHD_NO;
+  }
+
+  connection->http_ver = MHD_HTTP_VER_FUTURE;
+  transmit_error_response_static (connection,
+                                  MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED,
+                                  REQ_HTTP_VER_IS_NOT_SUPPORTED);
+  return MHD_NO;
+}
+
+
 /**
  * Parse the first line of the HTTP HEADER.
  *
@@ -2126,6 +2246,8 @@ parse_initial_message_line (struct MHD_Connection 
*connection,
     uri = NULL;
     connection->version = "";
     args = NULL;
+    if (MHD_NO == parse_http_version (connection, connection->version, 0))
+      return MHD_NO;
   }
   else
   {
@@ -2146,11 +2268,17 @@ parse_initial_message_line (struct MHD_Connection 
*connection,
       /* http_version points to character before HTTP version string */
       http_version[0] = '\0';
       connection->version = http_version + 1;
+      if (MHD_NO == parse_http_version (connection, connection->version,
+                                        line_len
+                                        - (connection->version - line)))
+        return MHD_NO;
       uri_len = http_version - uri;
     }
     else
     {
       connection->version = "";
+      if (MHD_NO == parse_http_version (connection, connection->version, 0))
+        return MHD_NO;
       uri_len = line_len - (uri - line);
     }
     /* check for spaces in URI if we are "strict" */
@@ -2617,9 +2745,9 @@ process_broken_line (struct MHD_Connection *connection,
                                 last_len + tmp_len + 1);
     if (NULL == last)
     {
-      transmit_error_response (connection,
-                               MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
-                               REQUEST_TOO_BIG);
+      transmit_error_response_static (connection,
+                                      MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                      REQUEST_TOO_BIG);
       return MHD_NO;
     }
     memcpy (&last[last_len],
@@ -2638,9 +2766,9 @@ process_broken_line (struct MHD_Connection *connection,
                              strlen (connection->colon),
                              kind))
   {
-    transmit_error_response (connection,
-                             MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
-                             REQUEST_TOO_BIG);
+    transmit_error_response_static (connection,
+                                    MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,
+                                    REQUEST_TOO_BIG);
     return MHD_NO;
   }
   /* we still have the current line to deal with... */
@@ -2649,9 +2777,9 @@ process_broken_line (struct MHD_Connection *connection,
     if (MHD_NO == process_header_line (connection,
                                        line))
     {
-      transmit_error_response (connection,
-                               MHD_HTTP_BAD_REQUEST,
-                               REQUEST_MALFORMED);
+      transmit_error_response_static (connection,
+                                      MHD_HTTP_BAD_REQUEST,
+                                      REQUEST_MALFORMED);
       return MHD_NO;
     }
   }
@@ -2676,9 +2804,7 @@ parse_connection_headers (struct MHD_Connection 
*connection)
 
   parse_cookie_header (connection);
   if ( (1 <= connection->daemon->strict_for_client) &&
-       (NULL != connection->version) &&
-       (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_1,
-                                 connection->version)) &&
+       (MHD_IS_HTTP_VER_1_1_COMPAT (connection->http_ver)) &&
        (MHD_NO ==
         MHD_lookup_connection_value_n (connection,
                                        MHD_HEADER_KIND,
@@ -3398,10 +3524,13 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       if (MHD_NO == parse_initial_message_line (connection,
                                                 line,
                                                 line_len))
-        CONNECTION_CLOSE_ERROR (connection,
-                                NULL);
+        CONNECTION_CLOSE_ERROR_CHECK (connection,
+                                      NULL);
       else
+      {
+        mhd_assert (MHD_IS_HTTP_VER_SUPPORTED (connection->http_ver));
         connection->state = MHD_CONNECTION_URL_RECEIVED;
+      }
       continue;
     case MHD_CONNECTION_URL_RECEIVED:
       line = get_next_header_line (connection,
@@ -3427,9 +3556,9 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       if (MHD_NO == process_header_line (connection,
                                          line))
       {
-        transmit_error_response (connection,
-                                 MHD_HTTP_BAD_REQUEST,
-                                 REQUEST_MALFORMED);
+        transmit_error_response_static (connection,
+                                        MHD_HTTP_BAD_REQUEST,
+                                        REQUEST_MALFORMED);
         break;
       }
       connection->state = MHD_CONNECTION_HEADER_PART_RECEIVED;
@@ -3550,9 +3679,9 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
       if (MHD_NO == process_header_line (connection,
                                          line))
       {
-        transmit_error_response (connection,
-                                 MHD_HTTP_BAD_REQUEST,
-                                 REQUEST_MALFORMED);
+        transmit_error_response_static (connection,
+                                        MHD_HTTP_BAD_REQUEST,
+                                        REQUEST_MALFORMED);
         break;
       }
       connection->state = MHD_CONNECTION_FOOTER_PART_RECEIVED;
@@ -3756,6 +3885,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
         /* can try to keep-alive */
 
         connection->version = NULL;
+        connection->http_ver = MHD_HTTP_VER_UNKNOWN;
         connection->state = MHD_CONNECTION_INIT;
         connection->last = NULL;
         connection->colon = NULL;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 346001c3..e684aa88 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -732,6 +732,59 @@ enum MHD_ConnKeepAlive
   MHD_CONN_USE_KEEPALIVE = 1
 };
 
+enum MHD_HTTP_version
+{
+  /**
+   * Not a HTTP protocol or HTTP version is invalid.
+   */
+  MHD_HTTP_VER_INVALID = -1,
+
+  /**
+   * HTTP version is not yet received from the client.
+   */
+  MHD_HTTP_VER_UNKNOWN = 0,
+
+  /**
+   * HTTP version before 1.0, unsupported.
+   */
+  MHD_HTTP_VER_TOO_OLD = 1,
+
+  /**
+   * HTTP version 1.0
+   */
+  MHD_HTTP_VER_1_0 = 2,
+
+  /**
+   * HTTP version 1.1
+   */
+  MHD_HTTP_VER_1_1 = 3,
+
+  /**
+   * HTTP version 1.2-1.9, must be used as 1.1
+   */
+  MHD_HTTP_VER_1_2__1_9 = 4,
+
+  /**
+   * HTTP future version. Unsupported.
+   * Reserved, not really detected.
+   */
+  MHD_HTTP_VER_FUTURE = 100
+};
+
+/**
+ * Returns boolean 'true' if HTTP version is supported by MHD
+ */
+#define MHD_IS_HTTP_VER_SUPPORTED(ver) (MHD_HTTP_VER_1_0 <= (ver) && \
+    MHD_HTTP_VER_1_2__1_9 >= (ver))
+
+/**
+ * Protocol should be used as HTTP/1.1 protocol.
+ *
+ * See the last paragraph of
+ * https://datatracker.ietf.org/doc/html/rfc7230#section-2.6
+ */
+#define MHD_IS_HTTP_VER_1_1_COMPAT(ver) (MHD_HTTP_VER_1_1 == (ver) || \
+    MHD_HTTP_VER_1_2__1_9 == (ver))
 
 /**
  * State kept for each HTTP request.
@@ -839,6 +892,11 @@ struct MHD_Connection
    */
   char *version;
 
+  /**
+   * HTTP protocol version as enum.
+   */
+  enum MHD_HTTP_version http_ver;
+
   /**
    * Close connection after sending response?
    * Functions may change value from "Unknown" or "KeepAlive" to "Must close",
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index 54030c21..b9802fc5 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -152,7 +152,7 @@ testLongUrlGet (size_t buff_size)
   curl_easy_setopt (c, CURLOPT_PORT, (long) port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-  curl_easy_setopt (c, CURLOPT_FAILONERROR, 1L);
+  curl_easy_setopt (c, CURLOPT_FAILONERROR, 0L);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
   curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
   if (oneone)
@@ -163,7 +163,7 @@ testLongUrlGet (size_t buff_size)
      setting NOSIGNAL results in really weird
      crashes on my system! */
   curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L);
-  if (CURLE_OK == curl_easy_perform (c))
+  if (CURLE_OK != curl_easy_perform (c))
   {
     curl_easy_cleanup (c);
     MHD_stop_daemon (d);
@@ -249,7 +249,7 @@ testLongHeaderGet (size_t buff_size)
   curl_easy_setopt (c, CURLOPT_PORT, (long) port);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
-  curl_easy_setopt (c, CURLOPT_FAILONERROR, 1L);
+  curl_easy_setopt (c, CURLOPT_FAILONERROR, 0L);
   curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
   curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L);
   if (oneone)
@@ -260,7 +260,7 @@ testLongHeaderGet (size_t buff_size)
      setting NOSIGNAL results in really weird
      crashes on my system! */
   curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L);
-  if (CURLE_OK == curl_easy_perform (c))
+  if (CURLE_OK != curl_easy_perform (c))
   {
     curl_easy_cleanup (c);
     MHD_stop_daemon (d);

-- 
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]