pg 7.17.0 → 7.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010 - 2019 Brian Carlson
3
+ Copyright (c) 2010 - 2020 Brian Carlson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -44,11 +44,21 @@ When you open an issue please provide:
44
44
 
45
45
  You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that's your thing. I try to always announce noteworthy changes & developments with node-postgres on Twitter.
46
46
 
47
- ### Sponsorship :star:
47
+ ## Sponsorship :two_hearts:
48
48
 
49
- [If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable please consider supporting](https://github.com/sponsors/brianc) its development.
49
+ node-postgres's continued development has been made possible in part by generous finanical support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md) and these featured sponsors:
50
50
 
51
- Also, you can view a historical list of all [previous and existing sponsors](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
51
+ <div align="center">
52
+ <a href="https://www.timescale.com" target="_blank">
53
+ <img height="80" src="https://node-postgres.com/timescale.svg" />
54
+ </a>
55
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAABCAQAAAB0m0auAAAADElEQVR42mNkIBIAAABSAAI2VLqiAAAAAElFTkSuQmCC" />
56
+ <a href="https://crate.io" target="_blank">
57
+ <img height="80" src="https://node-postgres.com/crate-io.png" />
58
+ </a>
59
+ </div>
60
+
61
+ If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
52
62
 
53
63
 
54
64
  ## Contributing
@@ -69,7 +79,7 @@ The causes and solutions to common errors can be found among the [Frequently Ask
69
79
 
70
80
  ## License
71
81
 
72
- Copyright (c) 2010-2019 Brian Carlson (brian.m.carlson@gmail.com)
82
+ Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
73
83
 
74
84
  Permission is hereby granted, free of charge, to any person obtaining a copy
75
85
  of this software and associated documentation files (the "Software"), to deal
package/lib/client.js CHANGED
@@ -545,7 +545,7 @@ Client.prototype.query = function (config, values, callback) {
545
545
  Client.prototype.end = function (cb) {
546
546
  this._ending = true
547
547
 
548
- if (this.activeQuery) {
548
+ if (this.activeQuery || !this._queryable) {
549
549
  // if we have an active query we need to force a disconnect
550
550
  // on the socket - otherwise a hung query could block end forever
551
551
  this.connection.stream.destroy()
File without changes
@@ -5,7 +5,7 @@ const util = require('util')
5
5
  const dummyFunctions = new Map()
6
6
 
7
7
  // Node 4 doesn’t support process.emitWarning(message, 'DeprecationWarning', code).
8
- const emitDeprecationWarning = (message, code) => {
8
+ const warnDeprecation = (message, code) => {
9
9
  let dummy = dummyFunctions.get(code)
10
10
 
11
11
  if (dummy === undefined) {
@@ -16,4 +16,4 @@ const emitDeprecationWarning = (message, code) => {
16
16
  dummy()
17
17
  }
18
18
 
19
- module.exports = emitDeprecationWarning
19
+ module.exports = warnDeprecation
@@ -15,6 +15,8 @@ var Writer = require('buffer-writer')
15
15
  // eslint-disable-next-line
16
16
  var PacketStream = require('pg-packet-stream')
17
17
 
18
+ var warnDeprecation = require('./compat/warn-deprecation')
19
+
18
20
  var TEXT_MODE = 0
19
21
 
20
22
  // TODO(bmc) support binary mode here
@@ -105,6 +107,9 @@ Connection.prototype.connect = function (port, host) {
105
107
  secureOptions: self.ssl.secureOptions,
106
108
  NPNProtocols: self.ssl.NPNProtocols
107
109
  }
110
+ if (typeof self.ssl.rejectUnauthorized !== 'boolean') {
111
+ warnDeprecation('Implicit disabling of certificate verification is deprecated and will be removed in pg 8. Specify `rejectUnauthorized: true` to require a valid CA or `rejectUnauthorized: false` to explicitly opt out of MITM protection.', 'PG-SSL-VERIFY')
112
+ }
108
113
  if (net.isIP(host) === 0) {
109
114
  options.servername = host
110
115
  }
File without changes
package/lib/connection.js CHANGED
@@ -14,6 +14,8 @@ var util = require('util')
14
14
  var Writer = require('buffer-writer')
15
15
  var Reader = require('packet-reader')
16
16
 
17
+ var warnDeprecation = require('./compat/warn-deprecation')
18
+
17
19
  var TEXT_MODE = 0
18
20
  var BINARY_MODE = 1
19
21
  var Connection = function (config) {
@@ -83,11 +85,13 @@ Connection.prototype.connect = function (port, host) {
83
85
  this.stream.once('data', function (buffer) {
84
86
  var responseCode = buffer.toString('utf8')
85
87
  switch (responseCode) {
86
- case 'N': // Server does not support SSL connections
87
- return self.emit('error', new Error('The server does not support SSL connections'))
88
88
  case 'S': // Server supports SSL connections, continue with a secure connection
89
89
  break
90
+ case 'N': // Server does not support SSL connections
91
+ self.stream.end()
92
+ return self.emit('error', new Error('The server does not support SSL connections'))
90
93
  default: // Any other response byte, including 'E' (ErrorResponse) indicating a server error
94
+ self.stream.end()
91
95
  return self.emit('error', new Error('There was an error establishing an SSL connection'))
92
96
  }
93
97
  var tls = require('tls')
@@ -103,13 +107,15 @@ Connection.prototype.connect = function (port, host) {
103
107
  secureOptions: self.ssl.secureOptions,
104
108
  NPNProtocols: self.ssl.NPNProtocols
105
109
  }
110
+ if (typeof self.ssl.rejectUnauthorized !== 'boolean') {
111
+ warnDeprecation('Implicit disabling of certificate verification is deprecated and will be removed in pg 8. Specify `rejectUnauthorized: true` to require a valid CA or `rejectUnauthorized: false` to explicitly opt out of MITM protection.', 'PG-SSL-VERIFY')
112
+ }
106
113
  if (net.isIP(host) === 0) {
107
114
  options.servername = host
108
115
  }
109
116
  self.stream = tls.connect(options)
110
- self.attachListeners(self.stream)
111
117
  self.stream.on('error', reportStreamError)
112
-
118
+ self.attachListeners(self.stream)
113
119
  self.emit('sslconnect')
114
120
  })
115
121
  }
@@ -340,6 +346,10 @@ Connection.prototype.end = function () {
340
346
  // 0x58 = 'X'
341
347
  this.writer.add(emptyBuffer)
342
348
  this._ending = true
349
+ if (!this.stream.writable) {
350
+ this.stream.end()
351
+ return
352
+ }
343
353
  return this.stream.write(END_BUFFER, () => {
344
354
  this.stream.end()
345
355
  })
package/lib/defaults.js CHANGED
File without changes
package/lib/index.js CHANGED
File without changes
@@ -89,7 +89,10 @@ Client.prototype._connect = function (cb) {
89
89
  this.connectionParameters.getLibpqConnectionString(function (err, conString) {
90
90
  if (err) return cb(err)
91
91
  self.native.connect(conString, function (err) {
92
- if (err) return cb(err)
92
+ if (err) {
93
+ self.native.end()
94
+ return cb(err)
95
+ }
93
96
 
94
97
  // set internal states to connected
95
98
  self._connected = true
File without changes
File without changes
package/lib/query.js CHANGED
File without changes
package/lib/result.js CHANGED
@@ -17,7 +17,7 @@ var Result = function (rowMode, types) {
17
17
  this.rowCount = null
18
18
  this.oid = null
19
19
  this.rows = []
20
- this.fields = undefined
20
+ this.fields = []
21
21
  this._parsers = undefined
22
22
  this._types = types
23
23
  this.RowCtor = null
package/lib/sasl.js CHANGED
File without changes
File without changes
package/lib/utils.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg",
3
- "version": "7.17.0",
3
+ "version": "7.18.2",
4
4
  "description": "PostgreSQL client - pure javascript & libpq with the same API",
5
5
  "keywords": [
6
6
  "database",
@@ -11,7 +11,7 @@
11
11
  "postgresql",
12
12
  "rdbms"
13
13
  ],
14
- "homepage": "http://github.com/brianc/node-postgres",
14
+ "homepage": "https://github.com/brianc/node-postgres",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git://github.com/brianc/node-postgres.git"
@@ -23,7 +23,7 @@
23
23
  "packet-reader": "1.0.0",
24
24
  "pg-connection-string": "0.1.3",
25
25
  "pg-packet-stream": "^1.1.0",
26
- "pg-pool": "^2.0.9",
26
+ "pg-pool": "^2.0.10",
27
27
  "pg-types": "^2.1.0",
28
28
  "pgpass": "1.x",
29
29
  "semver": "4.3.2"
@@ -53,5 +53,5 @@
53
53
  "engines": {
54
54
  "node": ">= 4.5.0"
55
55
  },
56
- "gitHead": "6d93951783dc774731fe0b18d07ed8bf2d78d0b2"
56
+ "gitHead": "29877530c6f7b5ebc0bf814e3a711b4b66e4d51a"
57
57
  }