From fdcb29a52b1c339afeb9b841d79cabd12cfb31dd Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sun, 6 May 2018 12:09:55 -0700 Subject: [PATCH] smtp: rename readByteLine to readDataBlock for #98. Update change log. --- CHANGELOG.md | 8 ++++++++ pkg/server/smtp/handler.go | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb3ddca..8e95406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,20 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +### Added +- SMTP TLS support (thanks kingforaday.) + + ## [v2.0.0] - 2018-05-05 ### Changed - Corrected docs for INBUCKET_STORAGE_PARAMS (thanks evilmrburns.) - Disabled color log output on Windows, doesn't work there. + ## [v2.0.0-rc1] - 2018-04-07 ### Added diff --git a/pkg/server/smtp/handler.go b/pkg/server/smtp/handler.go index cb54e8e..ad7c87b 100644 --- a/pkg/server/smtp/handler.go +++ b/pkg/server/smtp/handler.go @@ -402,7 +402,7 @@ func (s *Session) mailHandler(cmd string, arg string) { // DATA func (s *Session) dataHandler() { s.send("354 Start mail input; end with .") - msgBuf, err := s.readByteLine() + msgBuf, err := s.readDataBlock() if err != nil { if netErr, ok := err.(net.Error); ok { if netErr.Timeout() { @@ -471,8 +471,8 @@ func (s *Session) send(msg string) { } } -// readByteLine reads a line of input, returns byte slice. -func (s *Session) readByteLine() ([]byte, error) { +// readDataBlock reads message DATA until `.` using the textproto pkg. +func (s *Session) readDataBlock() ([]byte, error) { if err := s.conn.SetReadDeadline(s.nextDeadline()); err != nil { return nil, err } @@ -486,7 +486,7 @@ func (s *Session) readByteLine() ([]byte, error) { return b, err } -// Reads a line of input +// readLine reads a line of input respecting deadlines. func (s *Session) readLine() (line string, err error) { if err = s.conn.SetReadDeadline(s.nextDeadline()); err != nil { return "", err