Skip to content

Commit

Permalink
release Haraka 2.8.21 (#2480)
Browse files Browse the repository at this point in the history
* transaction: flow & style improvements
* transaction: whitespace and comment (style) improve
* messagestream: rename config => cfg
* update Changes.md
* bump Haraka version
  • Loading branch information
msimerson authored Aug 8, 2018
1 parent ff0b9d4 commit 3a175f2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
30 changes: 27 additions & 3 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions messagestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
37 changes: 17 additions & 20 deletions transaction.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 3a175f2

Please sign in to comment.