Comparing version 10.1.1 to 10.1.2
@@ -13,16 +13,16 @@ // Licensed under the Apache License, Version 2.0 (the 'License'); you may not | ||
const { HttpsCookieAgent, HttpCookieAgent } = require('http-cookie-agent/http') | ||
const { URL } = require('url') | ||
const http = require('http') | ||
const https = require('https') | ||
const assert = require('assert') | ||
const querystring = require('qs') | ||
const axios = require('axios') | ||
const { CookieJar } = require('tough-cookie') | ||
const cookieJar = new CookieJar() | ||
const stream = require('stream') | ||
const pkg = require('../package.json') | ||
const AGENT_DEFAULTS = { cookies: { jar: cookieJar }, keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 } | ||
const AGENT_DEFAULTS = { keepAlive: true, maxSockets: 50, keepAliveMsecs: 30000 } | ||
const defaultHttpAgent = new http.Agent(AGENT_DEFAULTS) | ||
const defaultHttpsAgent = new https.Agent(AGENT_DEFAULTS) | ||
const SCRUBBED_STR = 'XXXXXX' | ||
const defaultHttpAgent = new HttpCookieAgent(AGENT_DEFAULTS) | ||
const defaultHttpsAgent = new HttpsCookieAgent(AGENT_DEFAULTS) | ||
const ChangesReader = require('./changesreader.js') | ||
const CookieJar = require('./cookie.js') | ||
const MultiPartFactory = require('./multipart.js') | ||
@@ -81,2 +81,5 @@ | ||
// create cookieJar for this Nano | ||
cfg.cookieJar = new CookieJar() | ||
function maybeExtractDatabaseComponent () { | ||
@@ -128,2 +131,12 @@ if (!parseUrl) { | ||
// cookie parsing | ||
if (response.headers) { | ||
const h = response.headers['set-cookie'] | ||
if (h && h.length) { | ||
h.forEach((header) => { | ||
cfg.cookieJar.parse(header, req.url) | ||
}) | ||
} | ||
} | ||
// let parsed | ||
@@ -288,3 +301,2 @@ const responseHeaders = Object.assign({ | ||
if (isJar) { | ||
req.jar = cookieJar | ||
req.withCredentials = true | ||
@@ -357,2 +369,8 @@ } | ||
// add any cookies for this domain | ||
const cookie = cfg.cookieJar.getCookieString(req.uri) | ||
if (cookie) { | ||
req.headers.cookie = cookie | ||
} | ||
if (opts.body) { | ||
@@ -383,4 +401,2 @@ if (Buffer.isBuffer(opts.body) || opts.dontStringify) { | ||
cfg.cookies = cookieJar.getCookiesSync(cfg.url) | ||
// This where the HTTP request is made. | ||
@@ -418,4 +434,2 @@ // Nano used to use the now-deprecated "request" library but now we're going to | ||
req.httpsAgent = cfg.requestDefaults.agent || defaultHttpsAgent | ||
req.httpAgent.jar = req.httpAgent.jar ? req.httpAgent.jar : cookieJar | ||
req.httpsAgent.jar = req.httpsAgent.jar ? req.httpsAgent.jar : cookieJar | ||
const ax = axios.create({ | ||
@@ -422,0 +436,0 @@ httpAgent: req.httpAgent, |
@@ -7,3 +7,3 @@ { | ||
"repository": "http://github.com/apache/couchdb-nano", | ||
"version": "10.1.1", | ||
"version": "10.1.2", | ||
"author": "Apache CouchDB <dev@couchdb.apache.org> (http://couchdb.apache.org)", | ||
@@ -21,7 +21,4 @@ "keywords": [ | ||
"dependencies": { | ||
"http-cookie-agent": "^5.0.2", | ||
"@types/tough-cookie": "^4.0.2", | ||
"axios": "^1.2.2", | ||
"qs": "^6.11.0", | ||
"tough-cookie": "^4.1.2", | ||
"node-abort-controller": "^3.0.1" | ||
@@ -28,0 +25,0 @@ }, |
@@ -575,3 +575,3 @@ [![NPM](http://img.shields.io/npm/v/nano.svg?style=flat-square)](https://www.npmjs.com/package/nano) | ||
Bulk operations(update/delete/insert) on the database, refer to the | ||
[CouchDB doc](https://docs.couchdb.org/en/2.1.1/api/database/bulk-api.html#db-bulk-docs) e.g: | ||
[CouchDB doc](https://docs.couchdb.org/en/stable/api/database/bulk-api.html#post--db-_bulk_docs) e.g: | ||
@@ -578,0 +578,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
180703
3
12
3112
2
- Removed@types/tough-cookie@^4.0.2
- Removedhttp-cookie-agent@^5.0.2
- Removedtough-cookie@^4.1.2
- Removed@types/tough-cookie@4.0.5(transitive)
- Removedagent-base@7.1.1(transitive)
- Removeddebug@4.3.7(transitive)
- Removedhttp-cookie-agent@5.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedtough-cookie@4.1.4(transitive)
- Removeduniversalify@0.2.0(transitive)
- Removedurl-parse@1.5.10(transitive)