diff options
Diffstat (limited to 'src/mint-lib/mint_api_context.c')
-rw-r--r-- | src/mint-lib/mint_api_context.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mint-lib/mint_api_context.c b/src/mint-lib/mint_api_context.c index 9beeef14..5a14b4a4 100644 --- a/src/mint-lib/mint_api_context.c +++ b/src/mint-lib/mint_api_context.c @@ -435,6 +435,29 @@ MAC_download_get_result (struct MAC_DownloadBuffer *db, { json_t *json; json_error_t error; + char *ct; + + if ( (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_CONTENT_TYPE, + &ct)) || + (NULL == ct) || + (0 != strcasecmp (ct, + "application/json")) ) + { + /* No content type or explicitly not JSON, refuse to parse + (but keep response code) */ + if (CURLE_OK != + curl_easy_getinfo (eh, + CURLINFO_RESPONSE_CODE, + response_code)) + { + /* unexpected error... */ + GNUNET_break (0); + *response_code = 0; + } + return NULL; + } json = NULL; if (0 == db->eno) |