diff options
Diffstat (limited to 'src/curl/curl.c')
-rw-r--r-- | src/curl/curl.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/src/curl/curl.c b/src/curl/curl.c index f19790338..a0a027995 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -2,17 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2014, 2015, 2016, 2018 GNUnet e.V. | 3 | Copyright (C) 2014, 2015, 2016, 2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | terms of the GNU General Public License as published by the Free Software | 6 | under the terms of the GNU Affero General Public License as published |
7 | Foundation; either version 3, or (at your option) any later version. | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | 8 | or (at your option) any later version. | |
9 | GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY | 9 | |
10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | You should have received a copy of the GNU General Public License along with | 13 | Affero General Public License for more details. |
14 | GNUnet; see the file COPYING. If not, If not, see | 14 | |
15 | <http://www.gnu.org/licenses/> | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 17 | */ |
17 | /** | 18 | /** |
18 | * @file curl/curl.c | 19 | * @file curl/curl.c |
@@ -410,8 +411,9 @@ download_get_result (struct DownloadBuffer *db, | |||
410 | GNUNET_break (0); | 411 | GNUNET_break (0); |
411 | *response_code = 0; | 412 | *response_code = 0; |
412 | } | 413 | } |
413 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 414 | if (0 != db->buf_size) |
414 | "Did NOT detect response as JSON\n"); | 415 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
416 | "Did NOT detect response as JSON\n"); | ||
415 | return NULL; | 417 | return NULL; |
416 | } | 418 | } |
417 | json = NULL; | 419 | json = NULL; |
@@ -447,6 +449,25 @@ download_get_result (struct DownloadBuffer *db, | |||
447 | 449 | ||
448 | 450 | ||
449 | /** | 451 | /** |
452 | * Add custom request header. | ||
453 | * | ||
454 | * @param ctx cURL context. | ||
455 | * @param header header string; will be given to the context AS IS. | ||
456 | * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. | ||
457 | */ | ||
458 | int | ||
459 | GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, | ||
460 | const char *header) | ||
461 | { | ||
462 | ctx->json_header = curl_slist_append (ctx->json_header, | ||
463 | header); | ||
464 | if (NULL == ctx->json_header) | ||
465 | return GNUNET_SYSERR; | ||
466 | |||
467 | return GNUNET_OK; | ||
468 | } | ||
469 | |||
470 | /** | ||
450 | * Run the main event loop for the Taler interaction. | 471 | * Run the main event loop for the Taler interaction. |
451 | * | 472 | * |
452 | * @param ctx the library context | 473 | * @param ctx the library context |