diff --git a/src/rgw/rgw_civetweb.cc b/src/rgw/rgw_civetweb.cc index 901b2ded8ac69..089250fd4f7ac 100644 --- a/src/rgw/rgw_civetweb.cc +++ b/src/rgw/rgw_civetweb.cc @@ -13,13 +13,18 @@ int RGWMongoose::write_data(const char *buf, int len) { if (!header_done) { header_data.append(buf, len); - return 0; + return len; } if (!sent_header) { data.append(buf, len); - return 0; + return len; + } + int r = mg_write(conn, buf, len); + if (r == 0) { + /* didn't send anything, error out */ + return -EIO; } - return mg_write(conn, buf, len); + return r; } RGWMongoose::RGWMongoose(mg_connection *_conn, int _port) : conn(_conn), port(_port), header_done(false), sent_header(false), has_content_length(false), diff --git a/src/rgw/rgw_client_io.cc b/src/rgw/rgw_client_io.cc index 5e8edbf311236..1f8b803a3d405 100644 --- a/src/rgw/rgw_client_io.cc +++ b/src/rgw/rgw_client_io.cc @@ -56,7 +56,12 @@ int RGWClientIO::write(const char *buf, int len) return ret; if (account) - bytes_sent += len; + bytes_sent += ret; + + if (ret < len) { + /* sent less than tried to send, error out */ + return -EIO; + } return 0; }