From 9bdf2bab97d47603607455c61e91dae4b5d3ca5a Mon Sep 17 00:00:00 2001
From: Sergey Bronnikov <sergeyb@tarantool.org>
Date: Tue, 26 Dec 2023 18:05:18 +0300
Subject: [PATCH] httpc: fix reading data in a chunked request

There was a problem: chunked request to etcd via TLS using builtin http
client returns nothing. The problem was reproduced quite often by a test
`integration.general.tls` in etcd-client Lua module. The patch updates
curl submodule to a version based on 8.5.0 release with applied patch
with fix [1].

The patch also removes workaround for aforementioned problem made in
commit aa58c21206f0 ("httpc: use http 1.1 by default").

1. https://github.com/curl/curl/commit/cdd905a9854305657ebbe645095e1189dcda28c7

Fixes #9547

NO_TEST=etcd-client tests
NO_DOC=bugfix
---
 .../unreleased/gh-9547-fix-reading-data-in-chunked-request.md | 4 ++++
 src/httpc.c                                                   | 2 --
 third_party/curl                                              | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 changelogs/unreleased/gh-9547-fix-reading-data-in-chunked-request.md

diff --git a/changelogs/unreleased/gh-9547-fix-reading-data-in-chunked-request.md b/changelogs/unreleased/gh-9547-fix-reading-data-in-chunked-request.md
new file mode 100644
index 0000000000..d5a2dc09aa
--- /dev/null
+++ b/changelogs/unreleased/gh-9547-fix-reading-data-in-chunked-request.md
@@ -0,0 +1,4 @@
+## bugfix/httpc
+
+* Fixed a bug when read from a chunked request returns
+  nothing (gh-9547).
diff --git a/src/httpc.c b/src/httpc.c
index 43f425c4bd..30327afd4f 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -214,8 +214,6 @@ httpc_request_new(struct httpc_env *env, const char *method,
 			 curl_easy_header_cb);
 	curl_easy_setopt(req->curl_request.easy, CURLOPT_NOPROGRESS, 1L);
 	curl_easy_setopt(req->curl_request.easy, CURLOPT_NOSIGNAL, 1L);
-	curl_easy_setopt(req->curl_request.easy, CURLOPT_HTTP_VERSION,
-			 CURL_HTTP_VERSION_1_1);
 
 	ibuf_create(&req->send, &cord()->slabc, 1);
 
diff --git a/third_party/curl b/third_party/curl
index 7161cb17c0..b98711437b 160000
--- a/third_party/curl
+++ b/third_party/curl
@@ -1 +1 @@
-Subproject commit 7161cb17c01dcff1dc5bf89a18437d9d729f1ecd
+Subproject commit b98711437b6bde3f8b2d61842d041c67d30f494e
-- 
GitLab