mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-08-11 02:46:21 -06:00
node_modules: update (#146)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
+34
@@ -15,6 +15,28 @@ function calculateRetryAfterHeader (retryAfter) {
|
||||
return new Date(retryAfter).getTime() - current
|
||||
}
|
||||
|
||||
function validatePartialResponseContentLength (headers, range, statusCode, retryCount) {
|
||||
const contentLength = headers['content-length']
|
||||
if (contentLength == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
|
||||
return null
|
||||
}
|
||||
|
||||
const length = Number(contentLength)
|
||||
const expectedLength = range.end - range.start + 1
|
||||
if (!Number.isFinite(length) || length !== expectedLength) {
|
||||
return new RequestRetryError('Content-Length mismatch', statusCode, {
|
||||
headers,
|
||||
data: { count: retryCount }
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
class RetryHandler {
|
||||
constructor (opts, handlers) {
|
||||
const { retryOptions, ...dispatchOpts } = opts
|
||||
@@ -229,6 +251,12 @@ class RetryHandler {
|
||||
return false
|
||||
}
|
||||
|
||||
const contentLengthError = validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount)
|
||||
if (contentLengthError != null) {
|
||||
this.abort(contentLengthError)
|
||||
return false
|
||||
}
|
||||
|
||||
const { start, size, end = size - 1 } = contentRange
|
||||
|
||||
assert(this.start === start, 'content-range mismatch')
|
||||
@@ -252,6 +280,12 @@ class RetryHandler {
|
||||
)
|
||||
}
|
||||
|
||||
const contentLengthError = validatePartialResponseContentLength(headers, range, statusCode, this.retryCount)
|
||||
if (contentLengthError != null) {
|
||||
this.abort(contentLengthError)
|
||||
return false
|
||||
}
|
||||
|
||||
const { start, size, end = size - 1 } = range
|
||||
assert(
|
||||
start != null && Number.isFinite(start),
|
||||
|
||||
Reference in New Issue
Block a user