diff --git a/Changes.md b/Changes.md index 95bb8a701..dffc62491 100644 --- a/Changes.md +++ b/Changes.md @@ -1,12 +1,36 @@ -## 2.8.21 - Mmm DD, 2018 + +## 2.8.22 - Mmm DD, 2018 * New Features - * outbound: skip STARTTLS after remote host fails TLS upgrade - * dns_list_base: introduce global plugin.lookback_is_rejected flag #2422 * Fixes * Changes +## 2.8.21 - Jul 20, 2018 + +### New Features + +* outbound: skip STARTTLS after remote host fails TLS upgrade #2429 +* dns_list_base: introduce global plugin.lookback_is_rejected flag #2422 + +### Fixes + +* replace all _ chars in hostnames with code points #2485 +* Don't die on invalid commands #2481 +* outbound: check list exists before attempting to use it #2478 + * refactor outbound/hmail.process_ehlo_data #2488 +* tls: skip when redis is undefined #2472 +* Don't run delivered hook on LMTP fail #2470 +* Add tls_socket.load_tls_ini() to tls.register() #2465 + +### Changes + +* outbound/tls: make into a class #2474 +* plugins: clear timeout on cancel #2477 +* txn.parse_body consistently a boolean #2476 +* update ipaddr.js to version 1.8.0 #2468 + + ## 2.8.20 - Jun 29, 2018 * New Features diff --git a/messagestream.js b/messagestream.js index 3526045c2..454541d52 100644 --- a/messagestream.js +++ b/messagestream.js @@ -10,7 +10,7 @@ const STATE_HEADERS = 1; const STATE_BODY = 2; class MessageStream extends Stream { - constructor (config, id, headers) { + constructor (cfg, id, headers) { super(); if (!id) throw new Error('id required'); this.uuid = id; @@ -24,12 +24,12 @@ class MessageStream extends Stream { this.buffered = 0; this._queue = []; this.max_data_inflight = 0; - this.buffer_max = (!isNaN(config.main.spool_after) ? - Number(config.main.spool_after) : -1); + this.buffer_max = (!isNaN(cfg.main.spool_after) ? + Number(cfg.main.spool_after) : -1); this.spooling = false; this.fd = null; this.open_pending = false; - this.spool_dir = config.main.spool_dir || '/tmp'; + this.spool_dir = cfg.main.spool_dir || '/tmp'; this.filename = this.spool_dir + '/' + id + '.eml'; this.write_pending = false; diff --git a/package.json b/package.json index a2ee1b118..45927741b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "description": "An SMTP Server project.", "keywords": [ "haraka", "smtp", "server", "email" ], - "version": "2.8.20", + "version": "2.8.21", "homepage": "http://haraka.github.io", "repository": { "type": "git", diff --git a/transaction.js b/transaction.js index 94ed51c7b..40714f81f 100644 --- a/transaction.js +++ b/transaction.js @@ -1,14 +1,17 @@ 'use strict'; // An SMTP Transaction -const util = require('util'); +// node.js built-in modules +const util = require('util'); +// haraka npm modules const config = require('haraka-config'); -const Notes = require('haraka-notes'); -const utils = require('haraka-utils'); +const Notes = require('haraka-notes'); +const utils = require('haraka-utils'); +// Haraka modules const Header = require('./mailheader').Header; -const body = require('./mailbody'); +const body = require('./mailbody'); const MessageStream = require('./messagestream'); const MAX_HEADER_LINES = config.get('max_header_lines') || 1000; @@ -72,37 +75,31 @@ class Transaction { } add_data (line) { - if (typeof line === 'string') { // This shouldn't ever really happen... + if (typeof line === 'string') { // This shouldn't ever happen. line = new Buffer(line, this.encoding); } - // check if this is the end of headers line + // is this the end of headers line? if (this.header_pos === 0 && (line[0] === 0x0A || (line[0] === 0x0D && line[1] === 0x0A))) { this.header.parse(this.header_lines); this.header_pos = this.header_lines.length; this.found_hb_sep = true; - if (this.parse_body) { - this.ensure_body(); - } + if (this.parse_body) this.ensure_body(); } else if (this.header_pos === 0) { // Build up headers if (this.header_lines.length < MAX_HEADER_LINES) { - if (line[0] === 0x2E) line = line.slice(1); // Strip leading "." - this.header_lines.push( - line.toString(this.encoding).replace(/\r\n$/, '\n')); + if (line[0] === 0x2E) line = line.slice(1); // Strip leading '.' + this.header_lines.push(line.toString(this.encoding).replace(/\r\n$/, '\n')); } } else if (this.header_pos && this.parse_body) { let new_line = line; if (new_line[0] === 0x2E) new_line = new_line.slice(1); // Strip leading "." - new_line = this.body.parse_more( - new_line.toString(this.encoding).replace(/\r\n$/, '\n')); + new_line = this.body.parse_more(new_line.toString(this.encoding).replace(/\r\n$/, '\n')); - if (!new_line.length) { - return; // buffering for banners - } + if (!new_line.length) return; // buffering for banners } if (!this.discard_data) this.message_stream.add_line(line); @@ -145,11 +142,11 @@ class Transaction { } } - if (!this.discard_data) { - this.message_stream.add_line_end(cb); + if (this.discard_data) { + cb(); } else { - cb(); + this.message_stream.add_line_end(cb); } }