diff --git a/bin/blc b/bin/blc old mode 100644 new mode 100755 diff --git a/lib/cli.js b/lib/cli.js index 70a0ad51..17294cad 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -32,6 +32,14 @@ function cli() name: "blc", options: { + "response-timeout": + { + rename: "responseTimeout", + info: "Set the request's response timeout (in milliseconds).", + type: Number, + default: defaultOptions.responseTimeout + + }, "exclude": { rename: "excludedKeywords", @@ -169,7 +177,8 @@ cli.prototype.input = function(args, showArgs) maxSockets: args.maxSockets, maxSocketsPerHost: args.maxSocketsPerHost, requestMethod: args.get!==true ? "head" : "get", - userAgent: args.userAgent + userAgent: args.userAgent, + responseTimeout: args.responseTimeout }, { excludeCachedLinks: args.verbose!==true, diff --git a/lib/internal/checkUrl.js b/lib/internal/checkUrl.js index 5130761f..334f64e8 100644 --- a/lib/internal/checkUrl.js +++ b/lib/internal/checkUrl.js @@ -55,7 +55,8 @@ function checkUrl(link, baseUrl, cache, options, retry) { discardResponse: true, headers: { "user-agent":options.userAgent }, - method: retry!==405 ? options.requestMethod : "get" + method: retry!==405 ? options.requestMethod : "get", + responseTimeout: options.responseTimeout }) .then( function(response) { diff --git a/lib/internal/defaultOptions.js b/lib/internal/defaultOptions.js index c8936ce9..fae62fdb 100644 --- a/lib/internal/defaultOptions.js +++ b/lib/internal/defaultOptions.js @@ -21,7 +21,8 @@ var defaultOptions = requestMethod: "head", retry405Head: true, tags: require("./tags"), - userAgent: userAgent(pkg.name, pkg.version) + userAgent: userAgent(pkg.name, pkg.version), + responseTimeout: 120000 };