From 29b14f83c92179134b0049b2b98ce75ec15335bd Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Mon, 12 Sep 2016 15:55:42 -0700 Subject: [PATCH] rm -rf udp (#197) * rm -rf udp This has been gone for years --- lib/transports.js | 22 +--------------------- package.json | 1 - test/raven.client.js | 17 ++--------------- test/raven.utils.js | 14 -------------- 4 files changed, 3 insertions(+), 51 deletions(-) diff --git a/lib/transports.js b/lib/transports.js index 5464224a2d19..3cb62fc401f1 100644 --- a/lib/transports.js +++ b/lib/transports.js @@ -63,28 +63,8 @@ function HTTPSTransport(options) { } util.inherits(HTTPSTransport, HTTPTransport); -var dgram = require('dgram'); - -function UDPTransport() { - this.defaultPort = 12345; -} -util.inherits(UDPTransport, Transport); -UDPTransport.prototype.send = function(client, message, headers, ident) { - message = new Buffer(headers['X-Sentry-Auth'] + '\n\n' + message); - - var udp = dgram.createSocket('udp4'); - udp.send(message, 0, message.length, client.dsn.port || this.defaultPort, client.dsn.host, function(e, bytes) { - if (e) { - return client.emit('error', e); - } - client.emit('logged', ident); - udp.close(); - }); -}; - module.exports.http = new HTTPTransport(); module.exports.https = new HTTPSTransport(); -module.exports.udp = new UDPTransport(); module.exports.Transport = Transport; module.exports.HTTPTransport = HTTPTransport; -module.exports.HTTPSTransport = HTTPSTransport; \ No newline at end of file +module.exports.HTTPSTransport = HTTPSTransport; diff --git a/package.json b/package.json index 71a1bd71b86e..602fa8da556c 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "istanbul": "^0.4.3", "koa": "*", "mocha": "*", - "mock-udp": "*", "nock": "~0.28.2", "should": "~3.3.1" } diff --git a/test/raven.client.js b/test/raven.client.js index 5b75e26c43aa..a76a369458f6 100644 --- a/test/raven.client.js +++ b/test/raven.client.js @@ -3,7 +3,6 @@ var raven = require('../'), nock = require('nock'), - mockudp = require('mock-udp'), zlib = require('zlib'); var dsn = 'https://public:private@app.getsentry.com/269'; @@ -249,18 +248,6 @@ describe('raven.Client', function() { client.captureError(new Error('wtf?')); }); - it('should send an Error to Sentry server over UDP', function(done) { - var scope = mockudp('app.getsentry.com:1234'); - - var dsn = 'udp://public:private@app.getsentry.com:1234/269'; - var client = new raven.Client(dsn); - client.on('logged', function() { - scope.done(); - done(); - }); - client.captureError(new Error('wtf?')); - }); - it('shouldn\'t choke on circular references', function(done) { // See: https://github.com/mattrobenolt/raven-node/pull/46 var old = zlib.deflate; @@ -418,7 +405,7 @@ describe('raven.Client', function() { it('should use a custom transport', function() { var expected = { - protocol: 'udp', + protocol: 'https', public_key: 'public', private_key: 'private', host: 'app.getsentry.com', @@ -426,7 +413,7 @@ describe('raven.Client', function() { project_id: 269, port: 443 }; - var dsn = 'heka+udp://public:private@app.getsentry.com/269'; + var dsn = 'heka+https://public:private@app.getsentry.com/269'; var client = new raven.Client(dsn, { transport: 'some_heka_instance' }); diff --git a/test/raven.utils.js b/test/raven.utils.js index cd1724a20284..b645db764af1 100644 --- a/test/raven.utils.js +++ b/test/raven.utils.js @@ -51,20 +51,6 @@ describe('raven.utils', function() { raven.utils.parseDSN('').should.eql(false); }); - it('should parse UDP DSN', function() { - var dsn = raven.utils.parseDSN('udp://8769c40cf49c4cc58b51fa45d8e2d166:296768aa91084e17b5ac02d3ad5bc7e7@mysentry.com:1234/some/other/path/269'); - var expected = { - protocol: 'udp', - public_key: '8769c40cf49c4cc58b51fa45d8e2d166', - private_key: '296768aa91084e17b5ac02d3ad5bc7e7', - host: 'mysentry.com', - path: '/some/other/path/', - project_id: 269, - port: 1234 - }; - dsn.should.eql(expected); - }); - it('show throw an Error on invalid transport protocol', function() { (function() { raven.utils.parseDSN('noop://8769c40cf49c4cc58b51fa45d8e2d166:296768aa91084e17b5ac02d3ad5bc7e7@mysentry.com:1234/some/other/path/269');