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

rewrite test client redirect handling #1402

Merged
merged 1 commit into from Nov 25, 2018

Conversation

Projects
None yet
1 participant
@davidism
Copy link
Member

commented Nov 25, 2018

  • EnvironBuilder.from_environ creates a builder from an existing environ. The previous code was passing EnvironBuilder(environ), but that doesn't mean anything to __init__.
  • Redirect environ is initialized from initial environ and passed to open, rather than passing only some args to open.
  • Script root and path are correctly distinguished. The root is preserved from the initial environ, stripped from the location, or cleared if the location is not under the root. Fixes #382
  • HEAD method is not changed to GET.
  • Headers are passed to new request for all codes. There's nothing for or against passing them in the RFC, but Chrome, Firefox, and Requests all do this. Fixes #1151
  • Body and relevant headers are dropped except for 307 and 308. Previously the client would never pass on the body, it would only preserve the method for 307.
  • 1EnvironBuilder.get_environ` sets content type and length headers in addition to WSGI keys when detecting from data.
  • Better error message when disallowing domain redirects. Distinguishes between "subdomains aren't enabled" and "can't go to external host."
  • Test client recognizes 308 code.
  • Add 308 to http codes.

@davidism davidism added this to the 0.15 milestone Nov 25, 2018

@davidism davidism force-pushed the test-client-redirect branch from 3c24062 to 965bbc0 Nov 25, 2018

rewrite test client redirect handling
* EnvironBuilder can be initialized from an environ.
* Redirect environ is initialized from initial environ.
* Script root and path are correctly distinguished.
* HEAD method is not changed to GET.
* Headers are passed to new request for all codes.
* Body and relevant headers are dropped except for 307 and 308.
* EnvironBuilder sets content type and length headers from autodetection
* Better error message when disallowing domain redirects.
* Test client recognizes 308 code.
* Add 308 to http codes.

@davidism davidism force-pushed the test-client-redirect branch from 965bbc0 to d27ac6c Nov 25, 2018

@davidism davidism merged commit b0302bb into master Nov 25, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@davidism davidism deleted the test-client-redirect branch Nov 25, 2018

@davidism

This comment has been minimized.

Copy link
Member Author

commented Nov 25, 2018

Another change in #1403, intermediate redirect response bodies are exhausted even when buffered=False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.