From 12c8ee5ba53d7e11fdefbc183d048474b9e3358f Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 11 Apr 2018 16:54:03 -0400 Subject: [PATCH] rgw: fix use of libcurl with empty header values Fixes: http://tracker.ceph.com/issues/23663 Signed-off-by: Casey Bodley (cherry picked from commit f8df37615dda5d178666f30a055d7ff4fcdb9623) --- src/rgw/rgw_http_client.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index 72c8a14f1db9..61146748d635 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -350,8 +350,13 @@ static curl_slist *headers_to_slist(param_vec_t& headers) } } - val.append(": "); - val.append(p.second); + // curl won't send headers with empty values unless it ends with a ; instead + if (p.second.empty()) { + val.append(1, ';'); + } else { + val.append(": "); + val.append(p.second); + } h = curl_slist_append(h, val.c_str()); } -- 2.47.3