Message308433
Let's quickly iterate over what's possible first:
* It's possible to check the type of the FD using "getsockopt(SOL_SOCKET, SO_TYPE)" on all platforms.
* It's possible to check family/proto of the FD using "getsockopt(SOL_SOCKET, SO_DOMAIN/SO_PROTOCOL)" on Linux.
Given the above I propose the following:
1. Passing a wrong type can be considered as a serious error. SOCK_STREAM is fundamentally different from SOCK_DGRAM. Because we have a way to validate socket type on all platforms, I propose to do this validation when we create a socket from an FD, and raise an error if the passed socket type isn't correct.
2. When Python is running with '-X dev' (new dev mode added by Victor), I propose to also validate socket.family and socket.proto on Linux, and raise a RuntimeWarning when they don't match. |
|
Date |
User |
Action |
Args |
2017-12-16 00:21:50 | yselivanov | set | recipients:
+ yselivanov, pitrou, vstinner, christian.heimes, r.david.murray, martin.panter |
2017-12-16 00:21:50 | yselivanov | set | messageid: <1513383710.74.0.213398074469.issue28134@psf.upfronthosting.co.za> |
2017-12-16 00:21:50 | yselivanov | link | issue28134 messages |
2017-12-16 00:21:50 | yselivanov | create | |
|