diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-24 20:36:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-24 20:36:28 +0200 |
commit | 18903294439021a77377bc63c74b284c82ad3894 (patch) | |
tree | 1210ca5395b857ae95d2d495417a0458c1f8ef81 /src/curl | |
parent | bf99d2243fedaeb662b5d7b20138cf2ee064a110 (diff) | |
download | gnunet-18903294439021a77377bc63c74b284c82ad3894.tar.gz gnunet-18903294439021a77377bc63c74b284c82ad3894.zip |
handle 204 status code
Diffstat (limited to 'src/curl')
-rw-r--r-- | src/curl/Makefile.am | 2 | ||||
-rw-r--r-- | src/curl/curl.c | 21 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/curl/Makefile.am b/src/curl/Makefile.am index ed5819dee..c6b350bc7 100644 --- a/src/curl/Makefile.am +++ b/src/curl/Makefile.am | |||
@@ -32,7 +32,7 @@ libgnunetcurl_la_LIBADD = \ | |||
32 | $(LIB_GNURL) \ | 32 | $(LIB_GNURL) \ |
33 | $(XLIB) | 33 | $(XLIB) |
34 | libgnunetcurl_la_CPPFLAGS = \ | 34 | libgnunetcurl_la_CPPFLAGS = \ |
35 | $(CPP_GNURL) $(AM_CPPFLAGS) | 35 | $(CPP_GNURL) $(AM_CPPFLAGS) $(MHD_CFLAGS) |
36 | 36 | ||
37 | #check_PROGRAMS = \ | 37 | #check_PROGRAMS = \ |
38 | # test_curl | 38 | # test_curl |
diff --git a/src/curl/curl.c b/src/curl/curl.c index 72bb17789..b7452330f 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include <jansson.h> | 27 | #include <jansson.h> |
28 | #include <microhttpd.h> | ||
28 | #include "gnunet_curl_lib.h" | 29 | #include "gnunet_curl_lib.h" |
29 | 30 | ||
30 | #if ENABLE_BENCHMARK | 31 | #if ENABLE_BENCHMARK |
@@ -181,7 +182,8 @@ struct GNUNET_CURL_Context | |||
181 | * @return library context | 182 | * @return library context |
182 | */ | 183 | */ |
183 | struct GNUNET_CURL_Context * | 184 | struct GNUNET_CURL_Context * |
184 | GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, void *cb_cls) | 185 | GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, |
186 | void *cb_cls) | ||
185 | { | 187 | { |
186 | struct GNUNET_CURL_Context *ctx; | 188 | struct GNUNET_CURL_Context *ctx; |
187 | CURLM *multi; | 189 | CURLM *multi; |
@@ -263,7 +265,10 @@ GNUNET_CURL_is_valid_scope_id (const char *scope_id) | |||
263 | * @return number of bytes processed from @a bufptr | 265 | * @return number of bytes processed from @a bufptr |
264 | */ | 266 | */ |
265 | static size_t | 267 | static size_t |
266 | download_cb (char *bufptr, size_t size, size_t nitems, void *cls) | 268 | download_cb (char *bufptr, |
269 | size_t size, | ||
270 | size_t nitems, | ||
271 | void *cls) | ||
267 | { | 272 | { |
268 | struct GNUNET_CURL_DownloadBuffer *db = cls; | 273 | struct GNUNET_CURL_DownloadBuffer *db = cls; |
269 | size_t msize; | 274 | size_t msize; |
@@ -376,7 +381,9 @@ setup_job (CURL *eh, | |||
376 | } | 381 | } |
377 | job->easy_handle = eh; | 382 | job->easy_handle = eh; |
378 | job->ctx = ctx; | 383 | job->ctx = ctx; |
379 | GNUNET_CONTAINER_DLL_insert (ctx->jobs_head, ctx->jobs_tail, job); | 384 | GNUNET_CONTAINER_DLL_insert (ctx->jobs_head, |
385 | ctx->jobs_tail, | ||
386 | job); | ||
380 | return job; | 387 | return job; |
381 | } | 388 | } |
382 | 389 | ||
@@ -497,7 +504,11 @@ GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx, | |||
497 | curl_slist_append (NULL, "Content-Type: application/json"))); | 504 | curl_slist_append (NULL, "Content-Type: application/json"))); |
498 | } | 505 | } |
499 | 506 | ||
500 | job = GNUNET_CURL_job_add2 (ctx, eh, job_headers, jcc, jcc_cls); | 507 | job = GNUNET_CURL_job_add2 (ctx, |
508 | eh, | ||
509 | job_headers, | ||
510 | jcc, | ||
511 | jcc_cls); | ||
501 | curl_slist_free_all (job_headers); | 512 | curl_slist_free_all (job_headers); |
502 | return job; | 513 | return job; |
503 | } | 514 | } |
@@ -616,6 +627,8 @@ GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, | |||
616 | (const char *) db->buf); | 627 | (const char *) db->buf); |
617 | return NULL; | 628 | return NULL; |
618 | } | 629 | } |
630 | if (MHD_HTTP_NO_CONTENT == *response_code) | ||
631 | return NULL; | ||
619 | json = NULL; | 632 | json = NULL; |
620 | if (0 == db->eno) | 633 | if (0 == db->eno) |
621 | { | 634 | { |