From a9f01707ad64fc554077ca109ba03128ed8294be Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 21 Sep 2015 10:43:22 +0200 Subject: add option -C to force closing of connections --- src/mint/taler-mint-httpd_responses.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mint/taler-mint-httpd_responses.c') diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 367b1904..50a0553e 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -29,6 +29,23 @@ #include "taler-mint-httpd_keystate.h" +/** + * Add headers we want to return in every response. + * Useful for testing, like if we want to always close + * connections. + * + * @param response response to modify + */ +void +TMH_RESPONSE_add_global_headers (struct MHD_Response *response) +{ + if (TMH_mint_connection_close) + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "close"); +} + + /** * Send JSON object as response. * @@ -56,6 +73,7 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, GNUNET_break (0); return MHD_NO; } + TMH_RESPONSE_add_global_headers (resp); (void) MHD_add_response_header (resp, MHD_HTTP_HEADER_CONTENT_TYPE, "application/json"); @@ -292,6 +310,7 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection) MHD_RESPMEM_PERSISTENT); if (NULL == resp) return MHD_NO; + TMH_RESPONSE_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, resp); -- cgit v1.2.3