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 string type issues with SOAP/Twisted #685

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spyne/protocol/soap/soap11.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def create_in_document(self, ctx, charset=None):
# work with proper POST requests.
content_type = ctx.transport.get_request_content_type()
http_verb = ctx.transport.get_request_method()
if content_type is None or http_verb != "POST":
if content_type is None or six.ensure_binary(http_verb) != b"POST":
ctx.transport.resp_code = HTTP_405
plq marked this conversation as resolved.
Show resolved Hide resolved
raise RequestNotAllowed(
"You must issue a POST request with the Content-Type "
Expand Down
2 changes: 1 addition & 1 deletion spyne/server/twisted/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _reconstruct_url(request):
url_scheme = 'http'

uri = _decode_path(request.uri)
return ''.join([url_scheme, "://", server_name, uri])
return ''.join([url_scheme, "://", server_name, uri.decode('utf-8')])
Copy link
Member

Choose a reason for hiding this comment

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

How do we know that uri is encoded with utf-8 here?

Copy link
Author

Choose a reason for hiding this comment

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

I thought it was assumed as we create a "context" with utf-8 content type at line 676, but it concerns more the content than the headers.
The standard doesn't seem to allow other chars than ascii in URI during transmission, maybe it's better to decode as ascii rather than utf-8



class _Transformer(object):
Expand Down