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 (97e27f6 -> c34ddff)


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] branch master updated (97e27f6 -> c34ddff)
Date: Wed, 15 May 2019 20:42:39 +0200

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

marcello pushed a change to branch master
in repository twister.

    from 97e27f6  Debugging.
     new 2363dcc  Importing inflating function from GNUnet..
     new c34ddff  Creating more machine states.

The 2 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/twister/taler-twister-service.c | 365 +++++++++++++++++++-----------------
 1 file changed, 197 insertions(+), 168 deletions(-)

diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index ee15c43..82a009a 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -81,22 +81,32 @@ enum RequestState
   /**
    * We've started receiving upload data from MHD.
    */
-  REQUEST_STATE_UPLOAD_STARTED,
+  REQUEST_STATE_CLIENT_UPLOAD_STARTED,
+
+  /**
+   * Wa have started uploading data to the proxied service.
+   */
+  REQUEST_STATE_PROXY_UPLOAD_STARTED,
 
   /**
    * We're done with the upload from MHD.
    */
-  REQUEST_STATE_UPLOAD_DONE,
+  REQUEST_STATE_CLIENT_UPLOAD_DONE,
+
+  /**
+   * We're done uploading data to the proxied service.
+   */
+  REQUEST_STATE_PROXY_UPLOAD_DONE,
 
   /**
    * We've finished uploading data via CURL and can now download.
    */
-  REQUEST_STATE_DOWNLOAD_STARTED,
+  REQUEST_STATE_PROXY_DOWNLOAD_STARTED,
 
   /**
    * We've finished receiving download data from cURL.
    */
-  REQUEST_STATE_DOWNLOAD_DONE
+  REQUEST_STATE_PROXY_DOWNLOAD_DONE
 };
 
 
@@ -159,12 +169,6 @@ struct HttpRequest
   struct GNUNET_SCHEDULER_Task *wtask;
 
   /**
-   * Buffer we use for moving data between MHD and
-   * curl (in both directions).
-   */
-  char *io_buf;
-
-  /**
    * Hold the response obtained by modifying the original one.
    */
   struct MHD_Response *mod_response;
@@ -205,14 +209,15 @@ struct HttpRequest
   struct HttpResponseHeader *header_tail;
 
   /**
-   * Number of bytes already in the IO buffer.
+   * Buffer we use for moving data between MHD and
+   * curl (in both directions).
    */
-  size_t io_len;
+  char *io_buf;
 
   /**
-   * HTTP response code to give to MHD for the response.
+   * Number of bytes already in the IO buffer.
    */
-  unsigned int response_code;
+  size_t io_len;
 
   /**
    * Number of bytes allocated for the IO buffer.
@@ -220,6 +225,11 @@ struct HttpRequest
   unsigned int io_size;
 
   /**
+   * HTTP response code to give to MHD for the response.
+   */
+  unsigned int response_code;
+
+  /**
    * Request processing state machine.
    */
   enum RequestState state;
@@ -233,17 +243,6 @@ struct HttpRequest
    * Did we pause CURL processing?
    */
   int curl_paused;
-
-  /**
-   * if GNUNET_YES, then request and response will carry
-   * a compressed body.
-   */
-  int deflate;
-
-  /**
-   * Zlib internal state.
-   */
-  z_stream zstate;
 };
 
 
@@ -437,15 +436,6 @@ curl_check_hdr (void *buffer,
                    hdr_type,
                    hdr_val);
 
-  if ((0 == strcasecmp (hdr_type,
-                        MHD_HTTP_HEADER_CONTENT_ENCODING))
-      && (NULL != strstr (hdr_val,
-                          "deflate")))
-  {
-    TALER_LOG_INFO ("Compressed response\n");
-    hr->deflate = GNUNET_YES;
-  }
-
   /* Skip "Host:" header as it will be wrong, given
      that we are man-in-the-middling the connection */
   if (0 == strcasecmp (hdr_type,
@@ -544,8 +534,7 @@ curl_download_cb (void *ptr,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Curl download proceeding\n");
 
-  if ( (REQUEST_STATE_UPLOAD_STARTED == hr->state) ||
-       (REQUEST_STATE_UPLOAD_DONE == hr->state) )
+  if (REQUEST_STATE_PROXY_UPLOAD_STARTED == hr->state)
   {
     /* Web server started with response before we finished
        the upload.  In this case, current libcurl decides
@@ -555,24 +544,23 @@ curl_download_cb (void *ptr,
        with uploads without "Expect: 100 Continue" and
        Web servers responding with an error (i.e. upload
        not allowed) */
-    hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Stopping %u byte upload: we are already downloading...\n",
-                (unsigned int) hr->io_len);
+    hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
+    GNUNET_log
+      (GNUNET_ERROR_TYPE_INFO,
+       "Stopping %u byte upload: we are already downloading...\n",
+       (unsigned int) hr->io_len);
     hr->io_len = 0;
   }
 
-  if (REQUEST_STATE_DOWNLOAD_STARTED != hr->state)
+  if (REQUEST_STATE_PROXY_DOWNLOAD_STARTED != hr->state)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Download callback goes to sleep\n");
     hr->curl_paused = GNUNET_YES;
     return CURL_WRITEFUNC_PAUSE;
   }
-
   GNUNET_assert
-    (REQUEST_STATE_DOWNLOAD_STARTED == hr->state);
-
+    (REQUEST_STATE_PROXY_DOWNLOAD_STARTED == hr->state);
   if (hr->io_size - hr->io_len < total)
   {
     GNUNET_assert (total + hr->io_size >= total);
@@ -619,24 +607,32 @@ curl_upload_cb (void *buf,
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Upload cb is working...\n");
-  if ( (REQUEST_STATE_UPLOAD_STARTED != hr->state) &&
-       (REQUEST_STATE_UPLOAD_DONE != hr->state) )
+
+  if ( (REQUEST_STATE_PROXY_DOWNLOAD_STARTED == hr->state) ||
+       (REQUEST_STATE_PROXY_DOWNLOAD_DONE == hr->state) )
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Upload cb aborts: we are already downloading...\n");
+    GNUNET_log
+      (GNUNET_ERROR_TYPE_INFO,
+       "Upload cb aborts: we are already downloading...\n");
     return CURL_READFUNC_ABORT;
   }
+  
   if ( (0 == hr->io_len) &&
-       (REQUEST_STATE_UPLOAD_DONE != hr->state) )
+      (REQUEST_STATE_PROXY_UPLOAD_STARTED == hr->state) )
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Pausing CURL UPLOAD, need more data\n");
     return CURL_READFUNC_PAUSE;
   }
+
+  /**
+   * We got rescheduled because the download callback was asleep.
+   * FIXME: can this block be eliminated and the unpausing being
+   * moved in the last block where we return zero as well?
+   */
   if ( (0 == hr->io_len) &&
-       (REQUEST_STATE_UPLOAD_DONE == hr->state) )
+       (REQUEST_STATE_PROXY_DOWNLOAD_STARTED == hr->state) )
   {
-    hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
     if (GNUNET_YES == hr->curl_paused)
     {
       hr->curl_paused = GNUNET_NO;
@@ -660,7 +656,7 @@ curl_upload_cb (void *buf,
   hr->io_len -= to_copy;
   if (0 == hr->io_len)
   {
-    hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
+    hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Completed CURL UPLOAD\n");
   }
@@ -814,7 +810,7 @@ curl_task_download (void *cls)
               if (NULL == hr->response)
                 GNUNET_assert (GNUNET_OK ==
                               create_mhd_response_from_hr (hr));
-              hr->state = REQUEST_STATE_DOWNLOAD_DONE;
+              hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
              if (GNUNET_YES == hr->suspended)
              {
                MHD_resume_connection (hr->con);
@@ -828,7 +824,7 @@ curl_task_download (void *cls)
                           curl_easy_strerror (msg->data.result));
               /* FIXME: indicate error somehow?
                * close MHD connection badly as well? */
-              hr->state = REQUEST_STATE_DOWNLOAD_DONE;
+              hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
              if (GNUNET_YES == hr->suspended)
              {
                MHD_resume_connection (hr->con);
@@ -890,8 +886,7 @@ static int
 con_val_iter (void *cls,
               enum MHD_ValueKind kind,
               const char *key,
-              const char *value,
-              size_t value_size)
+              const char *value)
 {
   struct HttpRequest *hr = cls;
   char *hdr;
@@ -900,12 +895,12 @@ con_val_iter (void *cls,
   (void) kind;
 
   if ((0 == strcmp (MHD_HTTP_HEADER_ACCEPT_ENCODING,
-                    key)))
+                    key)) ||
+    (0 == strcmp (MHD_HTTP_HEADER_CONTENT_ENCODING,
+                  key)))
   {
-    TALER_LOG_INFO ("Compressed request\n");
-    curl_easy_setopt (hr->curl,
-                      CURLOPT_ENCODING,
-                      value); 
+    TALER_LOG_INFO ("Do not re-compress request and/or do not"
+                    " ask for compressed responses\n");
     return MHD_YES;
   }
 
@@ -964,6 +959,7 @@ walk_response_object (const char *path,
   char *last_token;
   char *path_dup;
 
+  GNUNET_assert (NULL != json);
   GNUNET_asprintf (&path_dup,
                    ".%s", /* Make sure path starts with dot. */
                    path);
@@ -1116,7 +1112,7 @@ modify_object (struct MHD_Connection *con,
  * Flip a random character to the string pointed to by @a path.
  *
  * @param con FIXME deprecated.
- * @param json the object whose filed will be flipped.
+ * @param json the object whose field will be flipped.
  * @param flip_path the path to the string-field to flip.
  */
 static void
@@ -1250,52 +1246,98 @@ delete_object (struct MHD_Connection *con,
   return;
 }
 
-
 /**
- * Try to compress a response body.
- * Updates @a buf and @a buf_size.
+ * Decompress data.
  *
- * @param[in,out] buf pointer to body to compress
- * @param[in,out] buf_size pointer to initial size of @a buf
- * @return #MHD_YES if @a buf was compressed
+ * @param request contains input data to inflate
+ * @return result code indicating the status of the operation
  */
 static int
-body_compress (void **buf,
-               size_t *buf_size)
+inflate_data (struct HttpRequest *request)
 {
-  Bytef *cbuf;
-  uLongf cbuf_size;
+  z_stream z;
+  char *tmp;
+  size_t tmp_size;
   int ret;
 
-  cbuf_size = compressBound (*buf_size);
-  cbuf = malloc (cbuf_size);
-  if (NULL == cbuf)
+  memset (&z, 0, sizeof (z));
+  z.next_in = (Bytef *) request->io_buf;
+  z.avail_in = request->io_len;
+  tmp_size = GNUNET_MIN (REQUEST_BUFFER_MAX, request->io_len * 4);
+  tmp = GNUNET_malloc (tmp_size);
+  z.next_out = (Bytef *) tmp;
+  z.avail_out = tmp_size;
+  ret = inflateInit (&z);
+  switch (ret)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not allocate the compression buffer\n");
-    return MHD_NO;
+  case Z_MEM_ERROR:
+    GNUNET_break (0);
+    return GNUNET_JSON_PR_OUT_OF_MEMORY;
+  case Z_STREAM_ERROR:
+    GNUNET_break_op (0);
+    return GNUNET_JSON_PR_JSON_INVALID;
+  case Z_OK:
+    break;
   }
-
-  ret = compress (cbuf,
-                 &cbuf_size,
-                 (const Bytef *) *buf,
-                 *buf_size);
-
-  if (Z_OK != ret)
+  while (1)
   {
-    /* compression failed */
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Compression failed\n");
-    free (cbuf);
-    return MHD_NO;
-  }
-  free (*buf);
-  *buf = (void *) cbuf;
-  *buf_size = (size_t) cbuf_size;
-  return MHD_YES;
+    ret = inflate (&z, 0);
+    switch (ret)
+    {
+    case Z_MEM_ERROR:
+      GNUNET_break (0);
+      GNUNET_break (Z_OK == inflateEnd (&z));
+      GNUNET_free (tmp);
+      return GNUNET_JSON_PR_OUT_OF_MEMORY;
+    case Z_DATA_ERROR:
+      GNUNET_break (0);
+      GNUNET_break (Z_OK == inflateEnd (&z));
+      GNUNET_free (tmp);
+      return GNUNET_JSON_PR_JSON_INVALID;
+    case Z_NEED_DICT:
+      GNUNET_break (0);
+      GNUNET_break (Z_OK == inflateEnd (&z));
+      GNUNET_free (tmp);
+      return GNUNET_JSON_PR_JSON_INVALID;
+    case Z_OK:
+      if ((0 < z.avail_out) && (0 == z.avail_in))
+      {
+        /* truncated input stream */
+        GNUNET_break (0);
+        GNUNET_break (Z_OK == inflateEnd (&z));
+        GNUNET_free (tmp);
+        return GNUNET_JSON_PR_JSON_INVALID;
+      }
+      if (0 < z.avail_out)
+        continue; /* just call it again */
+      /* output buffer full, can we grow it? */
+      if (tmp_size == REQUEST_BUFFER_MAX)
+      {
+        /* already at max */
+        GNUNET_break (0);
+        GNUNET_break (Z_OK == inflateEnd (&z));
+        GNUNET_free (tmp);
+        return GNUNET_JSON_PR_OUT_OF_MEMORY;
+      }
+      if (tmp_size * 2 < tmp_size)
+        tmp_size = REQUEST_BUFFER_MAX;
+      else
+        tmp_size = GNUNET_MIN (REQUEST_BUFFER_MAX, tmp_size * 2);
+      tmp = GNUNET_realloc (tmp, tmp_size);
+      z.next_out = (Bytef *) &tmp[z.total_out];
+      continue;
+    case Z_STREAM_END:
+      /* decompression successful, make 'tmp' the new 'data' */
+      GNUNET_free (request->io_buf);
+      request->io_buf = tmp;
+      request->io_size = tmp_size;
+      request->io_len = z.total_out;
+      GNUNET_break (Z_OK == inflateEnd (&z));
+      return GNUNET_JSON_PR_SUCCESS; /* at least for now */
+    }
+  } /* while (1) */
 }
 
-
 /**
  * Main MHD callback for handling requests.
  *
@@ -1344,7 +1386,7 @@ create_response (void *cls,
 
   if (REQUEST_STATE_WITH_MHD == hr->state)
   {
-    hr->state = REQUEST_STATE_UPLOAD_STARTED;
+    hr->state = REQUEST_STATE_CLIENT_UPLOAD_STARTED;
     /* TODO: hacks for 100 continue suppression would go here! */
     return MHD_YES;
   }
@@ -1353,7 +1395,7 @@ create_response (void *cls,
   if (0 != *upload_data_size)
   {
     GNUNET_assert
-      (REQUEST_STATE_UPLOAD_STARTED == hr->state);
+      (REQUEST_STATE_CLIENT_UPLOAD_STARTED == hr->state);
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Processing %u bytes UPLOAD\n",
@@ -1381,21 +1423,46 @@ create_response (void *cls,
 
     hr->io_len += *upload_data_size;
     *upload_data_size = 0;
-    if (GNUNET_YES == hr->curl_paused)
-    {
-      hr->curl_paused = GNUNET_NO;
-      curl_easy_pause (hr->curl,
-                       CURLPAUSE_CONT);
-    }
+
     return MHD_YES;
   }
 
-  /* Upload (*from the client*) finished */
-  if (REQUEST_STATE_UPLOAD_STARTED == hr->state)
+  /* Upload (*from the client*) finished or just a without-body
+   * request.  */
+  if (REQUEST_STATE_CLIENT_UPLOAD_STARTED == hr->state)
   {
+    hr->state = REQUEST_STATE_CLIENT_UPLOAD_DONE;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Finished processing UPLOAD\n");
-    hr->state = REQUEST_STATE_UPLOAD_DONE;
+    if (0 != hr->io_len)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Attempting to decompress\n");
+      #if 1
+      const char *ce;
+      ce = MHD_lookup_connection_value
+        (con,
+         MHD_HEADER_KIND,
+         MHD_HTTP_HEADER_CONTENT_ENCODING);
+      if ((NULL != ce) && (0 == strcmp ("deflate", ce)))
+        GNUNET_assert (Z_OK == inflate_data (hr));
+      #endif
+
+      json_error_t error;
+      hr->json = json_loadb (hr->io_buf,
+                             hr->io_len,
+                             JSON_DECODE_ANY,
+                             &error);
+      if (NULL == hr->json)
+      {
+        TALER_LOG_ERROR
+          ("Could not parse JSON from client: %s (%s)\n",
+           error.text,
+           error.source);
+        /* Quick and dirty.  */
+        return MHD_NO;
+      }
+    }
   }
 
   /* generate curl request to the proxied service. */
@@ -1419,27 +1486,9 @@ create_response (void *cls,
                   "Will try to flip: %s\n",
                   flip_path_ul);
 
-      GNUNET_assert (0 == strcmp (MHD_HTTP_METHOD_POST,
-                                  meth));
-      GNUNET_break
-        (GNUNET_JSON_PR_SUCCESS != GNUNET_JSON_post_parser
-          (REQUEST_BUFFER_MAX,
-           con,
-           con_cls,
-           hr->io_buf,
-           &hr->io_len,
-           &hr->json));
-
       flip_object (con,
                    hr->json,
                    flip_path_ul);
-      /* Existing io_len is enough to accomodate this encoding. */
-      json_dumpb (hr->json,
-                  hr->io_buf,
-                  hr->io_len,
-                  JSON_COMPACT);
-
-      json_decref (hr->json);
     }
 
     if ('\0' != modify_path_ul[0])
@@ -1448,29 +1497,18 @@ create_response (void *cls,
                   "Will try to modify: %s\n",
                   flip_path_ul);
 
-      GNUNET_assert (0 == strcmp (MHD_HTTP_METHOD_POST,
-                                  meth));
-      GNUNET_break
-        (GNUNET_JSON_PR_SUCCESS != GNUNET_JSON_post_parser
-          (REQUEST_BUFFER_MAX,
-           con,
-           con_cls,
-           hr->io_buf,
-           &hr->io_len,
-           &hr->json));
-
       modify_object (con,
                      hr->json,
                      modify_path_ul);
-
-      /* Existing io_len is enough to accomodate this encoding. */
-      json_dumpb (hr->json,
-                  hr->io_buf,
-                  hr->io_len,
-                  JSON_COMPACT);
-      json_decref (hr->json);
     }
 
+    /* Existing io_len is enough to accomodate this encoding. */
+    json_dumpb (hr->json,
+                hr->io_buf,
+                hr->io_len,
+                JSON_COMPACT);
+    json_decref (hr->json);
+
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Generating curl request\n");
     hr->curl = curl_easy_init ();
@@ -1481,10 +1519,12 @@ create_response (void *cls,
                                  MHD_HTTP_INTERNAL_SERVER_ERROR,
                                  curl_failure_response);
     }
-    if (0 != hr->io_len)
-      curl_easy_setopt (hr->curl,
-                       CURLOPT_POSTFIELDSIZE,
-                       hr->io_len);
+
+    /* No need to check whether we're POSTing or PUTting.
+     * If not needed, this value will just be ignored.*/
+    curl_easy_setopt (hr->curl,
+                      CURLOPT_POSTFIELDSIZE,
+                     hr->io_len);
     curl_easy_setopt (hr->curl,
                       CURLOPT_HEADERFUNCTION,
                       &curl_check_hdr);
@@ -1527,12 +1567,16 @@ create_response (void *cls,
     if (0 == strcasecmp (meth,
                         MHD_HTTP_METHOD_PUT))
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Crafting a CURL PUT request\n");
+
       curl_easy_setopt (hr->curl,
                        CURLOPT_UPLOAD,
                        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);
@@ -1567,14 +1611,13 @@ create_response (void *cls,
       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_VERBOSE,
                         1L);
+      hr->state = REQUEST_STATE_PROXY_UPLOAD_STARTED;
       GNUNET_assert
         (CURLE_OK == curl_easy_setopt
           (hr->curl,
@@ -1615,7 +1658,7 @@ create_response (void *cls,
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_HEAD))
     {
-      hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
+      hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
       curl_easy_setopt (hr->curl,
                        CURLOPT_NOBODY,
                        1L);
@@ -1623,7 +1666,7 @@ create_response (void *cls,
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_OPTIONS))
     {
-      hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
+      hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
       curl_easy_setopt (hr->curl,
                        CURLOPT_CUSTOMREQUEST,
                        "OPTIONS");
@@ -1631,7 +1674,7 @@ create_response (void *cls,
     else if (0 == strcasecmp (meth,
                              MHD_HTTP_METHOD_GET))
     {
-      hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
+      hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
       curl_easy_setopt (hr->curl,
                        CURLOPT_HTTPGET,
                        1L);
@@ -1692,19 +1735,17 @@ create_response (void *cls,
                       hr->headers);
     curl_download_prepare ();
 
-    /* means (?) upload is over.  */
-    if (0 == hr->io_len)
-      hr->state = REQUEST_STATE_DOWNLOAD_STARTED;
     return MHD_YES;
   }
 
-  if (REQUEST_STATE_DOWNLOAD_DONE != hr->state)
+  if (REQUEST_STATE_PROXY_DOWNLOAD_DONE != hr->state)
   {
     MHD_suspend_connection (con);
     hr->suspended = GNUNET_YES;
     return MHD_YES; /* wait for curl */
   }
 
+  GNUNET_assert (REQUEST_STATE_PROXY_DOWNLOAD_DONE == hr->state);
   if (0 != hack_response_code)
   {
     hr->response_code = hack_response_code;
@@ -1759,14 +1800,6 @@ create_response (void *cls,
     malform = GNUNET_NO;
   }
 
-  /**
-   * COMPRESSION STARTS HERE.
-   */
-  if (GNUNET_YES == hr->deflate)
-    GNUNET_assert
-      (MHD_YES == body_compress ((void **) &hr->io_buf,
-                                 &hr->io_len));
-
   hr->response = MHD_create_response_from_buffer
     (hr->io_len,
      hr->io_buf,
@@ -1836,10 +1869,6 @@ mhd_completed_cb (void *cls,
     hr->io_len = 0;
   }
 
-  if ((NULL != hr->mod_response))
-    /* Destroy hacked responses. */
-    MHD_destroy_response (hr->mod_response);
-
   if ( (NULL != hr->response) &&
        (curl_failure_response != hr->response) )
     /* Destroy non-error responses... (?) */

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



reply via email to

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