diff --git a/mail/smtp_client.anubis b/mail/smtp_client.anubis index 95666c5..7cc636d 100644 --- a/mail/smtp_client.anubis +++ b/mail/smtp_client.anubis @@ -485,6 +485,41 @@ define SendContentResult copy_error(so_far) }. +//public define Result(SmtpClientResult, One) +// send_content +// ( +// RWStream conn, +// List(Data_IO) mail_part, +// SmtpClientSession session, +// Int timeout, +// (Int) -> One progress_report, +// (LogLevel, String) -> One logger +// ) = +// with start_time = now, +// if sm_copy_Data_IO_List_to_Stream(mail_part, conn, session, now, 0, progress_report, logger) is +// { +// smtp_reply(reply) then error(reply) +// copy_error(written) then +// with finish_time = now, +// logger(logError, "send_content: error sending data"); +// logger(logTrace, "send_content: "+written+" bytes sent in "+finish_time - start_time+" second(s)"); +// if written > 1024000 then +// logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error."); +// error(reply(452, "", ["Error sending big email (more than 1 Mb)"])) +// else +// error(error), +// copy_ok(size) then +// if reliable_write(tcp(conn), [crlf_dot_crlf]) is +// { +// failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error), +// success(_) then +// with finish_time = (Int)now, +// logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)"); +// check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique) +// } +// }. + + public define Result(SmtpClientResult, One) send_content ( @@ -496,30 +531,26 @@ public define Result(SmtpClientResult, One) (LogLevel, String) -> One logger ) = with start_time = now, - if sm_copy_Data_IO_List_to_Stream(mail_part, conn, session, now, 0, progress_report, logger) is - { - smtp_reply(reply) then error(reply) - copy_error(written) then - with finish_time = now, - logger(logError, "send_content: error sending data"); - logger(logTrace, "send_content: "+written+" bytes sent in "+finish_time - start_time+" second(s)"); - if written > 1024000 then - logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error."); - error(reply(452, "", ["Error sending big email (more than 1 Mb)"])) - else - error(error), - copy_ok(size) then - if reliable_write(tcp(conn), [crlf_dot_crlf]) is - { - failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error), - success(_) then - with finish_time = (Int)now, - logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)"); - check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique) - } - }. - - + if copy_Data_IO_List_to_Stream(mail_part, weaken(conn)) is copy_ok(size) then + if reliable_write(tcp(conn), [crlf_dot_crlf]) is + { + failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error), + success(_) then + with finish_time = (Int)now, + logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)"); + check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique) + } + else + with finish_time = now, + logger(logError, "send_content: error sending data"); + logger(logTrace, "send_content: during "+finish_time - start_time+" second(s)"); +// if written > 1024000 then +// logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error."); +// error(reply(452, "", ["Error sending big email (more than 1 Mb)"])) +// else + error(error) + . + Almost the same for 'QUIT': public define One diff --git a/web/CXM_multihost_http_server.anubis b/web/CXM_multihost_http_server.anubis index c373cd4..91e837e 100644 --- a/web/CXM_multihost_http_server.anubis +++ b/web/CXM_multihost_http_server.anubis @@ -2176,7 +2176,7 @@ define One String filename // name of file ) = if sent >= size then unique else - if read(file,min(16384,size-sent),60) is + if read(file,min(65536,size-sent),60) is { error then log_journal_msg(desc,"Cannot read from file '"+filename+"'.\n"), timeout then log_journal_msg(desc,"Cannot read from file timeoput'"+filename+"'.\n"), -- libgit2 0.21.4