add 'Expires' header to ToS and PP replies
This commit is contained in:
parent
35b4a51e14
commit
6cf4a068ad
@ -27,6 +27,11 @@
|
|||||||
#include "taler_util.h"
|
#include "taler_util.h"
|
||||||
#include "taler_mhd_lib.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.
|
* Entry in the terms-of-service array.
|
||||||
@ -167,7 +172,17 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
{
|
{
|
||||||
struct MHD_Response *resp;
|
struct MHD_Response *resp;
|
||||||
struct Terms *t;
|
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)
|
if (NULL != legal)
|
||||||
{
|
{
|
||||||
const char *etag;
|
const char *etag;
|
||||||
@ -186,6 +201,15 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
NULL,
|
NULL,
|
||||||
MHD_RESPMEM_PERSISTENT);
|
MHD_RESPMEM_PERSISTENT);
|
||||||
TALER_MHD_add_global_headers (resp);
|
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,
|
ret = MHD_queue_response (conn,
|
||||||
MHD_HTTP_NOT_MODIFIED,
|
MHD_HTTP_NOT_MODIFIED,
|
||||||
resp);
|
resp);
|
||||||
@ -278,6 +302,11 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
MHD_RESPMEM_PERSISTENT);
|
MHD_RESPMEM_PERSISTENT);
|
||||||
}
|
}
|
||||||
TALER_MHD_add_global_headers (resp);
|
TALER_MHD_add_global_headers (resp);
|
||||||
|
GNUNET_break (MHD_YES ==
|
||||||
|
MHD_add_response_header (resp,
|
||||||
|
MHD_HTTP_HEADER_EXPIRES,
|
||||||
|
dat));
|
||||||
|
|
||||||
if (NULL != legal)
|
if (NULL != legal)
|
||||||
GNUNET_break (MHD_YES ==
|
GNUNET_break (MHD_YES ==
|
||||||
MHD_add_response_header (resp,
|
MHD_add_response_header (resp,
|
||||||
|
Loading…
Reference in New Issue
Block a user