You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2023/01/11 10:37:55 UTC

[couchdb-nano] 01/01: fix cookie handling bug

This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch 10.1.1
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git

commit fc357fc68161ae324df7f92f52256ac8ea9725fe
Author: Glynn Bird <gl...@apache.org>
AuthorDate: Wed Jan 11 10:36:43 2023 +0000

    fix cookie handling bug
---
 lib/nano.js            |  2 +-
 package-lock.json      | 33 ++++++++++++++++++---------------
 package.json           |  6 +++---
 test/nano.auth.test.js |  2 +-
 4 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/lib/nano.js b/lib/nano.js
index 26a294f..6f76199 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -19,7 +19,7 @@ const { CookieJar } = require('tough-cookie')
 const cookieJar = new CookieJar()
 const stream = require('stream')
 const pkg = require('../package.json')
-const AGENT_DEFAULTS = { jar: cookieJar, keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 }
+const AGENT_DEFAULTS = { cookies: { jar: cookieJar }, keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 }
 const SCRUBBED_STR = 'XXXXXX'
 const defaultHttpAgent = new HttpCookieAgent(AGENT_DEFAULTS)
 const defaultHttpsAgent = new HttpsCookieAgent(AGENT_DEFAULTS)
diff --git a/package-lock.json b/package-lock.json
index c077bf4..c0ec08e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,8 +10,8 @@
       "license": "Apache-2.0",
       "dependencies": {
         "@types/tough-cookie": "^4.0.2",
-        "axios": "^1.1.3",
-        "http-cookie-agent": "^4.0.2",
+        "axios": "^1.2.2",
+        "http-cookie-agent": "^5.0.2",
         "node-abort-controller": "^3.0.1",
         "qs": "^6.11.0",
         "tough-cookie": "^4.1.2"
@@ -1420,9 +1420,9 @@
       "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
     },
     "node_modules/axios": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
-      "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz",
+      "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
       "dependencies": {
         "follow-redirects": "^1.15.0",
         "form-data": "^4.0.0",
@@ -3018,19 +3018,22 @@
       "dev": true
     },
     "node_modules/http-cookie-agent": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-4.0.2.tgz",
-      "integrity": "sha512-noTmxdH5CuytTnLj/Qv3Z84e/YFq8yLXAw3pqIYZ25Edhb9pQErIAC+ednw40Cic6Le/h9ryph5/TqsvkOaUCw==",
+      "version": "5.0.2",
+      "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-5.0.2.tgz",
+      "integrity": "sha512-BiBmZyIMGl5mLKmY7KH2uCVlcNUl1jexjdtWXFCUF4DFOrNZg1c5iPPTzWDzU7Ngfb6fB03DPpJQ80KQWmycsg==",
       "dependencies": {
         "agent-base": "^6.0.2"
       },
       "engines": {
         "node": ">=14.18.0 <15.0.0 || >=16.0.0"
       },
+      "funding": {
+        "url": "https://github.com/sponsors/3846masa"
+      },
       "peerDependencies": {
         "deasync": "^0.1.26",
         "tough-cookie": "^4.0.0",
-        "undici": "^5.1.1"
+        "undici": "^5.11.0"
       },
       "peerDependenciesMeta": {
         "deasync": {
@@ -6833,9 +6836,9 @@
       "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
     },
     "axios": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
-      "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz",
+      "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
       "requires": {
         "follow-redirects": "^1.15.0",
         "form-data": "^4.0.0",
@@ -7978,9 +7981,9 @@
       "dev": true
     },
     "http-cookie-agent": {
-      "version": "4.0.2",
-      "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-4.0.2.tgz",
-      "integrity": "sha512-noTmxdH5CuytTnLj/Qv3Z84e/YFq8yLXAw3pqIYZ25Edhb9pQErIAC+ednw40Cic6Le/h9ryph5/TqsvkOaUCw==",
+      "version": "5.0.2",
+      "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-5.0.2.tgz",
+      "integrity": "sha512-BiBmZyIMGl5mLKmY7KH2uCVlcNUl1jexjdtWXFCUF4DFOrNZg1c5iPPTzWDzU7Ngfb6fB03DPpJQ80KQWmycsg==",
       "requires": {
         "agent-base": "^6.0.2"
       }
diff --git a/package.json b/package.json
index 1c6b47c..1f316ef 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "license": "Apache-2.0",
   "homepage": "http://github.com/apache/couchdb-nano",
   "repository": "http://github.com/apache/couchdb-nano",
-  "version": "10.1.0",
+  "version": "10.1.1",
   "author": "Apache CouchDB <de...@couchdb.apache.org> (http://couchdb.apache.org)",
   "keywords": [
     "couchdb",
@@ -17,9 +17,9 @@
     "database"
   ],
   "dependencies": {
-    "http-cookie-agent": "^4.0.2",
+    "http-cookie-agent": "^5.0.2",
     "@types/tough-cookie": "^4.0.2",
-    "axios": "^1.1.3",
+    "axios": "^1.2.2",
     "qs": "^6.11.0",
     "tough-cookie": "^4.1.2",
     "node-abort-controller": "^3.0.1"
diff --git a/test/nano.auth.test.js b/test/nano.auth.test.js
index 4997f2f..7018275 100644
--- a/test/nano.auth.test.js
+++ b/test/nano.auth.test.js
@@ -29,7 +29,7 @@ test('should be able to authenticate - POST /_session - nano.auth', async () =>
   const scope = nock(COUCH_URL)
     .post('/_session', 'name=u&password=p', { 'content-type': 'application/x-www-form-urlencoded; charset=utf-8' })
     .reply(200, response, { 'Set-Cookie': cookie })
-    .get('/_all_dbs')
+    .get('/_all_dbs', undefined, { headers: { cookie: c } })
     .reply(200, ['a'])
 
   // test POST /_session