gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: improve cache control support fo


From: gnunet
Subject: [taler-exchange] branch master updated: improve cache control support for /wire, /keys and legal
Date: Mon, 16 May 2022 11:56:13 +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 3db8f0f2 improve cache control support for /wire, /keys and legal
3db8f0f2 is described below

commit 3db8f0f22d0a7c1710b4c4f9097103b124c58971
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon May 16 11:56:10 2022 +0200

    improve cache control support for /wire, /keys and legal
---
 src/exchange/taler-exchange-httpd_keys.c | 10 ++++++++++
 src/exchange/taler-exchange-httpd_wire.c | 11 +++++++++++
 src/mhd/mhd_legal.c                      | 13 ++++++++++++-
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/exchange/taler-exchange-httpd_keys.c 
b/src/exchange/taler-exchange-httpd_keys.c
index a8484909..dea29f7d 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -1703,6 +1703,16 @@ setup_general_response_headers (struct 
TEH_KeyStateHandle *ksh,
       = GNUNET_TIME_timestamp_min (m,
                                    ksh->signature_expires);
   }
+  /* Set cache control headers: our response varies depending on these headers 
*/
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (response,
+                                         MHD_HTTP_HEADER_VARY,
+                                         MHD_HTTP_HEADER_ACCEPT_ENCODING));
+  /* Information is always public, revalidate after 1 hour */
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (response,
+                                         MHD_HTTP_HEADER_CACHE_CONTROL,
+                                         "public,max-age=3600"));
   return GNUNET_OK;
 }
 
diff --git a/src/exchange/taler-exchange-httpd_wire.c 
b/src/exchange/taler-exchange-httpd_wire.c
index e2baa1ce..aa187c1c 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -483,6 +483,17 @@ build_wire_state (void)
                                            wsh->dat));
   }
   TALER_MHD_add_global_headers (wsh->wire_reply);
+  /* Set cache control headers: our response varies depending on these headers 
*/
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (wsh->wire_reply,
+                                         MHD_HTTP_HEADER_VARY,
+                                         MHD_HTTP_HEADER_ACCEPT_ENCODING));
+  /* Information is always public, revalidate after 1 day */
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (wsh->wire_reply,
+                                         MHD_HTTP_HEADER_CACHE_CONTROL,
+                                         "public,max-age=86400"));
+
   {
     struct GNUNET_HashCode h;
     char etag[sizeof (h) * 2];
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index bd596862..5082c181 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -306,7 +306,18 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
                 MHD_add_response_header (resp,
                                          MHD_HTTP_HEADER_EXPIRES,
                                          dat));
-
+  /* Set cache control headers: our response varies depending on these headers 
*/
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (resp,
+                                         MHD_HTTP_HEADER_VARY,
+                                         MHD_HTTP_HEADER_ACCEPT_LANGUAGE ","
+                                         MHD_HTTP_HEADER_ACCEPT ","
+                                         MHD_HTTP_HEADER_ACCEPT_ENCODING));
+  /* Information is always public, revalidate after 10 days */
+  GNUNET_break (MHD_YES ==
+                MHD_add_response_header (resp,
+                                         MHD_HTTP_HEADER_CACHE_CONTROL,
+                                         "public max-age=864000"));
   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]