Skip to content

Commit

Permalink
[#2530] Add 403 to server refusal excuses
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Jul 10, 2015
1 parent 5304409 commit 4a629c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ckanext/resourceproxy/controller.py
Expand Up @@ -40,9 +40,10 @@ def proxy_resource(context, data_dict):
# first we try a HEAD request which may not be supported
did_get = False
r = requests.head(url)
# 405 would be the appropriate response here, but 400 with
# the invalid method mentioned in the text is also possible (#2412)
if r.status_code in (400, 405):
# Servers can refuse HEAD requests. 405 is the appropriate response,
# but 400 with the invalid method mentioned in the text, or a 403
# (forbidden) status is also possible (#2412, #2530)
if r.status_code in (400, 403, 405):
r = requests.get(url, stream=True)
did_get = True
r.raise_for_status()
Expand Down

0 comments on commit 4a629c8

Please sign in to comment.