]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix use of libcurl with empty header values 21738/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 11 Apr 2018 20:54:03 +0000 (16:54 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 30 Apr 2018 13:21:37 +0000 (09:21 -0400)
Fixes: http://tracker.ceph.com/issues/23663
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f8df37615dda5d178666f30a055d7ff4fcdb9623)

src/rgw/rgw_http_client.cc

index 72c8a14f1db9d06c92884aa63b8b7038b8151168..61146748d635f58be05ec10e961110341c196443 100644 (file)
@@ -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());
   }