Skip to content

Commit 98772af

Browse files
committed
rgw: handle EINVAL translation in forward_request
RGWRESTSimpleRequest::forward_request() translates EINVAL to a 503 status code to reflect connection errors as internal errors rather than client errors. However, if the master is explicitly returning EINVAL (which corresponds to an HTTP 400 status code), this translation incorrectly converts it to 503, hiding the true client error. To address this, we now check the HTTP status code to ensure the error originates from easy_curl and not from a valid HTTP response, preserving the intended 400 status when appropriate. Fixes: https://tracker.ceph.com/issues/69084 Signed-off-by: Seena Fallah <[email protected]>
1 parent 2360022 commit 98772af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/rgw/rgw_rest_client.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ int RGWRESTSimpleRequest::forward_request(const DoutPrefixProvider *dpp, const R
453453
url = new_url;
454454

455455
int r = process(dpp, y);
456-
if (r < 0){
457-
if (r == -EINVAL){
458-
// curl_easy has errored, generally means the service is not available
456+
if (r < 0) {
457+
if (http_status == 0) {
458+
// no http status, generally means the service is not available
459459
r = -ERR_SERVICE_UNAVAILABLE;
460460
}
461461
return r;

0 commit comments

Comments
 (0)