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

Fix wsgi component for Python 2.7 and Python 3 #257

Merged
merged 4 commits into from Dec 19, 2018
Merged

Fix wsgi component for Python 2.7 and Python 3 #257

merged 4 commits into from Dec 19, 2018

Conversation

spaceone
Copy link
Contributor

See commit messages.
The encoding of str/unicode is wrong.
Let's see what the tests say, I am unsure about the last commit.

@codecov-io
Copy link

codecov-io commented Dec 19, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@4be8e00). Click here to learn what that means.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #257   +/-   ##
=========================================
  Coverage          ?   74.03%           
=========================================
  Files             ?       74           
  Lines             ?     6664           
  Branches          ?        0           
=========================================
  Hits              ?     4934           
  Misses            ?     1730           
  Partials          ?        0
Impacted Files Coverage Δ
circuits/core/handlers.py 95.23% <100%> (ø)
circuits/web/headers.py 74.34% <100%> (ø)
circuits/web/wrappers.py 83.33% <62.5%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4be8e00...fbb0818. Read the comment docs.

@spaceone spaceone force-pushed the fix_wsgi branch 2 times, most recently from 61198f5 to 1392215 Compare December 19, 2018 11:52
response.body = str('foobar') in Python3 was not wrapped into a list and
not encoded into bytes. Therefore WSGI components returned nothing and
the browser shows a content-type mislength error.
Using Controller.redirect() under python 2.7 causes errors due to wrong
encoding of the Location header value (unicode instead if bytes) (due to
the "url = request.uri.relative(url).unicode()" call in
circuits.web.errors.redirect().

HTTP headers seem to be stored as str(), so we ensure str() is returned in items().
@spaceone
Copy link
Contributor Author

Okay, this is also ready to merge. It would be nice to not squash the commits, if possible.

@prologic prologic merged commit 7fea2d0 into master Dec 19, 2018
@spaceone spaceone deleted the fix_wsgi branch July 1, 2019 13:07
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

3 participants