Skip to content

Commit 16d53a6

Browse files
committed
Tighten up use of X-HTTP-Method-Override to only work with POST.
Old method allowed PUT, DELETE .. to tunnel. Now I have no clue why you would tunnel DELETE or PATCH in PUT but...
1 parent 1760b88 commit 16d53a6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

roundup/rest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,16 +1641,18 @@ def dispatch(self, method, uri, input):
16411641
override = headers.get('X-HTTP-Method-Override')
16421642
output = None
16431643
if override:
1644-
if method.upper() != 'GET':
1644+
if method.upper() == 'POST':
16451645
logger.debug(
16461646
'Method overridden from %s to %s', method, override)
16471647
method = override
16481648
else:
16491649
output = self.error_obj(400,
1650-
"X-HTTP-Method-Override: %s can not be used with GET method. Use Post instead." % override)
1650+
"X-HTTP-Method-Override: %s must be used with "
1651+
"POST method not %s."% (override, method.upper()))
16511652
logger.info(
1652-
'Ignoring X-HTTP-Method-Override for GET request on %s',
1653-
uri)
1653+
'Ignoring X-HTTP-Method-Override using %s request on %s',
1654+
method.upper(), uri)
1655+
16541656

16551657
# parse Accept header and get the content type
16561658
accept_header = parse_accept_header(headers.get('Accept'))

0 commit comments

Comments
 (0)