údržba
This commit is contained in:
55
CyLukTs/lukan/node_modules/@cypress/request/LICENSE
generated
vendored
Normal file
55
CyLukTs/lukan/node_modules/@cypress/request/LICENSE
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
1031
CyLukTs/lukan/node_modules/@cypress/request/README.md
generated
vendored
Normal file
1031
CyLukTs/lukan/node_modules/@cypress/request/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
155
CyLukTs/lukan/node_modules/@cypress/request/index.js
generated
vendored
Normal file
155
CyLukTs/lukan/node_modules/@cypress/request/index.js
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
// Copyright 2010-2012 Mikeal Rogers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict'
|
||||
|
||||
var extend = require('extend')
|
||||
var cookies = require('./lib/cookies')
|
||||
var helpers = require('./lib/helpers')
|
||||
|
||||
var paramsHaveRequestBody = helpers.paramsHaveRequestBody
|
||||
|
||||
// organize params for patch, post, put, head, del
|
||||
function initParams (uri, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
}
|
||||
|
||||
var params = {}
|
||||
if (options !== null && typeof options === 'object') {
|
||||
extend(params, options, {uri: uri})
|
||||
} else if (typeof uri === 'string') {
|
||||
extend(params, {uri: uri})
|
||||
} else {
|
||||
extend(params, uri)
|
||||
}
|
||||
|
||||
params.callback = callback || params.callback
|
||||
return params
|
||||
}
|
||||
|
||||
function request (uri, options, callback) {
|
||||
if (typeof uri === 'undefined') {
|
||||
throw new Error('undefined is not a valid uri or options object.')
|
||||
}
|
||||
|
||||
var params = initParams(uri, options, callback)
|
||||
|
||||
if (params.method === 'HEAD' && paramsHaveRequestBody(params)) {
|
||||
throw new Error('HTTP HEAD requests MUST NOT include a request body.')
|
||||
}
|
||||
|
||||
return new request.Request(params)
|
||||
}
|
||||
|
||||
function verbFunc (verb) {
|
||||
var method = verb.toUpperCase()
|
||||
return function (uri, options, callback) {
|
||||
var params = initParams(uri, options, callback)
|
||||
params.method = method
|
||||
return request(params, params.callback)
|
||||
}
|
||||
}
|
||||
|
||||
// define like this to please codeintel/intellisense IDEs
|
||||
request.get = verbFunc('get')
|
||||
request.head = verbFunc('head')
|
||||
request.options = verbFunc('options')
|
||||
request.post = verbFunc('post')
|
||||
request.put = verbFunc('put')
|
||||
request.patch = verbFunc('patch')
|
||||
request.del = verbFunc('delete')
|
||||
request['delete'] = verbFunc('delete')
|
||||
|
||||
request.jar = function (store) {
|
||||
return cookies.jar(store)
|
||||
}
|
||||
|
||||
request.cookie = function (str) {
|
||||
return cookies.parse(str)
|
||||
}
|
||||
|
||||
function wrapRequestMethod (method, options, requester, verb) {
|
||||
return function (uri, opts, callback) {
|
||||
var params = initParams(uri, opts, callback)
|
||||
|
||||
var target = {}
|
||||
extend(true, target, options, params)
|
||||
|
||||
target.pool = params.pool || options.pool
|
||||
|
||||
if (verb) {
|
||||
target.method = verb.toUpperCase()
|
||||
}
|
||||
|
||||
if (typeof requester === 'function') {
|
||||
method = requester
|
||||
}
|
||||
|
||||
return method(target, target.callback)
|
||||
}
|
||||
}
|
||||
|
||||
request.defaults = function (options, requester) {
|
||||
var self = this
|
||||
|
||||
options = options || {}
|
||||
|
||||
if (typeof options === 'function') {
|
||||
requester = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
var defaults = wrapRequestMethod(self, options, requester)
|
||||
|
||||
var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete']
|
||||
verbs.forEach(function (verb) {
|
||||
defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
|
||||
})
|
||||
|
||||
defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
|
||||
defaults.jar = self.jar
|
||||
defaults.defaults = self.defaults
|
||||
return defaults
|
||||
}
|
||||
|
||||
request.forever = function (agentOptions, optionsArg) {
|
||||
var options = {}
|
||||
if (optionsArg) {
|
||||
extend(options, optionsArg)
|
||||
}
|
||||
if (agentOptions) {
|
||||
options.agentOptions = agentOptions
|
||||
}
|
||||
|
||||
options.forever = true
|
||||
return request.defaults(options)
|
||||
}
|
||||
|
||||
// Exports
|
||||
|
||||
module.exports = request
|
||||
request.Request = require('./request')
|
||||
request.initParams = initParams
|
||||
|
||||
// Backwards compatibility for request.debug
|
||||
Object.defineProperty(request, 'debug', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return request.Request.debug
|
||||
},
|
||||
set: function (debug) {
|
||||
request.Request.debug = debug
|
||||
}
|
||||
})
|
167
CyLukTs/lukan/node_modules/@cypress/request/lib/auth.js
generated
vendored
Normal file
167
CyLukTs/lukan/node_modules/@cypress/request/lib/auth.js
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
'use strict'
|
||||
|
||||
var caseless = require('caseless')
|
||||
var { v4: uuid } = require('uuid')
|
||||
var helpers = require('./helpers')
|
||||
|
||||
var md5 = helpers.md5
|
||||
var toBase64 = helpers.toBase64
|
||||
|
||||
function Auth (request) {
|
||||
// define all public properties here
|
||||
this.request = request
|
||||
this.hasAuth = false
|
||||
this.sentAuth = false
|
||||
this.bearerToken = null
|
||||
this.user = null
|
||||
this.pass = null
|
||||
}
|
||||
|
||||
Auth.prototype.basic = function (user, pass, sendImmediately) {
|
||||
var self = this
|
||||
if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
|
||||
self.request.emit('error', new Error('auth() received invalid user or password'))
|
||||
}
|
||||
self.user = user
|
||||
self.pass = pass
|
||||
self.hasAuth = true
|
||||
var header = user + ':' + (pass || '')
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
var authHeader = 'Basic ' + toBase64(header)
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.bearer = function (bearer, sendImmediately) {
|
||||
var self = this
|
||||
self.bearerToken = bearer
|
||||
self.hasAuth = true
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
if (typeof bearer === 'function') {
|
||||
bearer = bearer()
|
||||
}
|
||||
var authHeader = 'Bearer ' + (bearer || '')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.digest = function (method, path, authHeader) {
|
||||
// TODO: More complete implementation of RFC 2617.
|
||||
// - handle challenge.domain
|
||||
// - support qop="auth-int" only
|
||||
// - handle Authentication-Info (not necessarily?)
|
||||
// - check challenge.stale (not necessarily?)
|
||||
// - increase nc (not necessarily?)
|
||||
// For reference:
|
||||
// http://tools.ietf.org/html/rfc2617#section-3
|
||||
// https://github.com/bagder/curl/blob/master/lib/http_digest.c
|
||||
|
||||
var self = this
|
||||
|
||||
var challenge = {}
|
||||
var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi
|
||||
while (true) {
|
||||
var match = re.exec(authHeader)
|
||||
if (!match) {
|
||||
break
|
||||
}
|
||||
challenge[match[1]] = match[2] || match[3]
|
||||
}
|
||||
|
||||
/**
|
||||
* RFC 2617: handle both MD5 and MD5-sess algorithms.
|
||||
*
|
||||
* If the algorithm directive's value is "MD5" or unspecified, then HA1 is
|
||||
* HA1=MD5(username:realm:password)
|
||||
* If the algorithm directive's value is "MD5-sess", then HA1 is
|
||||
* HA1=MD5(MD5(username:realm:password):nonce:cnonce)
|
||||
*/
|
||||
var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) {
|
||||
var ha1 = md5(user + ':' + realm + ':' + pass)
|
||||
if (algorithm && algorithm.toLowerCase() === 'md5-sess') {
|
||||
return md5(ha1 + ':' + nonce + ':' + cnonce)
|
||||
} else {
|
||||
return ha1
|
||||
}
|
||||
}
|
||||
|
||||
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
|
||||
var nc = qop && '00000001'
|
||||
var cnonce = qop && uuid().replace(/-/g, '')
|
||||
var ha1 = ha1Compute(challenge.algorithm, self.user, challenge.realm, self.pass, challenge.nonce, cnonce)
|
||||
var ha2 = md5(method + ':' + path)
|
||||
var digestResponse = qop
|
||||
? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2)
|
||||
: md5(ha1 + ':' + challenge.nonce + ':' + ha2)
|
||||
var authValues = {
|
||||
username: self.user,
|
||||
realm: challenge.realm,
|
||||
nonce: challenge.nonce,
|
||||
uri: path,
|
||||
qop: qop,
|
||||
response: digestResponse,
|
||||
nc: nc,
|
||||
cnonce: cnonce,
|
||||
algorithm: challenge.algorithm,
|
||||
opaque: challenge.opaque
|
||||
}
|
||||
|
||||
authHeader = []
|
||||
for (var k in authValues) {
|
||||
if (authValues[k]) {
|
||||
if (k === 'qop' || k === 'nc' || k === 'algorithm') {
|
||||
authHeader.push(k + '=' + authValues[k])
|
||||
} else {
|
||||
authHeader.push(k + '="' + authValues[k] + '"')
|
||||
}
|
||||
}
|
||||
}
|
||||
authHeader = 'Digest ' + authHeader.join(', ')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
|
||||
Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var authHeader
|
||||
if (bearer === undefined && user === undefined) {
|
||||
self.request.emit('error', new Error('no auth mechanism defined'))
|
||||
} else if (bearer !== undefined) {
|
||||
authHeader = self.bearer(bearer, sendImmediately)
|
||||
} else {
|
||||
authHeader = self.basic(user, pass, sendImmediately)
|
||||
}
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.onResponse = function (response) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
if (!self.hasAuth || self.sentAuth) { return null }
|
||||
|
||||
var c = caseless(response.headers)
|
||||
|
||||
var authHeader = c.get('www-authenticate')
|
||||
var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase()
|
||||
request.debug('reauth', authVerb)
|
||||
|
||||
switch (authVerb) {
|
||||
case 'basic':
|
||||
return self.basic(self.user, self.pass, true)
|
||||
|
||||
case 'bearer':
|
||||
return self.bearer(self.bearerToken, true)
|
||||
|
||||
case 'digest':
|
||||
return self.digest(request.method, request.path, authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
exports.Auth = Auth
|
38
CyLukTs/lukan/node_modules/@cypress/request/lib/cookies.js
generated
vendored
Normal file
38
CyLukTs/lukan/node_modules/@cypress/request/lib/cookies.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
|
||||
var tough = require('tough-cookie')
|
||||
|
||||
var Cookie = tough.Cookie
|
||||
var CookieJar = tough.CookieJar
|
||||
|
||||
exports.parse = function (str) {
|
||||
if (str && str.uri) {
|
||||
str = str.uri
|
||||
}
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('The cookie function only accepts STRING as param')
|
||||
}
|
||||
return Cookie.parse(str, {loose: true})
|
||||
}
|
||||
|
||||
// Adapt the sometimes-Async api of tough.CookieJar to our requirements
|
||||
function RequestJar (store) {
|
||||
var self = this
|
||||
self._jar = new CookieJar(store, {looseMode: true})
|
||||
}
|
||||
RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) {
|
||||
var self = this
|
||||
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
|
||||
}
|
||||
RequestJar.prototype.getCookieString = function (uri) {
|
||||
var self = this
|
||||
return self._jar.getCookieStringSync(uri)
|
||||
}
|
||||
RequestJar.prototype.getCookies = function (uri) {
|
||||
var self = this
|
||||
return self._jar.getCookiesSync(uri)
|
||||
}
|
||||
|
||||
exports.jar = function (store) {
|
||||
return new RequestJar(store)
|
||||
}
|
79
CyLukTs/lukan/node_modules/@cypress/request/lib/getProxyFromURI.js
generated
vendored
Normal file
79
CyLukTs/lukan/node_modules/@cypress/request/lib/getProxyFromURI.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
'use strict'
|
||||
|
||||
function formatHostname (hostname) {
|
||||
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
|
||||
return hostname.replace(/^\.*/, '.').toLowerCase()
|
||||
}
|
||||
|
||||
function parseNoProxyZone (zone) {
|
||||
zone = zone.trim().toLowerCase()
|
||||
|
||||
var zoneParts = zone.split(':', 2)
|
||||
var zoneHost = formatHostname(zoneParts[0])
|
||||
var zonePort = zoneParts[1]
|
||||
var hasPort = zone.indexOf(':') > -1
|
||||
|
||||
return {hostname: zoneHost, port: zonePort, hasPort: hasPort}
|
||||
}
|
||||
|
||||
function uriInNoProxy (uri, noProxy) {
|
||||
var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')
|
||||
var hostname = formatHostname(uri.hostname)
|
||||
var noProxyList = noProxy.split(',')
|
||||
|
||||
// iterate through the noProxyList until it finds a match.
|
||||
return noProxyList.map(parseNoProxyZone).some(function (noProxyZone) {
|
||||
var isMatchedAt = hostname.indexOf(noProxyZone.hostname)
|
||||
var hostnameMatched = (
|
||||
isMatchedAt > -1 &&
|
||||
(isMatchedAt === hostname.length - noProxyZone.hostname.length)
|
||||
)
|
||||
|
||||
if (noProxyZone.hasPort) {
|
||||
return (port === noProxyZone.port) && hostnameMatched
|
||||
}
|
||||
|
||||
return hostnameMatched
|
||||
})
|
||||
}
|
||||
|
||||
function getProxyFromURI (uri) {
|
||||
// Decide the proper request proxy to use based on the request URI object and the
|
||||
// environmental variables (NO_PROXY, HTTP_PROXY, etc.)
|
||||
// respect NO_PROXY environment variables (see: https://lynx.invisible-island.net/lynx2.8.7/breakout/lynx_help/keystrokes/environments.html)
|
||||
|
||||
var noProxy = process.env.NO_PROXY || process.env.no_proxy || ''
|
||||
|
||||
// if the noProxy is a wildcard then return null
|
||||
|
||||
if (noProxy === '*') {
|
||||
return null
|
||||
}
|
||||
|
||||
// if the noProxy is not empty and the uri is found return null
|
||||
|
||||
if (noProxy !== '' && uriInNoProxy(uri, noProxy)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Check for HTTP or HTTPS Proxy in environment Else default to null
|
||||
|
||||
if (uri.protocol === 'http:') {
|
||||
return process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
if (uri.protocol === 'https:') {
|
||||
return process.env.HTTPS_PROXY ||
|
||||
process.env.https_proxy ||
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
// if none of that works, return null
|
||||
// (What uri protocol are you using then?)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = getProxyFromURI
|
200
CyLukTs/lukan/node_modules/@cypress/request/lib/har.js
generated
vendored
Normal file
200
CyLukTs/lukan/node_modules/@cypress/request/lib/har.js
generated
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var qs = require('querystring')
|
||||
var extend = require('extend')
|
||||
|
||||
function Har (request) {
|
||||
this.request = request
|
||||
}
|
||||
|
||||
Har.prototype.reducer = function (obj, pair) {
|
||||
// new property ?
|
||||
if (obj[pair.name] === undefined) {
|
||||
obj[pair.name] = pair.value
|
||||
return obj
|
||||
}
|
||||
|
||||
// existing? convert to array
|
||||
var arr = [
|
||||
obj[pair.name],
|
||||
pair.value
|
||||
]
|
||||
|
||||
obj[pair.name] = arr
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
Har.prototype.prep = function (data) {
|
||||
// construct utility properties
|
||||
data.queryObj = {}
|
||||
data.headersObj = {}
|
||||
data.postData.jsonObj = false
|
||||
data.postData.paramsObj = false
|
||||
|
||||
// construct query objects
|
||||
if (data.queryString && data.queryString.length) {
|
||||
data.queryObj = data.queryString.reduce(this.reducer, {})
|
||||
}
|
||||
|
||||
// construct headers objects
|
||||
if (data.headers && data.headers.length) {
|
||||
// loweCase header keys
|
||||
data.headersObj = data.headers.reduceRight(function (headers, header) {
|
||||
headers[header.name] = header.value
|
||||
return headers
|
||||
}, {})
|
||||
}
|
||||
|
||||
// construct Cookie header
|
||||
if (data.cookies && data.cookies.length) {
|
||||
var cookies = data.cookies.map(function (cookie) {
|
||||
return cookie.name + '=' + cookie.value
|
||||
})
|
||||
|
||||
if (cookies.length) {
|
||||
data.headersObj.cookie = cookies.join('; ')
|
||||
}
|
||||
}
|
||||
|
||||
// prep body
|
||||
function some (arr) {
|
||||
return arr.some(function (type) {
|
||||
return data.postData.mimeType.indexOf(type) === 0
|
||||
})
|
||||
}
|
||||
|
||||
if (some([
|
||||
'multipart/mixed',
|
||||
'multipart/related',
|
||||
'multipart/form-data',
|
||||
'multipart/alternative'])) {
|
||||
// reset values
|
||||
data.postData.mimeType = 'multipart/form-data'
|
||||
} else if (some([
|
||||
'application/x-www-form-urlencoded'])) {
|
||||
if (!data.postData.params) {
|
||||
data.postData.text = ''
|
||||
} else {
|
||||
data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
|
||||
|
||||
// always overwrite
|
||||
data.postData.text = qs.stringify(data.postData.paramsObj)
|
||||
}
|
||||
} else if (some([
|
||||
'text/json',
|
||||
'text/x-json',
|
||||
'application/json',
|
||||
'application/x-json'])) {
|
||||
data.postData.mimeType = 'application/json'
|
||||
|
||||
if (data.postData.text) {
|
||||
try {
|
||||
data.postData.jsonObj = JSON.parse(data.postData.text)
|
||||
} catch (e) {
|
||||
this.request.debug(e)
|
||||
|
||||
// force back to text/plain
|
||||
data.postData.mimeType = 'text/plain'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
Har.prototype.options = function (options) {
|
||||
// skip if no har property defined
|
||||
if (!options.har) {
|
||||
return options
|
||||
}
|
||||
|
||||
var har = {}
|
||||
extend(har, options.har)
|
||||
|
||||
// only process the first entry
|
||||
if (har.log && har.log.entries) {
|
||||
har = har.log.entries[0]
|
||||
}
|
||||
|
||||
// add optional properties to make validation successful
|
||||
har.url = har.url || options.url || options.uri || options.baseUrl || '/'
|
||||
har.httpVersion = har.httpVersion || 'HTTP/1.1'
|
||||
har.queryString = har.queryString || []
|
||||
har.headers = har.headers || []
|
||||
har.cookies = har.cookies || []
|
||||
har.postData = har.postData || {}
|
||||
har.postData.mimeType = har.postData.mimeType || 'application/octet-stream'
|
||||
|
||||
har.bodySize = 0
|
||||
har.headersSize = 0
|
||||
har.postData.size = 0
|
||||
|
||||
// clean up and get some utility properties
|
||||
var req = this.prep(har)
|
||||
|
||||
// construct new options
|
||||
if (req.url) {
|
||||
options.url = req.url
|
||||
}
|
||||
|
||||
if (req.method) {
|
||||
options.method = req.method
|
||||
}
|
||||
|
||||
if (Object.keys(req.queryObj).length) {
|
||||
options.qs = req.queryObj
|
||||
}
|
||||
|
||||
if (Object.keys(req.headersObj).length) {
|
||||
options.headers = req.headersObj
|
||||
}
|
||||
|
||||
function test (type) {
|
||||
return req.postData.mimeType.indexOf(type) === 0
|
||||
}
|
||||
if (test('application/x-www-form-urlencoded')) {
|
||||
options.form = req.postData.paramsObj
|
||||
} else if (test('application/json')) {
|
||||
if (req.postData.jsonObj) {
|
||||
options.body = req.postData.jsonObj
|
||||
options.json = true
|
||||
}
|
||||
} else if (test('multipart/form-data')) {
|
||||
options.formData = {}
|
||||
|
||||
req.postData.params.forEach(function (param) {
|
||||
var attachment = {}
|
||||
|
||||
if (!param.fileName && !param.contentType) {
|
||||
options.formData[param.name] = param.value
|
||||
return
|
||||
}
|
||||
|
||||
// attempt to read from disk!
|
||||
if (param.fileName && !param.value) {
|
||||
attachment.value = fs.createReadStream(param.fileName)
|
||||
} else if (param.value) {
|
||||
attachment.value = param.value
|
||||
}
|
||||
|
||||
if (param.fileName) {
|
||||
attachment.options = {
|
||||
filename: param.fileName,
|
||||
contentType: param.contentType ? param.contentType : null
|
||||
}
|
||||
}
|
||||
|
||||
options.formData[param.name] = attachment
|
||||
})
|
||||
} else {
|
||||
if (req.postData.text) {
|
||||
options.body = req.postData.text
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
exports.Har = Har
|
89
CyLukTs/lukan/node_modules/@cypress/request/lib/hawk.js
generated
vendored
Normal file
89
CyLukTs/lukan/node_modules/@cypress/request/lib/hawk.js
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
'use strict'
|
||||
|
||||
var crypto = require('crypto')
|
||||
|
||||
function randomString (size) {
|
||||
var bits = (size + 1) * 6
|
||||
var buffer = crypto.randomBytes(Math.ceil(bits / 8))
|
||||
var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
|
||||
return string.slice(0, size)
|
||||
}
|
||||
|
||||
function calculatePayloadHash (payload, algorithm, contentType) {
|
||||
var hash = crypto.createHash(algorithm)
|
||||
hash.update('hawk.1.payload\n')
|
||||
hash.update((contentType ? contentType.split(';')[0].trim().toLowerCase() : '') + '\n')
|
||||
hash.update(payload || '')
|
||||
hash.update('\n')
|
||||
return hash.digest('base64')
|
||||
}
|
||||
|
||||
exports.calculateMac = function (credentials, opts) {
|
||||
var normalized = 'hawk.1.header\n' +
|
||||
opts.ts + '\n' +
|
||||
opts.nonce + '\n' +
|
||||
(opts.method || '').toUpperCase() + '\n' +
|
||||
opts.resource + '\n' +
|
||||
opts.host.toLowerCase() + '\n' +
|
||||
opts.port + '\n' +
|
||||
(opts.hash || '') + '\n'
|
||||
|
||||
if (opts.ext) {
|
||||
normalized = normalized + opts.ext.replace('\\', '\\\\').replace('\n', '\\n')
|
||||
}
|
||||
|
||||
normalized = normalized + '\n'
|
||||
|
||||
if (opts.app) {
|
||||
normalized = normalized + opts.app + '\n' + (opts.dlg || '') + '\n'
|
||||
}
|
||||
|
||||
var hmac = crypto.createHmac(credentials.algorithm, credentials.key).update(normalized)
|
||||
var digest = hmac.digest('base64')
|
||||
return digest
|
||||
}
|
||||
|
||||
exports.header = function (uri, method, opts) {
|
||||
var timestamp = opts.timestamp || Math.floor((Date.now() + (opts.localtimeOffsetMsec || 0)) / 1000)
|
||||
var credentials = opts.credentials
|
||||
if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (['sha1', 'sha256'].indexOf(credentials.algorithm) === -1) {
|
||||
return ''
|
||||
}
|
||||
|
||||
var artifacts = {
|
||||
ts: timestamp,
|
||||
nonce: opts.nonce || randomString(6),
|
||||
method: method,
|
||||
resource: uri.pathname + (uri.search || ''),
|
||||
host: uri.hostname,
|
||||
port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
|
||||
hash: opts.hash,
|
||||
ext: opts.ext,
|
||||
app: opts.app,
|
||||
dlg: opts.dlg
|
||||
}
|
||||
|
||||
if (!artifacts.hash && (opts.payload || opts.payload === '')) {
|
||||
artifacts.hash = calculatePayloadHash(opts.payload, credentials.algorithm, opts.contentType)
|
||||
}
|
||||
|
||||
var mac = exports.calculateMac(credentials, artifacts)
|
||||
|
||||
var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''
|
||||
var header = 'Hawk id="' + credentials.id +
|
||||
'", ts="' + artifacts.ts +
|
||||
'", nonce="' + artifacts.nonce +
|
||||
(artifacts.hash ? '", hash="' + artifacts.hash : '') +
|
||||
(hasExt ? '", ext="' + artifacts.ext.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : '') +
|
||||
'", mac="' + mac + '"'
|
||||
|
||||
if (artifacts.app) {
|
||||
header = header + ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'
|
||||
}
|
||||
|
||||
return header
|
||||
}
|
66
CyLukTs/lukan/node_modules/@cypress/request/lib/helpers.js
generated
vendored
Normal file
66
CyLukTs/lukan/node_modules/@cypress/request/lib/helpers.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
'use strict'
|
||||
|
||||
var jsonSafeStringify = require('json-stringify-safe')
|
||||
var crypto = require('crypto')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
var defer = typeof setImmediate === 'undefined'
|
||||
? process.nextTick
|
||||
: setImmediate
|
||||
|
||||
function paramsHaveRequestBody (params) {
|
||||
return (
|
||||
params.body ||
|
||||
params.requestBodyStream ||
|
||||
(params.json && typeof params.json !== 'boolean') ||
|
||||
params.multipart
|
||||
)
|
||||
}
|
||||
|
||||
function safeStringify (obj, replacer) {
|
||||
var ret
|
||||
try {
|
||||
ret = JSON.stringify(obj, replacer)
|
||||
} catch (e) {
|
||||
ret = jsonSafeStringify(obj, replacer)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
function md5 (str) {
|
||||
return crypto.createHash('md5').update(str).digest('hex')
|
||||
}
|
||||
|
||||
function isReadStream (rs) {
|
||||
return rs.readable && rs.path && rs.mode
|
||||
}
|
||||
|
||||
function toBase64 (str) {
|
||||
return Buffer.from(str || '', 'utf8').toString('base64')
|
||||
}
|
||||
|
||||
function copy (obj) {
|
||||
var o = {}
|
||||
Object.keys(obj).forEach(function (i) {
|
||||
o[i] = obj[i]
|
||||
})
|
||||
return o
|
||||
}
|
||||
|
||||
function version () {
|
||||
var numbers = process.version.replace('v', '').split('.')
|
||||
return {
|
||||
major: parseInt(numbers[0], 10),
|
||||
minor: parseInt(numbers[1], 10),
|
||||
patch: parseInt(numbers[2], 10)
|
||||
}
|
||||
}
|
||||
|
||||
exports.paramsHaveRequestBody = paramsHaveRequestBody
|
||||
exports.safeStringify = safeStringify
|
||||
exports.md5 = md5
|
||||
exports.isReadStream = isReadStream
|
||||
exports.toBase64 = toBase64
|
||||
exports.copy = copy
|
||||
exports.version = version
|
||||
exports.defer = defer
|
112
CyLukTs/lukan/node_modules/@cypress/request/lib/multipart.js
generated
vendored
Normal file
112
CyLukTs/lukan/node_modules/@cypress/request/lib/multipart.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
'use strict'
|
||||
|
||||
var { v4: uuid } = require('uuid')
|
||||
var CombinedStream = require('combined-stream')
|
||||
var isstream = require('isstream')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
function Multipart (request) {
|
||||
this.request = request
|
||||
this.boundary = uuid()
|
||||
this.chunked = false
|
||||
this.body = null
|
||||
}
|
||||
|
||||
Multipart.prototype.isChunked = function (options) {
|
||||
var self = this
|
||||
var chunked = false
|
||||
var parts = options.data || options
|
||||
|
||||
if (!parts.forEach) {
|
||||
self.request.emit('error', new Error('Argument error, options.multipart.'))
|
||||
}
|
||||
|
||||
if (options.chunked !== undefined) {
|
||||
chunked = options.chunked
|
||||
}
|
||||
|
||||
if (self.request.getHeader('transfer-encoding') === 'chunked') {
|
||||
chunked = true
|
||||
}
|
||||
|
||||
if (!chunked) {
|
||||
parts.forEach(function (part) {
|
||||
if (typeof part.body === 'undefined') {
|
||||
self.request.emit('error', new Error('Body attribute missing in multipart.'))
|
||||
}
|
||||
if (isstream(part.body)) {
|
||||
chunked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return chunked
|
||||
}
|
||||
|
||||
Multipart.prototype.setHeaders = function (chunked) {
|
||||
var self = this
|
||||
|
||||
if (chunked && !self.request.hasHeader('transfer-encoding')) {
|
||||
self.request.setHeader('transfer-encoding', 'chunked')
|
||||
}
|
||||
|
||||
var header = self.request.getHeader('content-type')
|
||||
|
||||
if (!header || header.indexOf('multipart') === -1) {
|
||||
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
|
||||
} else {
|
||||
if (header.indexOf('boundary') !== -1) {
|
||||
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
|
||||
} else {
|
||||
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Multipart.prototype.build = function (parts, chunked) {
|
||||
var self = this
|
||||
var body = chunked ? new CombinedStream() : []
|
||||
|
||||
function add (part) {
|
||||
if (typeof part === 'number') {
|
||||
part = part.toString()
|
||||
}
|
||||
return chunked ? body.append(part) : body.push(Buffer.from(part))
|
||||
}
|
||||
|
||||
if (self.request.preambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
parts.forEach(function (part) {
|
||||
var preamble = '--' + self.boundary + '\r\n'
|
||||
Object.keys(part).forEach(function (key) {
|
||||
if (key === 'body') { return }
|
||||
preamble += key + ': ' + part[key] + '\r\n'
|
||||
})
|
||||
preamble += '\r\n'
|
||||
add(preamble)
|
||||
add(part.body)
|
||||
add('\r\n')
|
||||
})
|
||||
add('--' + self.boundary + '--')
|
||||
|
||||
if (self.request.postambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
Multipart.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
var chunked = self.isChunked(options)
|
||||
var parts = options.data || options
|
||||
|
||||
self.setHeaders(chunked)
|
||||
self.chunked = chunked
|
||||
self.body = self.build(parts, chunked)
|
||||
}
|
||||
|
||||
exports.Multipart = Multipart
|
50
CyLukTs/lukan/node_modules/@cypress/request/lib/querystring.js
generated
vendored
Normal file
50
CyLukTs/lukan/node_modules/@cypress/request/lib/querystring.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
'use strict'
|
||||
|
||||
var qs = require('qs')
|
||||
var querystring = require('querystring')
|
||||
|
||||
function Querystring (request) {
|
||||
this.request = request
|
||||
this.lib = null
|
||||
this.useQuerystring = null
|
||||
this.parseOptions = null
|
||||
this.stringifyOptions = null
|
||||
}
|
||||
|
||||
Querystring.prototype.init = function (options) {
|
||||
if (this.lib) { return }
|
||||
|
||||
this.useQuerystring = options.useQuerystring
|
||||
this.lib = (this.useQuerystring ? querystring : qs)
|
||||
|
||||
this.parseOptions = options.qsParseOptions || {}
|
||||
this.stringifyOptions = options.qsStringifyOptions || {}
|
||||
}
|
||||
|
||||
Querystring.prototype.stringify = function (obj) {
|
||||
return (this.useQuerystring)
|
||||
? this.rfc3986(this.lib.stringify(obj,
|
||||
this.stringifyOptions.sep || null,
|
||||
this.stringifyOptions.eq || null,
|
||||
this.stringifyOptions))
|
||||
: this.lib.stringify(obj, this.stringifyOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.parse = function (str) {
|
||||
return (this.useQuerystring)
|
||||
? this.lib.parse(str,
|
||||
this.parseOptions.sep || null,
|
||||
this.parseOptions.eq || null,
|
||||
this.parseOptions)
|
||||
: this.lib.parse(str, this.parseOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.rfc3986 = function (str) {
|
||||
return str.replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
||||
})
|
||||
}
|
||||
|
||||
Querystring.prototype.unescape = querystring.unescape
|
||||
|
||||
exports.Querystring = Querystring
|
175
CyLukTs/lukan/node_modules/@cypress/request/lib/redirect.js
generated
vendored
Normal file
175
CyLukTs/lukan/node_modules/@cypress/request/lib/redirect.js
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var isUrl = /^https?:/
|
||||
|
||||
function Redirect (request) {
|
||||
this.request = request
|
||||
this.followRedirect = true
|
||||
this.followRedirects = true
|
||||
this.followAllRedirects = false
|
||||
this.followOriginalHttpMethod = false
|
||||
this.allowRedirect = function () { return true }
|
||||
this.maxRedirects = 10
|
||||
this.redirects = []
|
||||
this.redirectsFollowed = 0
|
||||
this.removeRefererHeader = false
|
||||
}
|
||||
|
||||
Redirect.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
if (options.maxRedirects !== undefined) {
|
||||
self.maxRedirects = options.maxRedirects
|
||||
}
|
||||
if (typeof options.followRedirect === 'function') {
|
||||
self.allowRedirect = options.followRedirect
|
||||
}
|
||||
if (options.followRedirect !== undefined) {
|
||||
self.followRedirects = !!options.followRedirect
|
||||
}
|
||||
if (options.followAllRedirects !== undefined) {
|
||||
self.followAllRedirects = options.followAllRedirects
|
||||
}
|
||||
if (self.followRedirects || self.followAllRedirects) {
|
||||
self.redirects = self.redirects || []
|
||||
}
|
||||
if (options.removeRefererHeader !== undefined) {
|
||||
self.removeRefererHeader = options.removeRefererHeader
|
||||
}
|
||||
if (options.followOriginalHttpMethod !== undefined) {
|
||||
self.followOriginalHttpMethod = options.followOriginalHttpMethod
|
||||
}
|
||||
}
|
||||
|
||||
Redirect.prototype.redirectTo = function (response) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var redirectTo = null
|
||||
if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
|
||||
var location = response.caseless.get('location')
|
||||
request.debug('redirect', location)
|
||||
|
||||
if (self.followAllRedirects) {
|
||||
redirectTo = location
|
||||
} else if (self.followRedirects) {
|
||||
switch (request.method) {
|
||||
case 'PATCH':
|
||||
case 'PUT':
|
||||
case 'POST':
|
||||
case 'DELETE':
|
||||
// Do not follow redirects
|
||||
break
|
||||
default:
|
||||
redirectTo = location
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if (response.statusCode === 401) {
|
||||
var authHeader = request._auth.onResponse(response)
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
redirectTo = request.uri
|
||||
}
|
||||
}
|
||||
return redirectTo
|
||||
}
|
||||
|
||||
Redirect.prototype.onResponse = function (response, callback) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var redirectTo = self.redirectTo(response)
|
||||
if (!redirectTo) return callback(null, false)
|
||||
|
||||
function processRedirect (shouldRedirect) {
|
||||
if (!shouldRedirect) return callback(null, false)
|
||||
if (typeof shouldRedirect === 'string') {
|
||||
// overridden redirect url
|
||||
request.debug('redirect overridden', redirectTo)
|
||||
redirectTo = shouldRedirect
|
||||
}
|
||||
|
||||
request.debug('redirect to', redirectTo)
|
||||
|
||||
// ignore any potential response body. it cannot possibly be useful
|
||||
// to us at this point.
|
||||
// response.resume should be defined, but check anyway before calling. Workaround for browserify.
|
||||
if (response.resume) {
|
||||
response.resume()
|
||||
}
|
||||
|
||||
if (self.redirectsFollowed >= self.maxRedirects) {
|
||||
return callback(new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href))
|
||||
}
|
||||
self.redirectsFollowed += 1
|
||||
|
||||
if (!isUrl.test(redirectTo)) {
|
||||
redirectTo = url.resolve(request.uri.href, redirectTo)
|
||||
}
|
||||
|
||||
var uriPrev = request.uri
|
||||
request.uri = url.parse(redirectTo)
|
||||
|
||||
// handle the case where we change protocol from https to http or vice versa
|
||||
if (request.uri.protocol !== uriPrev.protocol) {
|
||||
delete request.agent
|
||||
}
|
||||
|
||||
self.redirects.push({ statusCode: response.statusCode, redirectUri: redirectTo })
|
||||
|
||||
if (self.followAllRedirects && request.method !== 'HEAD' &&
|
||||
response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
request.method = self.followOriginalHttpMethod ? request.method : 'GET'
|
||||
}
|
||||
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
|
||||
delete request.src
|
||||
delete request.req
|
||||
delete request._started
|
||||
if (response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
// Remove parameters from the previous response, unless this is the second request
|
||||
// for a server that requires digest authentication.
|
||||
delete request.body
|
||||
delete request._form
|
||||
if (request.headers) {
|
||||
request.removeHeader('host')
|
||||
request.removeHeader('content-type')
|
||||
request.removeHeader('content-length')
|
||||
if (request.uri.hostname !== request.originalHost.split(':')[0]) {
|
||||
// Remove authorization if changing hostnames (but not if just
|
||||
// changing ports or protocols). This matches the behavior of curl:
|
||||
// https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710
|
||||
request.removeHeader('authorization')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.removeRefererHeader) {
|
||||
request.setHeader('referer', uriPrev.href)
|
||||
}
|
||||
|
||||
request.emit('redirect')
|
||||
request.init()
|
||||
callback(null, true)
|
||||
}
|
||||
|
||||
// test allowRedirect arity; if has more than one argument,
|
||||
// assume it's asynchronous via a callback
|
||||
if (self.allowRedirect.length > 1) {
|
||||
return self.allowRedirect.call(request, response, function (err, result) {
|
||||
if (err) return callback(err)
|
||||
processRedirect(result)
|
||||
})
|
||||
}
|
||||
|
||||
var allowsRedirect = self.allowRedirect.call(request, response)
|
||||
if (allowsRedirect && allowsRedirect.then) {
|
||||
return allowsRedirect.then(processRedirect, callback)
|
||||
}
|
||||
|
||||
// treat as a regular boolean
|
||||
processRedirect(allowsRedirect)
|
||||
}
|
||||
|
||||
exports.Redirect = Redirect
|
175
CyLukTs/lukan/node_modules/@cypress/request/lib/tunnel.js
generated
vendored
Normal file
175
CyLukTs/lukan/node_modules/@cypress/request/lib/tunnel.js
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var tunnel = require('tunnel-agent')
|
||||
|
||||
var defaultProxyHeaderWhiteList = [
|
||||
'accept',
|
||||
'accept-charset',
|
||||
'accept-encoding',
|
||||
'accept-language',
|
||||
'accept-ranges',
|
||||
'cache-control',
|
||||
'content-encoding',
|
||||
'content-language',
|
||||
'content-location',
|
||||
'content-md5',
|
||||
'content-range',
|
||||
'content-type',
|
||||
'connection',
|
||||
'date',
|
||||
'expect',
|
||||
'max-forwards',
|
||||
'pragma',
|
||||
'referer',
|
||||
'te',
|
||||
'user-agent',
|
||||
'via'
|
||||
]
|
||||
|
||||
var defaultProxyHeaderExclusiveList = [
|
||||
'proxy-authorization'
|
||||
]
|
||||
|
||||
function constructProxyHost (uriObject) {
|
||||
var port = uriObject.port
|
||||
var protocol = uriObject.protocol
|
||||
var proxyHost = uriObject.hostname + ':'
|
||||
|
||||
if (port) {
|
||||
proxyHost += port
|
||||
} else if (protocol === 'https:') {
|
||||
proxyHost += '443'
|
||||
} else {
|
||||
proxyHost += '80'
|
||||
}
|
||||
|
||||
return proxyHost
|
||||
}
|
||||
|
||||
function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) {
|
||||
var whiteList = proxyHeaderWhiteList
|
||||
.reduce(function (set, header) {
|
||||
set[header.toLowerCase()] = true
|
||||
return set
|
||||
}, {})
|
||||
|
||||
return Object.keys(headers)
|
||||
.filter(function (header) {
|
||||
return whiteList[header.toLowerCase()]
|
||||
})
|
||||
.reduce(function (set, header) {
|
||||
set[header] = headers[header]
|
||||
return set
|
||||
}, {})
|
||||
}
|
||||
|
||||
function constructTunnelOptions (request, proxyHeaders) {
|
||||
var proxy = request.proxy
|
||||
|
||||
var tunnelOptions = {
|
||||
proxy: {
|
||||
host: proxy.hostname,
|
||||
port: +proxy.port,
|
||||
proxyAuth: proxy.auth,
|
||||
headers: proxyHeaders
|
||||
},
|
||||
headers: request.headers,
|
||||
ca: request.ca,
|
||||
cert: request.cert,
|
||||
key: request.key,
|
||||
passphrase: request.passphrase,
|
||||
pfx: request.pfx,
|
||||
ciphers: request.ciphers,
|
||||
rejectUnauthorized: request.rejectUnauthorized,
|
||||
secureOptions: request.secureOptions,
|
||||
secureProtocol: request.secureProtocol
|
||||
}
|
||||
|
||||
return tunnelOptions
|
||||
}
|
||||
|
||||
function constructTunnelFnName (uri, proxy) {
|
||||
var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http')
|
||||
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
|
||||
return [uriProtocol, proxyProtocol].join('Over')
|
||||
}
|
||||
|
||||
function getTunnelFn (request) {
|
||||
var uri = request.uri
|
||||
var proxy = request.proxy
|
||||
var tunnelFnName = constructTunnelFnName(uri, proxy)
|
||||
return tunnel[tunnelFnName]
|
||||
}
|
||||
|
||||
function Tunnel (request) {
|
||||
this.request = request
|
||||
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
this.proxyHeaderExclusiveList = []
|
||||
if (typeof request.tunnel !== 'undefined') {
|
||||
this.tunnelOverride = request.tunnel
|
||||
}
|
||||
}
|
||||
|
||||
Tunnel.prototype.isEnabled = function () {
|
||||
var self = this
|
||||
var request = self.request
|
||||
// Tunnel HTTPS by default. Allow the user to override this setting.
|
||||
|
||||
// If self.tunnelOverride is set (the user specified a value), use it.
|
||||
if (typeof self.tunnelOverride !== 'undefined') {
|
||||
return self.tunnelOverride
|
||||
}
|
||||
|
||||
// If the destination is HTTPS, tunnel.
|
||||
if (request.uri.protocol === 'https:') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Otherwise, do not use tunnel.
|
||||
return false
|
||||
}
|
||||
|
||||
Tunnel.prototype.setup = function (options) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
options = options || {}
|
||||
|
||||
if (typeof request.proxy === 'string') {
|
||||
request.proxy = url.parse(request.proxy)
|
||||
}
|
||||
|
||||
if (!request.proxy || !request.tunnel) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Setup Proxy Header Exclusive List and White List
|
||||
if (options.proxyHeaderWhiteList) {
|
||||
self.proxyHeaderWhiteList = options.proxyHeaderWhiteList
|
||||
}
|
||||
if (options.proxyHeaderExclusiveList) {
|
||||
self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList
|
||||
}
|
||||
|
||||
var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList)
|
||||
var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList)
|
||||
|
||||
// Setup Proxy Headers and Proxy Headers Host
|
||||
// Only send the Proxy White Listed Header names
|
||||
var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList)
|
||||
proxyHeaders.host = constructProxyHost(request.uri)
|
||||
|
||||
proxyHeaderExclusiveList.forEach(request.removeHeader, request)
|
||||
|
||||
// Set Agent from Tunnel Data
|
||||
var tunnelFn = getTunnelFn(request)
|
||||
var tunnelOptions = constructTunnelOptions(request, proxyHeaders)
|
||||
request.agent = tunnelFn(tunnelOptions)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList
|
||||
exports.Tunnel = Tunnel
|
84
CyLukTs/lukan/node_modules/@cypress/request/package.json
generated
vendored
Normal file
84
CyLukTs/lukan/node_modules/@cypress/request/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "@cypress/request",
|
||||
"description": "Cypress's fork of a simplified HTTP request client.",
|
||||
"keywords": [
|
||||
"http",
|
||||
"simple",
|
||||
"util",
|
||||
"utility"
|
||||
],
|
||||
"version": "2.88.11",
|
||||
"author": "Mikeal Rogers <mikeal.rogers@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/request.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/cypress-io/request/issues"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.js",
|
||||
"request.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"http-signature": "~1.3.6",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.19",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.10.3",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.5.0",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run test-ci && npm run test-browser",
|
||||
"test-ci": "tap --no-check-coverage tests/test-*.js",
|
||||
"test-cov": "nyc --reporter=lcov tape tests/test-*.js",
|
||||
"test-browser": "echo 'Skipping browser tests.' || node tests/browser/start.js",
|
||||
"lint": "standard"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bluebird": "^3.2.1",
|
||||
"browserify": "^13.0.1",
|
||||
"browserify-istanbul": "^2.0.0",
|
||||
"buffer-equal": "^1.0.0",
|
||||
"codecov": "^3.0.4",
|
||||
"coveralls": "^3.0.2",
|
||||
"function-bind": "^1.0.2",
|
||||
"karma": "^3.0.0",
|
||||
"karma-browserify": "^5.0.1",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-coverage": "^2.0.3",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"karma-tap": "^4.2.0",
|
||||
"nyc": "^15.1.0",
|
||||
"phantomjs-prebuilt": "^2.1.3",
|
||||
"rimraf": "^2.2.8",
|
||||
"server-destroy": "^1.0.1",
|
||||
"standard": "^9.0.0",
|
||||
"tap": "^15.1.5",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"greenkeeper": {
|
||||
"ignore": [
|
||||
"hawk",
|
||||
"har-validator"
|
||||
]
|
||||
}
|
||||
}
|
1548
CyLukTs/lukan/node_modules/@cypress/request/request.js
generated
vendored
Normal file
1548
CyLukTs/lukan/node_modules/@cypress/request/request.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user