gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add 'Expires' header to ToS and


From: gnunet
Subject: [taler-exchange] branch master updated: add 'Expires' header to ToS and PP replies
Date: Thu, 12 May 2022 13:38:53 +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 6cf4a068 add 'Expires' header to ToS and PP replies
6cf4a068 is described below

commit 6cf4a068ad58f22d1896d322fc96b59d1120a98c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu May 12 13:38:47 2022 +0200

    add 'Expires' header to ToS and PP replies
---
 src/mhd/mhd_legal.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index 2ef36957..64c176a9 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -27,6 +27,11 @@
 #include "taler_util.h"
 #include "taler_mhd_lib.h"
 
+/**
+ * How long should browsers/proxies cache the "legal" replies?
+ */
+#define MAX_TERMS_CACHING GNUNET_TIME_UNIT_DAYS
+
 
 /**
  * Entry in the terms-of-service array.
@@ -167,7 +172,17 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
 {
   struct MHD_Response *resp;
   struct Terms *t;
-
+  struct GNUNET_TIME_Absolute a;
+  struct GNUNET_TIME_Timestamp m;
+  char dat[128];
+
+  a = GNUNET_TIME_relative_to_absolute (MAX_TERMS_CACHING);
+  m = GNUNET_TIME_absolute_to_timestamp (a);
+  get_date_string (m.abs_time,
+                   dat);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Setting 'Expires' header to '%s'\n",
+              dat);
   if (NULL != legal)
   {
     const char *etag;
@@ -186,6 +201,15 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
                                               NULL,
                                               MHD_RESPMEM_PERSISTENT);
       TALER_MHD_add_global_headers (resp);
+      GNUNET_break (MHD_YES ==
+                    MHD_add_response_header (resp,
+                                             MHD_HTTP_HEADER_EXPIRES,
+                                             dat));
+
+      GNUNET_break (MHD_YES ==
+                    MHD_add_response_header (resp,
+                                             MHD_HTTP_HEADER_ETAG,
+                                             legal->terms_etag));
       ret = MHD_queue_response (conn,
                                 MHD_HTTP_NOT_MODIFIED,
                                 resp);
@@ -278,6 +302,11 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
                                             MHD_RESPMEM_PERSISTENT);
   }
   TALER_MHD_add_global_headers (resp);
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (resp,
+                                         MHD_HTTP_HEADER_EXPIRES,
+                                         dat));
+
   if (NULL != legal)
     GNUNET_break (MHD_YES ==
                   MHD_add_response_header (resp,

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