diff --git a/src/civetweb b/src/civetweb index 8d271315a5412..1912de95f532b 160000 --- a/src/civetweb +++ b/src/civetweb @@ -1 +1 @@ -Subproject commit 8d271315a541218caada366f84a2690fdbd474a2 +Subproject commit 1912de95f532bc6c4ed39be12f08df56ee3ca5c0 diff --git a/src/rgw/rgw_civetweb.cc b/src/rgw/rgw_civetweb.cc index 923da9a6f74d9..3f8d76a2ac112 100644 --- a/src/rgw/rgw_civetweb.cc +++ b/src/rgw/rgw_civetweb.cc @@ -24,6 +24,7 @@ int RGWMongoose::write_data(const char *buf, int len) RGWMongoose::RGWMongoose(mg_connection *_conn, int _port) : conn(_conn), port(_port), + has_content_length(false), explicit_keepalive(false), explicit_conn_close(false) { @@ -124,6 +125,10 @@ int RGWMongoose::send_100_continue() int RGWMongoose::complete_header() { + if (!has_content_length) { + mg_enforce_close(conn); + } + string str; if (explicit_keepalive) { str = "Connection: Keep-Alive\r\n"; @@ -138,6 +143,8 @@ int RGWMongoose::complete_header() int RGWMongoose::send_content_length(uint64_t len) { + has_content_length = true; + char buf[21]; snprintf(buf, sizeof(buf), "%" PRIu64, len); return print("Content-Length: %s\r\n", buf); diff --git a/src/rgw/rgw_civetweb.h b/src/rgw/rgw_civetweb.h index 2401b65b54299..7c5ff985a3799 100644 --- a/src/rgw/rgw_civetweb.h +++ b/src/rgw/rgw_civetweb.h @@ -17,6 +17,7 @@ class RGWMongoose : public RGWClientIO int port; + bool has_content_length; bool explicit_keepalive; bool explicit_conn_close;