diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-09-26 13:56:33 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-09-26 13:56:33 +0200 |
commit | 472853442f481e309d38e46d40ba22e01f76f1f1 (patch) | |
tree | 193720cec3c71add324644e104701c374d6c7fad | |
parent | a8de810bf7b78308976791b78311c36b69139b26 (diff) | |
download | exchange-472853442f481e309d38e46d40ba22e01f76f1f1.tar.xz |
fix calculation of 'Expires:' header, also handle HTTP HEAD requests
-rw-r--r-- | src/exchange/taler-exchange-httpd.c | 3 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 29 | ||||
-rw-r--r-- | 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 25021f30f..60b781032 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 cb704dd03..06bb50492 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 ee1781a1e..e76ada2cd 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."; |