Skip to content

Commit

Permalink
Add streaming support from #989
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Jun 12, 2013
1 parent a9630fe commit e04a5c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ckanext/resourceproxy/controller.py
Expand Up @@ -27,7 +27,7 @@ def proxy_resource(context, data_dict):
did_get = False
r = requests.head(url)
if r.status_code == 405:
r = requests.get(url)
r = requests.get(url, stream=True)
did_get = True
r.raise_for_status()

Expand All @@ -38,7 +38,7 @@ def proxy_resource(context, data_dict):
allowed=MAX_FILE_SIZE, actual=cl))

if not did_get:
r = requests.get(url)
r = requests.get(url, stream=True)

base.response.content_type = r.headers['content-type']
base.response.charset = r.encoding
Expand Down

4 comments on commit e04a5c0

@formwandler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this streaming support works under CKAN 2.0.1 when previewing an external PDF added as resource by direct linking to a PDF file or via HTTP stream.

@domoritz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need all the changes from #980, not just this patch.

@formwandler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks. I already did that ;-)
BTW: Is it wanted or valuable to get user feedback here in GitHub about things like commits and branches working on installed systems? Or should users just complain about bugs (issues) here? I just ask since I am new to CKAN and since I am not (yet?) really a developer I always wonder how to help even as an (advanced) user who knows enough about Git to work on development branches.

@domoritz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really value feedback, wherever we can get it! Things like "this fixes it for me" or "it worked but there is one case where..." help us to know what still needs to be done. I think that in the case of CKAN, we try to keep comments in issues and pull requests because single commits normally need to be seen in the context of a pr or issue. So, you are very welcome to post comments there or if your comment concerns a single line, comment in the source.

Please sign in to comment.