mirror of
https://github.com/MailHops/mailhops-node.git
synced 2025-05-15 19:30:13 -07:00
Added received header id check
This commit is contained in:
parent
bb628e4030
commit
3f35f7c77a
@ -88,6 +88,8 @@ module.exports = {
|
|||||||
&& !lastchar.match(/\.|\d|\-/)
|
&& !lastchar.match(/\.|\d|\-/)
|
||||||
&& ( firstchar != '?' && lastchar != '?' )
|
&& ( firstchar != '?' && lastchar != '?' )
|
||||||
&& lastchar != ';'
|
&& lastchar != ';'
|
||||||
|
&& line.toLowerCase().indexOf('id '+ip) === -1
|
||||||
|
&& parseInt(ip.substring(0,ip.indexOf('.'))) < 240 //IANA-RESERVED
|
||||||
&& regexIp.test(ip)){
|
&& regexIp.test(ip)){
|
||||||
|
|
||||||
ips.unshift( ip );
|
ips.unshift( ip );
|
||||||
|
@ -14,7 +14,7 @@ DKIM-Signature: v=1; a=rsa-sha1; c=relaxed;
|
|||||||
4DAOoP00xozjkYc6KMkyOLFUrfRrZEpBYXQC0m6IXDsyiTuk8SkopTpcc8YYitoa
|
4DAOoP00xozjkYc6KMkyOLFUrfRrZEpBYXQC0m6IXDsyiTuk8SkopTpcc8YYitoa
|
||||||
yv4eaW1h9XRG0VYvl3RbBX5QFZsikRmReBO9Yu8gdLizZ8X83SF5TCwDLU99V/OL
|
yv4eaW1h9XRG0VYvl3RbBX5QFZsikRmReBO9Yu8gdLizZ8X83SF5TCwDLU99V/OL
|
||||||
F6oLELBhbNFezk=
|
F6oLELBhbNFezk=
|
||||||
Received: by filter0500p1mdw1.sendgrid.net with SMTP id filter0500p1mdw1.14444.557F0D731E
|
Received: by filter0500p1mdw1.sendgrid.net with SMTP id 15.1.225.42
|
||||||
2015-06-15 17:37:59.069788226 +0000 UTC
|
2015-06-15 17:37:59.069788226 +0000 UTC
|
||||||
Received: from queue-worker-166.servers.clovesoftware.com (ec2-54-157-138-253.compute-1.amazonaws.com [54.157.138.253])
|
Received: from queue-worker-166.servers.clovesoftware.com (ec2-54-157-138-253.compute-1.amazonaws.com [54.157.138.253])
|
||||||
by ismtpd-013 (SG) with ESMTP id 14df84c98b9.582.18b0cc
|
by ismtpd-013 (SG) with ESMTP id 14df84c98b9.582.18b0cc
|
||||||
|
@ -78,6 +78,7 @@ describe("main", function(){
|
|||||||
//read header form file
|
//read header form file
|
||||||
var header = fs.readFileSync(__dirname+'/header-test.eml',{ encoding: 'utf8' });
|
var header = fs.readFileSync(__dirname+'/header-test.eml',{ encoding: 'utf8' });
|
||||||
var ips = mailhops.getIPsFromHeader(header);
|
var ips = mailhops.getIPsFromHeader(header);
|
||||||
|
|
||||||
it('should return an array of 9 Received IPs', function(done){
|
it('should return an array of 9 Received IPs', function(done){
|
||||||
assert.equal(ips.length,9);
|
assert.equal(ips.length,9);
|
||||||
done();
|
done();
|
||||||
@ -102,6 +103,12 @@ describe("main", function(){
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not find id 15.1.225.42', function(done){
|
||||||
|
assert.equal(ips.indexOf('15.1.225.42'),-1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should return a 200 response and route of 10 hops', function(done){
|
it('should return a 200 response and route of 10 hops', function(done){
|
||||||
mailhops.lookup(mailhops.getIPsFromHeader(header), function(err, res, body){
|
mailhops.lookup(mailhops.getIPsFromHeader(header), function(err, res, body){
|
||||||
assert.equal(res.statusCode,200);
|
assert.equal(res.statusCode,200);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user