protected
procedure HandleClient(Connection: TTCPConnection); override;
procedure ReceiveEMailData(TCP: TTCPRFCConnection; Response: TRFCReply; SpoolObject: TSpoolObjectCreator);
+ public
+ function StartListen: boolean;
end;
begin
{ Request connection objects with support for RFC-style commands & responses. }
inherited Create(Address, Port, NET_TCP_RFCSUPPORT);
- Logger.AddLine('Server', 'Listening on address: ' + Address + ':' + IntToStr(Port));
end;
+function TMgSMTPListener.StartListen: boolean;
+begin
+ Result:= inherited StartListen;
+ if Result then
+ Logger.AddLine('Server', 'Listening on address: ' + GetSockAddrStr)
+ else
+ Logger.AddLine('Server', 'Failed to listen on address: ' + GetSockAddrStr);
+end;
+
procedure TMgSMTPListener.HandleClient(Connection: TTCPConnection);
{ This is the procedure that actually handles the clients. It receives
an object that manages the established connection in the parameter.
if (Length(Cmd) = 0) or (not ReadSucceeded) or UnexpectedFail then { Nothing. }
- else if (Cmd = 'GET') or (Cmd = 'HEAD') or (Cmd = 'POST') then begin
+ else if (Cmd = 'GET') or (Cmd = 'HEAD') or (Cmd = 'PUT') or (Cmd = 'POST')
+ or (Cmd = 'DELETE') or (Cmd = 'CONNECT') or (Cmd = 'OPTIONS')
+ or (Cmd = 'PATCH') or (Cmd = 'TRACE') then begin
SendAndLogResponse(SMTP_R_SERVICE_NA, 'Please learn to speak SMTP for I won''t speak HTTP. Stop abusing my service!');
UnexpectedFail:= true;
end