mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Remove double-send of ssl request packet (#2086)
* Remove double-send of ssl request packet I missed the fact that we are already sending this. Since I don't have good test coverage for ssl [which I am planning on fixing next](https://github.com/brianc/node-postgres/issues/2009) this got missed. I'm forcing an SSL test on travis. This will break for me locally as I don't have SSL enabled on my local test DB. Something I will also remedy.
This commit is contained in:
parent
c0df3b3e95
commit
5be3d95f62
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ package-lock.json
|
||||
dist
|
||||
.DS_Store
|
||||
.vscode/
|
||||
manually-test-on-heroku.js
|
||||
|
||||
@ -115,17 +115,7 @@ Connection.prototype.connect = function (port, host) {
|
||||
}
|
||||
self.stream = tls.connect(options)
|
||||
self.stream.on('error', reportStreamError)
|
||||
|
||||
// send SSLRequest packet
|
||||
const buff = Buffer.alloc(8)
|
||||
buff.writeUInt32BE(8)
|
||||
buff.writeUInt32BE(80877103, 4)
|
||||
if (self.stream.writable) {
|
||||
self.stream.write(buff)
|
||||
}
|
||||
|
||||
self.attachListeners(self.stream)
|
||||
|
||||
self.emit('sslconnect')
|
||||
})
|
||||
}
|
||||
|
||||
15
packages/pg/test/integration/gh-issues/2085-tests.js
Normal file
15
packages/pg/test/integration/gh-issues/2085-tests.js
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
"use strict"
|
||||
var helper = require('./../test-helper')
|
||||
var assert = require('assert')
|
||||
|
||||
const suite = new helper.Suite()
|
||||
|
||||
suite.testAsync('it should connect over ssl', async () => {
|
||||
const client = new helper.pg.Client({ ssl: 'require'})
|
||||
await client.connect()
|
||||
const { rows } = await client.query('SELECT NOW()')
|
||||
assert.strictEqual(rows.length, 1)
|
||||
await client.end()
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user