From 728d08a60bd2bb0bbd1149115288fff0572d6dd4 Mon Sep 17 00:00:00 2001 From: Ilya Kosarev <i.kosarev@tarantool.org> Date: Mon, 28 Oct 2019 17:01:21 +0300 Subject: [PATCH] httpc: fix assertion fail after curl write error After executing curl request we need to process curl_request code. It might be CURLE_WRITE_ERROR. We had special case for it, which assumed diagnostic message being set and contained corresponding assert, though it is incorrect. Better way is to handle it as any other non-standard event. It was discovered while adding accept_encoding option. In case of unknown encoding curl_request code is currently set to CURLE_WRITE_ERROR and therefore we come to an assert assuming we have some diagnostics set. However, it is not being set and it is totally fine. This means we are failing on assert and it is not correct behavior. Prerequisites: #4232 Reviewed-by: Alexander Turenko <alexander.turenko@tarantool.org> --- src/httpc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/httpc.c b/src/httpc.c index 8d18b9966a..2120640803 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -429,16 +429,12 @@ httpc_execute(struct httpc_request *req, double timeout) case CURLE_COULDNT_RESOLVE_PROXY: case CURLE_COULDNT_RESOLVE_HOST: case CURLE_COULDNT_CONNECT: + case CURLE_WRITE_ERROR: /* 595 Connection Problem (AnyEvent non-standard) */ req->status = 595; req->reason = curl_easy_strerror(req->curl_request.code); ++env->stat.failed_requests; break; - case CURLE_WRITE_ERROR: - /* Diag is already set by curl_write_cb() */ - assert(!diag_is_empty(&fiber()->diag)); - ++env->stat.failed_requests; - return -1; case CURLE_OUT_OF_MEMORY: diag_set(OutOfMemory, 0, "curl", "internal"); ++env->stat.failed_requests; -- GitLab