diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-17 14:39:52 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-17 14:39:52 +0200 |
commit | a6b21080099a4b6777749759238464f87f7d013c (patch) | |
tree | cbdaf4e09a065edd40171770ae19d5ebba3792d0 /src | |
parent | a6a1fa9fded4f2443479a3ee2a9c7f0c2fa411cd (diff) | |
download | exchange-a6b21080099a4b6777749759238464f87f7d013c.tar.gz exchange-a6b21080099a4b6777749759238464f87f7d013c.tar.bz2 exchange-a6b21080099a4b6777749759238464f87f7d013c.zip |
-check for ETag in request, generate 304 if applicable
Diffstat (limited to 'src')
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 5a6a506e6..0fde1d673 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -2854,7 +2854,11 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc, const char *const args[]) { struct GNUNET_TIME_Timestamp last_issue_date; + const char *etag; + etag = MHD_lookup_connection_value (rc->connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_IF_NONE_MATCH); (void) args; { const char *have_cherrypick; @@ -2935,6 +2939,31 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc, Wait until they are. */ return suspend_request (rc->connection); } + if ( (NULL != etag) && + (0 == strcmp (etag, + krd->etag)) ) + { + MHD_RESULT ret; + struct MHD_Response *resp; + + resp = MHD_create_response_from_buffer (0, + NULL, + MHD_RESPMEM_PERSISTENT); + TALER_MHD_add_global_headers (resp); + GNUNET_break (GNUNET_OK == + setup_general_response_headers (ksh, + resp)); + GNUNET_break (MHD_YES == + MHD_add_response_header (resp, + MHD_HTTP_HEADER_ETAG, + krd->etag)); + ret = MHD_queue_response (rc->connection, + MHD_HTTP_NOT_MODIFIED, + resp); + GNUNET_break (MHD_YES == ret); + MHD_destroy_response (resp); + return ret; + } return MHD_queue_response (rc->connection, MHD_HTTP_OK, (MHD_YES == |