Skip to content
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

Allow handle_EHLO to change the responses to EHLO #157

Merged
merged 27 commits into from
Jan 28, 2021

Conversation

cnicodeme
Copy link
Contributor

@cnicodeme cnicodeme commented Dec 10, 2018

Closes #155

aiosmtpd/smtp.py Show resolved Hide resolved
Copy link
Collaborator

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've finally found time to jump back in the saddle here!

I really like this PR and I think it's shaping up to be the right thing. My other comments mentioned some other changes that I'd like to see, but if we could get some tests and docs updated, I think that this PR would be great!

aiosmtpd/smtp.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 29, 2020

Codecov Report

Merging #157 (a3fe96f) into master (46540ff) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #157   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines         1100      1121   +21     
  Branches       197       201    +4     
=========================================
+ Hits          1100      1121   +21     
Impacted Files Coverage Δ
aiosmtpd/smtp.py 100.00% <100.00%> (ø)
aiosmtpd/lmtp.py 100.00% <0.00%> (ø)
aiosmtpd/main.py 100.00% <0.00%> (ø)
aiosmtpd/handlers.py 100.00% <0.00%> (ø)
aiosmtpd/controller.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46540ff...aded931. Read the comment docs.

@pepoluan
Copy link
Collaborator

pepoluan commented Dec 29, 2020

Okay I'm really thinking about backward compatibility here...

Current behavior is that handle_EHLO only adds to existing list. This is the behavior of the code in master, and it is documented.

Changing this behavior will break code that expects that behavior.

So I will implement the following strategy:

Depending on the signature of the handle_EHLO hook,

  • If handle_EHLO takes only 4 (three) args -- as is expected currently -- do the old behavior (adding)
  • If handle_EHLO takes > 4 args -- adding the list of responses as the 5th arg -- do the new behavior (replacing)

@pepoluan pepoluan changed the title Suggestion on fixing issue #155 Allow handle_EHLO to change the responses to EHLO Dec 29, 2020
@pepoluan pepoluan marked this pull request as draft December 29, 2020 17:48
@pepoluan
Copy link
Collaborator

Changing this to draft because there are some behavior that might break existing code.

Will undraft after I implement backward-compatibility workarounds.

The older behavior has been documented. Existing code that relies on
the older behavior will break if backward-compatibility logic is not
implemented.

This workaround has been documented in handlers.rst
@pepoluan
Copy link
Collaborator

I will undraft this after testing on my test systems.

@pepoluan pepoluan added this to the 1.3 milestone Dec 29, 2020
Copy link
Collaborator

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question but not a blocker. I like the backwards compatibility here - I think we should plan on doing a deprecation/warning introduction release regularly, like maybe once per year or something. But that's orthogonal to this PR 🙃

aiosmtpd/smtp.py Outdated Show resolved Hide resolved
Also explaining the effect of setting host_name to false-y in the
documentation.
Also do optional-import of colorama in conf.py

Plus rewriting many os.path things into pathlib.Path things to guarantee
cross-platform compatibility.
@pepoluan
Copy link
Collaborator

pepoluan commented Dec 30, 2020

Currently doing testing on my test systems:

  • Windows 10 (via PyCharm tox runner): (ALL)
  • Windows 10 (via PSCore 7.1.0): (ALL)
  • Windows 10 (via Cygwin): qa,py36-{nocov,cov}
  • Ubuntu 18.04 on WSL 1.0: (ALL) + pypy3-{nocov,cov,diffcov}
  • Ubuntu 18.04 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • Ubuntu 20.04 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • FreeBSD 12.1 on VBox: (ALL) + pypy3-nocov

(BTW, these tests are running against commit a0f963b [see below] ... I just forgot to push to cnicodeme's branch)

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Dec 30, 2020

This pull request introduces 1 alert when merging a0f963b into 6c8fdbc - view on LGTM.com

new alerts:

  • 1 for Unused import

@pepoluan
Copy link
Collaborator

This pull request introduces 1 alert when merging a0f963b into 6c8fdbc - view on LGTM.com

new alerts:

* 1 for Unused import

Huh? I thought I've removed that line?

Oh well, here's to another edit-commit-push-check.

Had this not been excluded, "qa" would catch the unused import there.

Why it was excluded, I do not know ... after all, running qa on conf.py
passes with flying colors...
@pepoluan
Copy link
Collaborator

pepoluan commented Jan 1, 2021

All my tests passed, I'm Undrafting this.

@pepoluan pepoluan marked this pull request as ready for review January 1, 2021 07:24
@pepoluan
Copy link
Collaborator

pepoluan commented Jan 1, 2021

Whoops, there are some conflicts. Redrafting while I fix those.

# Conflicts:
#	aiosmtpd/smtp.py
Because this is milestoned for 1.3

I want to close 1.2.x line by mid-2021-01
@pepoluan
Copy link
Collaborator

pepoluan commented Jan 1, 2021

Because of the major merging, I'm rerunning my tests

Progress:

  • Windows 10 (via PyCharm runner): (ALL)
  • Windows 10 (via PSCore 7.1.0): (ALL)
  • Windows 10 (Cygwin): qa,py36-{nocov,cov}
  • Ubuntu 18.04 on WSL 1.0: (ALL) + pypy3-{nocov,cov,diffcov}
  • Ubuntu 18.04 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • Ubuntu 20.04 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • FreeBSD 12.1 on VBox: (ALL) + pypy3-nocov

@pepoluan
Copy link
Collaborator

pepoluan commented Jan 3, 2021

Ugh, finally FreeBSD testing is complete.

I don't know why but my FreeBSD VM seems to ... degrade? It usually finishes in an acceptable time without much fuss, but now it runs really slowly I had to add another core ... and I get intermittent failures due to timeouts.

I'll undraft this and open this for review.

@pepoluan pepoluan marked this pull request as ready for review January 3, 2021 08:23
]
# for actual, expected in zip(lines, expecteds):
# self.assertEqual(actual, expected)
self.assertEqual(expecteds, actuals)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to compare whole-list against whole-list, to see where we went wrong.

@@ -74,7 +75,6 @@ deps:
{[qadocs]deps}

[flake8]
exclude = conf.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not exclude conf.py se we can catch possible problems.

tox.ini Outdated
@@ -54,6 +54,7 @@ passenv =
basepython = python3
envdir = {toxworkdir}/python3
deps =
colorama
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small test-dep, really helpful for parsing the reams of output.

@pepoluan
Copy link
Collaborator

pepoluan commented Jan 3, 2021

If no objections within 2x24 I'll squamerge this 😄

# Conflicts:
#	aiosmtpd/docs/NEWS.rst
#	aiosmtpd/smtp.py
#	conf.py
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Jan 19, 2021

This pull request introduces 1 alert when merging a682b4a into 9432d76 - view on LGTM.com

new alerts:

  • 1 for Unused import

@pepoluan
Copy link
Collaborator

This pull request introduces 1 alert when merging a682b4a into 9432d76 - view on LGTM.com

new alerts:

* 1 for Unused import

Oh fer cryin' out loud ...

# Conflicts:
#	aiosmtpd/smtp.py
@pepoluan
Copy link
Collaborator

pepoluan commented Jan 25, 2021

Carrying out final verification, just in case merging with master causes problems:

  • Windows 10 (via PyCharm): (ALL)
  • Windows 10 (via PSCore 7.1.1): (ALL)
  • Windows 10 (Cygwin): qa,py36-{nocov,cov}
  • Ubuntu 18.04 on WSL 1.0: (ALL) + pypy3-{nocov,cov,diffcov}
  • FreeBSD 12.2 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}
  • OpenSUSE 15.2 on VBox: (ALL) + pypy3-{nocov,cov,diffcov}

(On commitpush, this PR's 'new' GA yml [adopted from #202 ] will test on Ubuntu-{18,20}.4, MacOS, and Windows Server.)

This post is undergoing editing

Reasons:
1. I'm going to drop my Ubuntu-on-VBox testing systems
2. I can't test on MacOs, GA can
Don't worry, PLATFORM==linux is not used anywhere in the code.
@pepoluan
Copy link
Collaborator

pepoluan commented Jan 26, 2021

All 24 checks passed. Marinating this for 2x24, then squamerge.

@pepoluan pepoluan added the ready-to-merge PRs that are ready to merge label Jan 26, 2021
@pepoluan pepoluan merged commit 1520c04 into aio-libs:master Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ready-to-merge PRs that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EHLO command returns all bunch of 250- data, even when the hooks returns otherwise
4 participants