
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2013-03-20 20:48 byr.david.murray, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.
| 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)*![]() | 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 inissue 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)*![]() | Date: 2013-03-20 22:51 | |
Working on a patch for this. | |||
| msg184829 -(view) | Author: Kushal Das (kushal.das)*![]() | 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)*![]() | 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)![]() | Date: 2014-04-14 22:22 | |
New changeset3c441e9ccf87 by R David Murray in branch '3.4':#17498: Defer SMTPServerDisconnected errors until the next command.http://hg.python.org/cpython/rev/3c441e9ccf87New changeset842014ab1c06 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)*![]() | 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 | |