This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年03月20日 20:48 by r.david.murray, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue17498.patch | kushal.das, 2013年03月21日 02:07 | review | ||
| issue17498_v2.patch | kushal.das, 2014年04月14日 15:19 | New version of the patch which can be successfully applied to tip. | review | |
| Messages (6) | |||
|---|---|---|---|
| msg184793 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年03月20日 20:48 | |
If an SMTP server returns an error code and then closes the connection, smtplib will attempt to send an RSET command, which will then raise a socket error, which smtplib turns into a ServerDisconnectedError, thereby loosing the information about what error code the server actually returned. While (except for code 421, as noted in issue 5713) a server doing this is technically out of spec with the RFC, it is a reality of the internet that it happens, and smtplib should handle it correctly. Since the RSET is just to get the protocol back to a known starting state after an error, I believe the fix is to have an internal _rset method that wraps the RSET call in a try/except and just ignores any ServerDiscoonected error. The library would then call this internally instead of the public API method. If the library client continues on after the error code it gets back from calling an smtplib method that results in the server closing the connection, it will get the ServerDisconnected error the next time it tries to send a command to the server. Thus the behavior change introduced here is just to allow commands that end with server disconnects to return an error code instead of an (otherwise mysterious and quite possibly currently-mishandled) ServerDisconnected error. Since any existing code will already need to handle errors from commands sent to servers that *don't* disconnect, I believe that this is a safe fix from a backward compatibility standpoint. |
|||
| msg184810 - (view) | Author: Kushal Das (kushal.das) * (Python committer) | Date: 2013年03月20日 22:51 | |
Working on a patch for this. |
|||
| msg184829 - (view) | Author: Kushal Das (kushal.das) * (Python committer) | Date: 2013年03月21日 02:07 | |
The following patch adds a _rset method which catches any SMTPServerDisconnected exception, also includes the corresponding test and test_421_from_mail_cmd assert statement typo fix. |
|||
| msg216089 - (view) | Author: Kushal Das (kushal.das) * (Python committer) | Date: 2014年04月14日 15:19 | |
New version of the patch which can be successfully applied to tip. |
|||
| msg216235 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年04月14日 22:22 | |
New changeset 3c441e9ccf87 by R David Murray in branch '3.4': #17498: Defer SMTPServerDisconnected errors until the next command. http://hg.python.org/cpython/rev/3c441e9ccf87 New changeset 842014ab1c06 by R David Murray in branch 'default': Merge #17498: Defer SMTPServerDisconnected errors until the next command. http://hg.python.org/cpython/rev/842014ab1c06 |
|||
| msg216237 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2014年04月14日 22:24 | |
Thanks, Kushal. Sorry it took so long to get this committed :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:43 | admin | set | github: 61700 |
| 2014年07月26日 21:35:42 | r.david.murray | link | issue16005 superseder |
| 2014年04月14日 22:24:41 | r.david.murray | set | status: open -> closed versions: + Python 3.5, - Python 2.7, Python 3.2, Python 3.3 type: behavior messages: + msg216237 resolution: fixed stage: needs patch -> resolved |
| 2014年04月14日 22:22:52 | python-dev | set | nosy:
+ python-dev messages: + msg216235 |
| 2014年04月14日 15:19:54 | kushal.das | set | files:
+ issue17498_v2.patch messages: + msg216089 |
| 2013年03月21日 02:07:22 | kushal.das | set | files:
+ issue17498.patch keywords: + patch messages: + msg184829 |
| 2013年03月20日 22:51:15 | kushal.das | set | messages: + msg184810 |
| 2013年03月20日 20:49:00 | r.david.murray | set | nosy:
+ kushal.das |
| 2013年03月20日 20:48:30 | r.david.murray | create | |