TheFox / smtpd

SMTP server (library) for receiving emails, written in pure PHP.
https://fox21.at
MIT License
121 stars 30 forks source link

Socket timeouts #14

Open drkhunter opened 6 years ago

drkhunter commented 6 years ago

Hey again,

I'm trying to implement timeouts on the server sockets as detailed in rfc5321 4.5.3. Sizes and Timeouts. I don't think it needs to be much cleverer than a minute between commands. I was hoping adding a timeout to the socket would be enough to kill the client but that doesn't work. Any ideas?

TheFox commented 6 years ago

RFC 5321 isn't supported at all, yet. This would mean that we also have to implement all other core feature of RFC 5321. Not even RFC 821 is yet fully implemented.

What to you want to achieve with timeouts for the client?

drkhunter commented 6 years ago

At the moment if you telnet into the smtpd it holds open the socket for as long as the server or client doesn't timeout for any other reason. I'd like to be able to timeout the client connection after a few minutes of inactivity and close it much like a postfix smtp server does.

I'm guessing more clients connected like that would cause unwanted CPU or memory usage.

I appreciate this is probably far beyond where the project is right now.

drkhunter commented 6 years ago

RFC 821 was obsoleted by RFC 2821 and then RFC 5321. Which RFC are you working toward, for reference?

TheFox commented 6 years ago

I started with RFC 821, see README.md.

I appreciate this is probably far beyond where the project is right now.

Correct. I would rather finish implementing RFC 821, then RFC 2821, instead of implementing some features from RFC x and then some features from RFC y, and so on. I don't want to go to the next RFC when still the previous isn't fully implemented yet, although we already did that (as you can see in the readme).