From 1a7fbccc8b3fd6fc070d134892e736503286ef1b Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Wed, 13 Jun 2018 18:38:08 +0200 Subject: Expanding libgnunetcurl. Adding a method to let the user append a custom request header. --- src/curl/curl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/curl') diff --git a/src/curl/curl.c b/src/curl/curl.c index 2d0b09d92..cdd39ab8e 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -447,6 +447,25 @@ download_get_result (struct DownloadBuffer *db, } +/** + * Add custom request header. + * + * @param ctx cURL context. + * @param header header string; will be given to the context AS IS. + * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. + */ +int +GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, + const char *header) +{ + ctx->json_header = curl_slist_append (ctx->json_header, + header); + if (NULL == ctx->json_header) + return GNUNET_SYSERR; + + return GNUNET_OK; +} + /** * Run the main event loop for the Taler interaction. * -- cgit v1.2.3