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

bpo-31711: On SSLObject.write method, added assert that data has content. #17671

Open
wants to merge 1 commit into
base: master
from

Conversation

@choyos
Copy link

choyos commented Dec 20, 2019

This avoid to rise ssl.SSLEOFError on petition that has no content on response.

https://bugs.python.org/issue31711

…void to rise ssl.SSLEOFError on petition that has no content on response.
@the-knights-who-say-ni

This comment has been minimized.

Copy link

the-knights-who-say-ni commented Dec 20, 2019

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@choyos

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@choyos choyos changed the title issue31711: On SSLObject.write method, added assert that data has content. #31711: On SSLObject.write method, added assert that data has content. Dec 20, 2019
@raulcd

This comment has been minimized.

Copy link

raulcd commented Dec 22, 2019

Hi,
Thanks for your contribution. Why would you want to obscure this returning an emtpy string. To me raising an Exception sounds like the approach we should maintain. Can you elaborate more on the case of why this behaviour has to change?
Thanks
Raúl

@tiran tiran changed the title #31711: On SSLObject.write method, added assert that data has content. bpo-31711: On SSLObject.write method, added assert that data has content. Dec 23, 2019
@@ -894,7 +894,10 @@ def write(self, data):
The 'data' argument must support the buffer interface.
"""
return self._sslobj.write(data)
if data != b'':

This comment has been minimized.

Copy link
@tiran

tiran Dec 23, 2019

Member

if data:

if data != b'':
return self._sslobj.write(data)
else:
return ""

This comment has been minimized.

Copy link
@tiran

tiran Dec 23, 2019

Member

write returns the number of bytes sent. The function should either return 0 or fail with a more useful exception.

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Dec 23, 2019

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@joernheissler

This comment has been minimized.

Copy link
Contributor

joernheissler commented Dec 23, 2019

To me raising an Exception sounds like the approach we should maintain. Can you elaborate more on the case of why this behaviour has to change?

See https://bugs.python.org/issue31711 for some discussion. Currently, the behaviour is undefined, i.e. instead of an exception something else may happen. Some code change is required to achieve defined behaviour, whichever that is.

I prefer a noop.

@slingamn

This comment has been minimized.

Copy link

slingamn commented Dec 24, 2019

Previous PR implementing no-op behavior: #7559

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