[issue42498] smtplib is glitchy after receive server code 500

Pandu E POLUAN report at bugs.python.org
Tue Jan 5 03:03:18 EST 2021


Pandu E POLUAN <pepoluan at gmail.com> added the comment:

The "problem" is that smtplib.SMTP does the following, in essence:

1. Open connection to server
2. Send EHLO
3. Read server response

The PROXY injection causes a response from the server, but the response gets "cached" in the incoming TCP buffer. The injection script likely does not consume this buffer, resulting in Step 3 above reading this "cached" response. 

So from the point of view of smtplib.SMTP, the "503" message arrives _after_ EHLO is sent, while in actuality the "503" arrives before EHLO is sent.

I suggest rewriting the port forwarding script so that it consumes the response from the server first before transferring to smtplib.SMTP

----------
nosy: +pepoluan

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42498>
_______________________________________


More information about the Python-bugs-list mailing list