diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd.c')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 00e4689c..1c8b80d0 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -145,6 +145,17 @@ static uint16_t port; * Should a "Connection: close" header be added to each HTTP response? */ static int merchant_connection_close; +/** + * Context for all exchange operations (useful to the event loop). + * FIXME: rename, move to taler-merchant-httpd.c + */ +struct GNUNET_CURL_Context *TMH_curl_ctx; + +/** + * Context for integrating #TMH_curl_ctx with the + * GNUnet event loop. + */ +static struct GNUNET_CURL_RescheduleContext *merchant_curl_rc; /** * Global return code @@ -329,6 +340,16 @@ do_shutdown (void *cls) TMH_by_id_map = NULL; } TALER_TEMPLATING_done (); + if (NULL != TMH_curl_ctx) + { + GNUNET_CURL_fini (TMH_curl_ctx); + TMH_curl_ctx = NULL; + } + if (NULL != merchant_curl_rc) + { + GNUNET_CURL_gnunet_rc_destroy (merchant_curl_rc); + merchant_curl_rc = NULL; + } } @@ -1915,6 +1936,25 @@ run (void *cls, result = GNUNET_SYSERR; GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); + + TMH_curl_ctx + = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, + &merchant_curl_rc); + if (NULL == TMH_curl_ctx) + { + GNUNET_break (0); + result = GNUNET_SYSERR; + GNUNET_SCHEDULER_shutdown (); + return; + } + merchant_curl_rc = GNUNET_CURL_gnunet_rc_create (TMH_curl_ctx); + /* Disable 100 continue processing */ + GNUNET_break (GNUNET_OK == + GNUNET_CURL_append_header (TMH_curl_ctx, + MHD_HTTP_HEADER_EXPECT ":")); + GNUNET_CURL_enable_async_scope_header (TMH_curl_ctx, + "Taler-Correlation-Id"); + if (GNUNET_OK != TALER_config_get_currency (cfg, &TMH_currency)) |