-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fix bind unspecified address controller will raise TimeoutError #273
base: master
Are you sure you want to change the base?
Conversation
I'm not 100% sure if this is the correct fix - 0.0.0.0 should bind on all interfaces right? I'm on my phone atm so I might not grok correctrly... |
This pull request introduces 1 alert when merging 28f3763 into 215b854 - view on LGTM.com new alerts:
|
e1aea9d
to
4744fc0
Compare
Listening |
4df94f7
to
4181f15
Compare
53c8c8c
to
cbef7cc
Compare
Codecov Report
@@ Coverage Diff @@
## master #273 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 1696 1713 +17
Branches 310 313 +3
=========================================
+ Hits 1696 1713 +17
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I did my best to fix the problems with flake8 checks. But My fix is special for python 3.8 and later def test_byclient(
self, caplog, auth_peeker_controller, client, mechanism, init_resp
):
self._ehlo(client)
PW = "goodpasswd"
client.user = "goodlogin"
client.password = PW
auth_meth = getattr(client, "auth_" + mechanism)
if (mechanism, init_resp) == ("login", False):
with pytest.raises(SMTPAuthenticationError):
client.auth(mechanism, auth_meth, initial_response_ok=init_resp)
# bpo-27820 has been fixed in python version 3.8 or later
if sys.version_info >= (3, 8):
raise SMTPAuthenticationError(454, 'Expected failed')
client.docmd("*")
pytest.xfail(reason="smtplib.SMTP.auth_login is buggy (bpo-27820)")
client.auth(mechanism, auth_meth, initial_response_ok=init_resp)
peeker = auth_peeker_controller.handler
assert isinstance(peeker, PeekerHandler)
assert peeker.login == b"goodlogin"
assert peeker.password == PW.encode("ascii")
assert_nopassleak(PW, caplog.record_tuples) I think this place needs to make some changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reservedly happy with the changes. Shall we LGTM?
All checks does not seem to find any problems. If there are other questions please contact me. |
@pepoluan Any reason we shouldn't merge this? |
After one year (sorry) conflicts arise ... Can we fix this and revisit? |
4a0b8ce
to
852d219
Compare
The controller throws a TimeoutError when binding a unspecified address (e.g. 0.0.0.0) fix flake8 warning
It's been a bit of a busy couple of weeks, so I've procrastinated a bit. |
Okay so I've drunk enough coffee for today, I can think again 😁 This converts "unspecified" to localhost, rather than current IP adress, I think we need to mention that in the documentation as well. Other software when given "unspecified" will bind to all existing addresses including localhost. Though that is not a 'standard behavior' I think being explicit will be good. |
I don't think it needs to be deliberately stated in the documentation. |
It may be common behavior, but I only learned about this just recently. I'm sure I'm not the only one |
Ahh thanks for the explanation! Was a bit confused when I just look at the snippets. |
What do these changes do?
Add a function is_unspecified_address() determine if the address is the unspecified address.
Automatic replacement of unspecified address with local addresses.
Are there changes in behavior for the user?
This will be more compatible with the user-specified behavior.
Related issue number
issue #272
Checklist
{py36,py37,py38,py39}-{nocov,cov,diffcov}, qa, docs
{py36,py37,py38,py39}-{nocov,cov,diffcov}
{py36,py37,py38,py39}-{nocov,cov,diffcov}, pypy3-{nocov,cov}, qa, docs
{py36,pypy3}-{nocov,cov,diffcov}, qa
py36-{nocov,cov,diffcov}, qa, docs
NEWS.rst
file