Glance v2: HTTP 404s are returned for unallowed methods

Bug #1297362 reported by Alex Meade
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Kent Wang

Bug Description

Requests for many resources in Glance v2 will return a 404 if the request is using an unsupported HTTP verb for that resource. For example, the /v2/images resource does exist but a 404 is returned when attempting a DELETE on that resource. Instead, this should return an HTTP 405 MethodNotAllowed response.

Kent Wang (k.wang)
Changed in glance:
assignee: nobody → Kent Wang (k.wang)
Kent Wang (k.wang)
Changed in glance:
status: New → In Progress
Revision history for this message
Kent Wang (k.wang) wrote :

According to http://www.restapitutorial.com/lessons/httpmethods.html
it is perfectly RESTful to return 404 when attempting to DELETE the entire collection (e.g. /v2/images)

But for other lesser used operations (OPTIONS, HEAD), maybe we still can return a 405? or a 501 (method not implemented)?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/103959

Kent Wang (k.wang)
Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote :

Change not merged yet

Changed in glance:
status: Fix Committed → In Progress
Revision history for this message
Kent Wang (k.wang) wrote :

I posted a new patch

Changed in glance:
status: In Progress → Fix Committed
Changed in glance:
milestone: none → juno-2
status: Fix Committed → Fix Released
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

This bug is still being reviewed and should be marked as "In Progress"

Revision history for this message
Russell Bryant (russellb) wrote :

It was set to Fix Released automatically when the glance juno-2 release was made, because it was set as Fix Committed. It should be set as Fix Committed until the complete fix has been merged.

Changed in glance:
milestone: juno-2 → none
status: Fix Released → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/103959
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=853b5c9b24a169ec609253637adf093862db35b6
Submitter: Jenkins
Branch: master

commit 853b5c9b24a169ec609253637adf093862db35b6
Author: Kent Wang <email address hidden>
Date: Tue Jul 1 03:34:39 2014 -0700

    Changes HTTP response code for unsupported methods

    Requests for resources with an unsupported HTTP method now return a HTTP
    response 405 (Method Not Allowed) or 501 (Not Implemented) rather than a
    404 (Not Found) for everything.

    For example, attempting to DELETE on /v2/images will now return a 405
    instead of a 404 and will provide a response header 'Allow' that lists
    the valid methods for the resource.

    Attempting to use NON_EXISTENT_METHOD on /v2/images will now return a
    501.

    Attempting to GET on /v2/non_existent_resource will, as expected, return
    a 404.

    Fixed for v1 and v2.

    Change-Id: I5406f8ee423d3d5e66c56a26a7009b4f438a7e0f
    Closes-Bug: #1297362

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.