Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource proxy fails if HEAD responds with 403 #2530

Merged
merged 1 commit into from
Jul 13, 2015

Conversation

brew
Copy link
Member

@brew brew commented Jul 10, 2015

Similar to #2412. Some servers[1] respond with a 403 to the initial HEAD request made by the resource_proxy extension[2], so don't attempt the GET request of the file.

[1]e.g. https://barnet.gov.uk/dam/jcr:7e9d19d0-071a-4209-9955-68485a5c937a/CSG_Overview_v0.2.pdf
[2]

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):
r = requests.get(url, stream=True)
did_get = True
r.raise_for_status()

mattfullerton added a commit to mattfullerton/ckan that referenced this pull request Jul 10, 2015
brew added a commit to okfn/ckan-barnet that referenced this pull request Jul 10, 2015
@amercader amercader self-assigned this Jul 13, 2015
@amercader amercader added this to the CKAN 2.4 milestone Jul 13, 2015
brew added a commit that referenced this pull request Jul 13, 2015
@amercader amercader merged commit 4a629c8 into master Jul 13, 2015
@amercader
Copy link
Member

Merged and picked to 2.4

@smotornyuk smotornyuk deleted the 2530-proxy-forbidden branch December 19, 2018 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants