mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-04 12:40:05 +02:00
update packages to latest version
This commit is contained in:
44
node_modules/clean-css/lib/reader/load-remote-resource.js
generated
vendored
44
node_modules/clean-css/lib/reader/load-remote-resource.js
generated
vendored
@@ -25,11 +25,11 @@ function loadRemoteResource(uri, inlineRequest, inlineTimeout, callback) {
|
||||
requestOptions.path = requestOptions.href;
|
||||
}
|
||||
|
||||
fetch = (proxyProtocol && !isHttpsResource(proxyProtocol)) || isHttpResource(uri) ?
|
||||
http.get :
|
||||
https.get;
|
||||
fetch = (proxyProtocol && !isHttpsResource(proxyProtocol)) || isHttpResource(uri)
|
||||
? http.get
|
||||
: https.get;
|
||||
|
||||
fetch(requestOptions, function (res) {
|
||||
fetch(requestOptions, function(res) {
|
||||
var chunks = [];
|
||||
var movedUri;
|
||||
|
||||
@@ -39,36 +39,36 @@ function loadRemoteResource(uri, inlineRequest, inlineTimeout, callback) {
|
||||
|
||||
if (res.statusCode < 200 || res.statusCode > 399) {
|
||||
return callback(res.statusCode, null);
|
||||
} else if (res.statusCode > 299) {
|
||||
} if (res.statusCode > 299) {
|
||||
movedUri = url.resolve(uri, res.headers.location);
|
||||
return loadRemoteResource(movedUri, inlineRequest, inlineTimeout, callback);
|
||||
}
|
||||
|
||||
res.on('data', function (chunk) {
|
||||
res.on('data', function(chunk) {
|
||||
chunks.push(chunk.toString());
|
||||
});
|
||||
res.on('end', function () {
|
||||
res.on('end', function() {
|
||||
var body = chunks.join('');
|
||||
callback(null, body);
|
||||
});
|
||||
})
|
||||
.on('error', function (res) {
|
||||
if (errorHandled) {
|
||||
return;
|
||||
}
|
||||
.on('error', function(res) {
|
||||
if (errorHandled) {
|
||||
return;
|
||||
}
|
||||
|
||||
errorHandled = true;
|
||||
callback(res.message, null);
|
||||
})
|
||||
.on('timeout', function () {
|
||||
if (errorHandled) {
|
||||
return;
|
||||
}
|
||||
errorHandled = true;
|
||||
callback(res.message, null);
|
||||
})
|
||||
.on('timeout', function() {
|
||||
if (errorHandled) {
|
||||
return;
|
||||
}
|
||||
|
||||
errorHandled = true;
|
||||
callback('timeout', null);
|
||||
})
|
||||
.setTimeout(inlineTimeout);
|
||||
errorHandled = true;
|
||||
callback('timeout', null);
|
||||
})
|
||||
.setTimeout(inlineTimeout);
|
||||
}
|
||||
|
||||
module.exports = loadRemoteResource;
|
||||
|
Reference in New Issue
Block a user