Skip to content

rgw: add Allow on 405 and use 501 for unknown HTTP methods - #73206

Open
RaminNietzsche wants to merge 3 commits into
ceph:mainfrom
RaminNietzsche:wip-rgw-405-allow
Open

RaminNietzsche wants to merge 3 commits into
ceph:mainfrom
RaminNietzsche:wip-rgw-405-allow

Conversation

@RaminNietzsche

@RaminNietzsche RaminNietzsche commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Emit an Allow header on HTTP 405 responses from REST handlers, listing methods the handler can dispatch for the current request (RFC 9110 §15.5.6).
  • Answer unrecognized HTTP methods (PATCH, TRACE, …) with 501 Not Implemented instead of 405 when no operation is registered for OP_UNKNOWN.
  • Add s3-tests coverage and a PendingReleaseNotes entry for the client-visible status change.

Related: #72114 (501 for unimplemented S3 sub-resources). Repro gist: https://gist.github.com/RaminNietzsche/818ad8dd6b8d8093560183cd09d2b169 (cases T5).

Test plan

  • jenkins test make check
  • s3-tests: test_object_unrecognized_http_method_not_implemented, test_object_unsupported_http_method_allow_header
  • Manual: curl -X PATCH → 501; curl -X COPY on S3 object → 405 + Allow

Checklist

  • Tracker (select at least one)
  • Component impact
    • Affects Dashboard
    • Affects Orchestrator
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test make check

@RaminNietzsche

Copy link
Copy Markdown
Member Author

RFC 9110 RGW audit — series context

This PR is one focused change from an RFC 9110 conformance review of RGW (S3, Swift, Admin, STS). Each PR is meant to review and merge on its own; there is no batch dependency unless called out below.

Item PR Tracker
T1 — 416 + Content-Range #73200 #82229
T4b — CopyObject source preconditions → 412 #73201 #82230
T4a — If-Match before If-Modified-Since #73205 #82233 (Fixes #19965)
T5 — 405 + Allow, 501 for unknown methods #73206 #82235
T6 — Swift 401 + WWW-Authenticate #73209 #82242

Same audit, already tracked on other PRs (not part of this series authorship):

Item PR Tracker
T2 — Range header parsing #71300 #13412
T3 — whole-tag If-Match / If-None-Match #72117 #80924

Follow-ups from the audit not opened yet: T4d If-Range (best after #71300 and #72117 land), T8b header field section too large → 431, T9 admin GET ?sync=true side effects.

Shared repro script and sample output: https://gist.github.com/RaminNietzsche/818ad8dd6b8d8093560183cd09d2b169 (rgw-rfc9110-repro.py; cases T1–T8).

This PR (T5): §15.5.6 Allow on 405; §15.6.2 — unrecognized methods (e.g. PATCH) → 501. Related to #72114 (501 for unimplemented S3 sub-resources) but different code path.

@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test make check

@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test api

RFC 9110 requires an Allow header on 405 responses and treats
unrecognized methods as 501. Probe REST handlers for supported
methods when emitting 405, and map OP_UNKNOWN to NotImplemented.

Fixes: https://tracker.ceph.com/issues/82235
Signed-off-by: ramin.najarbashi <[email protected]>
Ensure _object_url inserts a slash between the RGW port and the
tenant/path prefix when the prefix has no leading slash.

Signed-off-by: ramin.najarbashi <[email protected]>
Build raw request URLs from get_config_endpoint(), matching
_get_post_url(), so path-style and tenant prefixes match the
boto3 client in ceph-pr-api runs.

Signed-off-by: ramin.najarbashi <[email protected]>
@RaminNietzsche

Copy link
Copy Markdown
Member Author

Rebased on current main and simplified s3-tests object URLs to use get_config_endpoint() (same pattern as _get_post_url).

Latest ceph API tests failure on pipeline 8095 was a Jenkins compile flake (Too many open files in Boost headers), not an RGW/s3-tests failure. make check, arm64, and Windows were already green.

jenkins test make check

@RaminNietzsche

Copy link
Copy Markdown
Member Author

Force-pushed rebased tip ad5ee209 (endpoint URL fix + current main).

jenkins test make check

@adamemerson
adamemerson requested a review from cbodley November 5, 2026 17:11
@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant