Skip to content

jsonrpclib: Fix TransportMixin implementation. #26

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

Merged
merged 1 commit into from
Jan 29, 2016

Conversation

mschmitzer
Copy link

The send_request implementation in TransportMixin erroneously sent the
request body (it is only supposed to send the "POST" line and
headers). This is not a problem with py2.7, because there the
XMLTransport class from xmlrpclib invokes single_request, which is
implemented in jsonrpclib and expects this wrong behavior. The py2.6
xmlrpc lib instead invokes send_request, emits some more headers and
then invokes sent content. As the bad send_request already sent the
content, the attempt to add more headers afterwards failed.

This patch removes the send_content call from send_request and adds it
in single_request instead.

The send_request implementation in TransportMixin erroneously sent the
request body (it is only supposed to send the "POST" line and
headers). This is not a problem with py2.7, because there the
XMLTransport class from xmlrpclib invokes single_request, which is
implemented in jsonrpclib and expects this wrong behavior. The py2.6
xmlrpc lib instead invokes send_request, emits some more headers and
then invokes sent content. As the bad send_request already sent the
content, the attempt to add more headers afterwards failed.

This patch removes the send_content call from send_request and adds it
in single_request instead.
@tcalmant
Copy link
Owner

The behaviour doesn't change on Py2.7/3+, so the pull request is accepted.
Thanks for your contribution 👍

tcalmant added a commit that referenced this pull request Jan 29, 2016
jsonrpclib: Fix TransportMixin implementation.
@tcalmant tcalmant merged commit a4673aa into tcalmant:master Jan 29, 2016
@mschmitzer mschmitzer deleted the fix-transport-py2.6 branch January 29, 2016 10:44
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.

2 participants