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

RFC 7233 - Range Requests #977

Merged
merged 9 commits into from
Sep 8, 2016
Merged

RFC 7233 - Range Requests #977

merged 9 commits into from
Sep 8, 2016

Conversation

magne4000
Copy link
Contributor

@magne4000 magne4000 commented Aug 3, 2016

See #978 for details.

@magne4000 magne4000 changed the title Fix malformed Range header parsing. Closes #974 RFC 7233 - Range Requests Aug 5, 2016
@magne4000
Copy link
Contributor Author

Travis seems to have a hard time running redis server on last build :)

@homu
Copy link
Contributor

homu commented Aug 12, 2016

☔ The latest upstream changes (presumably ca1665a) made this pull request unmergeable. Please resolve the merge conflicts.

@homu
Copy link
Contributor

homu commented Aug 14, 2016

☔ The latest upstream changes (presumably 2bc6035) made this pull request unmergeable. Please resolve the merge conflicts.

@@ -538,6 +540,69 @@ def test_etag_response_mixin():
response.make_conditional(env)
assert response.content_length == 999

# simple valid Range Request

This comment was marked as off-topic.

@untitaker
Copy link
Contributor

@magne4000 I think you goofed up the diff, it now contains unrelated changes.

I recommend git rebase -i <base_branch> to select which commits should stay.

@magne4000
Copy link
Contributor Author

I had to soft reset because I messed up the history, but it's cleaner now.

@homu
Copy link
Contributor

homu commented Aug 22, 2016

☔ The latest upstream changes (presumably 0407d22) made this pull request unmergeable. Please resolve the merge conflicts.

end = None
last_end = -1
elif '-' in item:
begin, end = item.split('-', 1)
begin = begin.strip()
end = end.strip()
if not begin.isdigit():

This comment was marked as off-topic.

This comment was marked as off-topic.

@untitaker
Copy link
Contributor

Excellent work, it's really rare to get a PR of this size with so few errors. Sorry it took so long to review this, but here we go.

@magne4000 magne4000 force-pushed the master branch 2 times, most recently from 2837b2f to 3f61999 Compare August 30, 2016 07:12
self.status_code != 206
and not is_resource_modified(
environ, self.headers.get('etag'),
None, self.headers.get('last-modified')

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@untitaker
Copy link
Contributor

There's one issue left: There are several new public functions. It needs to be decided which ones we want to expose, those have to be added to the .rst files in the docs folder.

@magne4000
Copy link
Contributor Author

  • werkzeug/datastructures.py new method Range.to_content_range_header already handled by:
.. autoclass:: Range
   :members:
  • werkzeug/wrappers.py new methods are considered protected
  • werkzeug/__init__.py add 'RangeWrapper' to 'werkzeug.wsgi'
  • werkzeug/wsgi.py should add RangeWrapper in wsgi.rst

Don't know if we need something more

@untitaker
Copy link
Contributor

If they're protected they should be prefixed by underscore IMO, but will have to look how rest of Wz handles this.

On 7 September 2016 13:17:58 CEST, "Joël Charles" notifications@github.com wrote:

  • werkzeug/datastructures.py new method
    Range.to_content_range_header already handled by:
.. autoclass:: Range
  :members:
  • werkzeug/wrappers.py new methods are considered protected
  • werkzeug/__init__.py add 'RangeWrapper' to 'werkzeug.wsgi'
  • werkzeug/wsgi.py should add RangeWrapper in wsgi.rst

Don't know if we need something more

You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#977 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@magne4000
Copy link
Contributor Author

That is already the case

@untitaker
Copy link
Contributor

Ah sorry, I forgot there were mostly new methods there. Do we really want to expose RangeWrapper? It seems like out of scope for Werkzeug as a WSGI library (like many things in Werkzeug, see #4). Also imports from __init__ will be deprecated eventually.

@untitaker
Copy link
Contributor

Also not our problem, but I'd rather create a third-party package with this API than exposing it here.

On 8 September 2016 11:08:10 CEST, Armin Ronacher notifications@github.com wrote:

Not our problem tbh

Then we should quickly figure out the answers to these two questions:

  1. Is there a value for a user to create instances of this object?
  2. If the answer to 1. is yes, are they supposed to copy paste it?

You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#977 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@mitsuhiko
Copy link
Contributor

@untitaker sure. But we already need to include this thing internally anyways. So it's not like we can delete that code.

@magne4000
Copy link
Contributor Author

We shouldn't incitate one to instanciate this class. Instead, as I added in the doc, the response data object must implement a part of io.BaseIO methods.

@untitaker
Copy link
Contributor

If we suddenly don't need it anymore we can't delete it either without API breakage. With your philosophy taken to the extreme, no refactor would be possible without bumping the major version.

On 8 September 2016 11:12:51 CEST, Armin Ronacher notifications@github.com wrote:

@untitaker sure. But we already need to include this thing internally
anyways. So it's not like we can delete that code.

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#977 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@mitsuhiko
Copy link
Contributor

Let's keep it private for now then and add a comment to decide on what to do with it in the future.

@untitaker
Copy link
Contributor

@magne4000 Could you add that comment? Thanks!

@magne4000
Copy link
Contributor Author

Should I prefix the comment with a specific sphinx markup ?

@untitaker
Copy link
Contributor

No I think a normal #-comment is fine.

On Thu, Sep 08, 2016 at 04:48:53AM -0700, Joël Charles wrote:

Should I prefix the comment with a specific sphinx markup ?

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#977 (comment)

@untitaker untitaker merged commit 0a23c94 into pallets:master Sep 8, 2016
@untitaker
Copy link
Contributor

Excellent, thank you!

@magne4000
Copy link
Contributor Author

😉

@untitaker
Copy link
Contributor

Also thanks for being patient with the bit-by-bit review I did. I do try to review your PR in large chunks, but some things only come to mind after a while.

@magne4000
Copy link
Contributor Author

No probs, that was necessary, this was not a tiny PR 😄

@davidism
Copy link
Member

davidism commented Sep 8, 2016

Impressive work, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants