Closed Bug 774392 Opened 12 years ago Closed 12 years ago

Support for Method Not Allowed in requests

Categories

(Cloud Services :: Server: Core, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: telliott, Assigned: rfkelly)

References

Details

(Whiteboard: [qa+])

Attachments

(1 file)

OST /valid-url returns a 404, and not a 405. This is technically incorrect, though I can see why the route-matcher would do this wrongly. It also appears to be happening on rare occasion, and causing problems for the client.
Blocks: 774384
Whiteboard: [qa?]
Patch attached.  If no matching route is found using the full request environ, try again using just the request path.  If a match is found then 405; if not then 404 as before.
Assignee: nobody → rfkelly
Attachment #648611 - Flags: review?(bbangert)
Comment on attachment 648611 [details] [diff] [review]
patch to support 405-Method-Not-Allowed in server-core

Review of attachment 648611 [details] [diff] [review]:
-----------------------------------------------------------------

::: services/baseapp.py
@@ +294,5 @@
>  
>          if match is None:
> +            # Check whether there is a match on just the path.
> +            # If not then it's a 404; if so then it's a 405.
> +            match = self.mapper.routematch(url=request.environ["PATH_INFO"])

Why not request.path_info?
Attachment #648611 - Flags: review?(bbangert) → review+
(In reply to Ben Bangert [:benbangert] from comment #2)
> ::: services/baseapp.py
> @@ +294,5 @@
> >  
> >          if match is None:
> > +            # Check whether there is a match on just the path.
> > +            # If not then it's a 404; if so then it's a 405.
> > +            match = self.mapper.routematch(url=request.environ["PATH_INFO"])
> 
> Why not request.path_info?

I...I don't know.  Changed to use request.path_info and committed in http://hg.mozilla.org/services/server-core/rev/437d1f3b2024
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Marking for QA.  The patch includes a functional test but it's not part of a suite that can be run against a live server.  Instead, we can verify it by hand by trying to POST to /info/collections.  Example using curl:

    curl -d "" https://scl2-sync307.services.mozilla.com/1.1/<username>/info/collections

Currently this returns a 404.  After deployment of this patch it should return a 405.
Whiteboard: [qa?] → [qa+]
OK. So we can certainly try this on Stage tomorrow and in Prod once it goes out.
Verified on Stage:
<html>
 <head>
  <title>405 Method Not Allowed</title>
 </head>
 <body>
  <h1>405 Method Not Allowed</h1>
  The method POST is not allowed for this resource. <br /><br />

 </body>
</html>

Will do a final verification against Production.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: