merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 6ac0e0f5a04a194bf7b412b716ebed95956e3a9a
parent 3daed452626ca692bd149d2c57d909357a08ba5f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  2 Jun 2016 09:33:33 +0200

add support for -C option

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 8++++++++
Msrc/backend/taler-merchant-httpd.h | 5+++++
Msrc/backend/taler-merchant-httpd_responses.c | 8++------
3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c @@ -88,6 +88,11 @@ struct GNUNET_TIME_Relative wire_transfer_delay; char *TMH_merchant_currency_string; /** + * Should a "Connection: close" header be added to each HTTP response? + */ +int TMH_merchant_connection_close; + +/** * Task running the HTTP server. */ static struct GNUNET_SCHEDULER_Task *mhd_task; @@ -776,6 +781,9 @@ int main (int argc, char *const *argv) { static const struct GNUNET_GETOPT_CommandLineOption options[] = { + { 'C', "connection-close", NULL, + "force HTTP connections to be closed after each request", 0, + &GNUNET_GETOPT_set_one, &TMH_merchant_connection_close}, GNUNET_GETOPT_OPTION_END }; diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h @@ -172,6 +172,11 @@ extern struct GNUNET_CRYPTO_EddsaPrivateKey *privkey; extern struct TALER_MerchantPublicKeyP pubkey; /** + * Should a "Connection: close" header be added to each HTTP response? + */ +extern int TMH_merchant_connection_close; + +/** * Handle to the database backend. */ extern struct TALER_MERCHANTDB_Plugin *db; diff --git a/src/backend/taler-merchant-httpd_responses.c b/src/backend/taler-merchant-httpd_responses.c @@ -23,6 +23,7 @@ * @author Christian Grothoff */ #include "platform.h" +#include "taler-merchant-httpd.h" #include "taler-merchant-httpd_responses.h" #include <taler/taler_util.h> #include <gnunet/gnunet_util_lib.h> @@ -244,12 +245,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) void TMH_RESPONSE_add_global_headers (struct MHD_Response *response) { - int TMH_exchange_connection_close; - TMH_exchange_connection_close = 0; - - /* this test is taken verbatim from the exchange's code, - so there is no particular need to do that for a merchant */ - if (TMH_exchange_connection_close) + if (TMH_merchant_connection_close) (void) MHD_add_response_header (response, MHD_HTTP_HEADER_CONNECTION, "close");