]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/beast: fix interaction between keepalive and 100-continue 49642/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 5 Jan 2023 16:30:03 +0000 (11:30 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 5 Jan 2023 16:30:06 +0000 (11:30 -0500)
if we reject a request with a "Expect: 100-continue" header before
sending a "100 Continue" response, the keepalive logic should not try to
read/discard request body before parsing the next request headers

Fixes: https://tracker.ceph.com/issues/58286
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_asio_frontend.cc

index 71d145ed565522ebd65feb382c64787d315b8f81..000a0bc6a9f163be633f1d28532a6f9682d6820b 100644 (file)
@@ -229,6 +229,8 @@ void handle_connection(boost::asio::io_context& context,
       return;
     }
 
+    bool expect_continue = (message[http::field::expect] == "100-continue");
+
     {
       auto lock = pause_mutex.async_lock_shared(yield[ec]);
       if (ec == boost::asio::error::operation_aborted) {
@@ -285,6 +287,10 @@ void handle_connection(boost::asio::io_context& context,
             << log_header{message, http::field::range} << " latency="
             << latency << dendl;
       }
+
+      if (real_client.sent_100_continue()) {
+        expect_continue = false;
+      }
     }
 
     if (!parser.keep_alive()) {
@@ -293,7 +299,7 @@ void handle_connection(boost::asio::io_context& context,
 
     // if we failed before reading the entire message, discard any remaining
     // bytes before reading the next
-    while (!parser.is_done()) {
+    while (!expect_continue && !parser.is_done()) {
       static std::array<char, 1024> discard_buffer;
 
       auto& body = parser.get().body();