gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: fix calculation of


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: fix calculation of 'Expires:' header, also handle HTTP HEAD requests
Date: Tue, 26 Sep 2017 13:55:40 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 4728534  fix calculation of 'Expires:' header, also handle HTTP HEAD 
requests
4728534 is described below

commit 472853442f481e309d38e46d40ba22e01f76f1f1
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Sep 26 13:56:33 2017 +0200

    fix calculation of 'Expires:' header, also handle HTTP HEAD requests
---
 src/exchange/taler-exchange-httpd.c          |  3 +++
 src/exchange/taler-exchange-httpd_keystate.c | 29 ++++++++++++++++------------
 src/exchange/taler-exchange-httpd_mhd.c      |  8 ++++----
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 25021f3..60b7810 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -320,6 +320,9 @@ handle_mhd_request (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Handling request for URL '%s'\n",
               url);
+  if (0 == strcasecmp (method,
+                       MHD_HTTP_METHOD_HEAD))
+    method = MHD_HTTP_METHOD_GET; /* treat HEAD as GET here, MHD will do the 
rest */
   for (unsigned int i=0;NULL != handlers[i].url;i++)
   {
     rh = &handlers[i];
diff --git a/src/exchange/taler-exchange-httpd_keystate.c 
b/src/exchange/taler-exchange-httpd_keystate.c
index cb704dd..06bb504 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -1047,12 +1047,15 @@ setup_general_response_headers (const struct 
TEH_KS_StateHandle *key_state,
                 MHD_add_response_header (response,
                                          MHD_HTTP_HEADER_LAST_MODIFIED,
                                          dat));
-  get_date_string (key_state->next_reload,
-                   dat);
-  GNUNET_break (MHD_YES ==
-                MHD_add_response_header (response,
-                                         MHD_HTTP_HEADER_EXPIRES,
-                                         dat));
+  if (0 != key_state->next_reload.abs_value_us)
+  {
+    get_date_string (key_state->next_reload,
+                     dat);
+    GNUNET_break (MHD_YES ==
+                  MHD_add_response_header (response,
+                                           MHD_HTTP_HEADER_EXPIRES,
+                                           dat));
+  }
   return GNUNET_OK;
 }
 
@@ -1458,6 +1461,13 @@ make_fresh_key_state ()
     off++;
   }
 
+  /* Compute next automatic reload time */
+  key_state->next_reload =
+    GNUNET_TIME_absolute_min (GNUNET_TIME_absolute_ntoh 
(key_state->current_sign_key_issue.issue.expire),
+                              key_state->min_dk_expire);
+  GNUNET_assert (0 != key_state->next_reload.abs_value_us);
+
+
   /* Initialize `krd_array` */
   key_state->krd_array_length = off;
   key_state->krd_array
@@ -1487,6 +1497,7 @@ make_fresh_key_state ()
     }
     last = d;
   }
+
   /* Finally, build an `empty` response without denomination keys
      for requests past the last known denomination key start date */
   if ( (off + 1 < key_state->krd_array_length) ||
@@ -1503,12 +1514,6 @@ make_fresh_key_state ()
     return NULL;
   }
 
-  /* Compute next automatic reload time */
-  key_state->next_reload =
-    GNUNET_TIME_absolute_min (GNUNET_TIME_absolute_ntoh 
(key_state->current_sign_key_issue.issue.expire),
-                                key_state->min_dk_expire);
-  GNUNET_assert (0 != key_state->next_reload.abs_value_us);
-
   /* Clean up intermediary state we don't need anymore and return
      new key_state! */
   destroy_response_factory (&rfc);
diff --git a/src/exchange/taler-exchange-httpd_mhd.c 
b/src/exchange/taler-exchange-httpd_mhd.c
index ee1781a..e76ada2 100644
--- a/src/exchange/taler-exchange-httpd_mhd.c
+++ b/src/exchange/taler-exchange-httpd_mhd.c
@@ -89,10 +89,10 @@ TEH_MHD_handler_static_response (struct TEH_RequestHandler 
*rh,
  */
 int
 TEH_MHD_handler_agpl_redirect (struct TEH_RequestHandler *rh,
-                                  struct MHD_Connection *connection,
-                                  void **connection_cls,
-                                  const char *upload_data,
-                                  size_t *upload_data_size)
+                               struct MHD_Connection *connection,
+                               void **connection_cls,
+                               const char *upload_data,
+                               size_t *upload_data_size)
 {
   const char *agpl =
     "This server is licensed under the Affero GPL. You will now be redirected 
to the source code.";

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



reply via email to

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