mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 07:21:43 +00:00
fix #144
This commit is contained in:
parent
ed3b631b30
commit
266971f5d3
1
data/example_domains.txt
Normal file
1
data/example_domains.txt
Normal file
|
@ -0,0 +1 @@
|
|||
example.org
|
1
data/example_urls.txt
Normal file
1
data/example_urls.txt
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -6,7 +6,7 @@ var HTTP = require("lib/http");
|
|||
var RAND = require("lib/rand");
|
||||
|
||||
function main() {
|
||||
var domains = splitLn(FILE.readFile("data\\target_domains.txt", FILE.CdoCharset.CdoUTF_8));
|
||||
var domains = splitLn(FILE.readFile("data\\example_domains.txt", FILE.CdoCharset.CdoUTF_8));
|
||||
var urls = [];
|
||||
|
||||
domains.forEach(function(x) {
|
||||
|
@ -17,6 +17,8 @@ function main() {
|
|||
.setConnectTimeout(2)
|
||||
.open("GET", "https://" + x)
|
||||
.send();
|
||||
|
||||
console.log(handler.responseText);
|
||||
|
||||
if (handler.detectSSLCompleted()) {
|
||||
urls.push("https://" + x);
|
||||
|
@ -29,7 +31,7 @@ function main() {
|
|||
sleep(RAND.getInt(1000, 2000));
|
||||
});
|
||||
|
||||
FILE.writeFile("data\\target_urls.txt", urls.join("\r\n"), FILE.CdoCharset.CdoUTF_8);
|
||||
FILE.writeFile("data\\example_urls.txt", urls.join("\r\n"), FILE.CdoCharset.CdoUTF_8);
|
||||
|
||||
console.log("Done");
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ var HTTPObject = function(engine) {
|
|||
]);
|
||||
} else if (this.engine == "CURL") {
|
||||
this._interface = SHELL.create();
|
||||
this.setBinPath("bin\\curl.exe"); // the location of cURL binary
|
||||
this.setBinPath("bin\\x64\\curl-8.10.1_1-win64-mingw\\bin\\curl.exe"); // the location of cURL binary
|
||||
} else if (this.engine == "BITS") {
|
||||
this._interface = SHELL.create();
|
||||
this.setBinPath("bitsadmin.exe"); // the location of BITS binary
|
||||
|
@ -701,6 +701,9 @@ var HTTPObject = function(engine) {
|
|||
// Get debuging text
|
||||
debuggingText = this._interface.stderr.read();
|
||||
}
|
||||
|
||||
// clear the stdout and stderr
|
||||
this._interface.clear();
|
||||
} else if (this.engine == "BITS") {
|
||||
var job_name = "welsonjs_" + PipeIPC.UUIDv4.create().substring(0, 8);
|
||||
var job_priority = "normal";
|
||||
|
@ -1155,7 +1158,7 @@ exports.parseURL = parseURL;
|
|||
exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
|
||||
exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible
|
||||
|
||||
exports.VERSIONINFO = "HTTP REST Client (http.js) version 0.7.30";
|
||||
exports.VERSIONINFO = "HTTP REST Client (http.js) version 0.7.31";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
|
@ -451,14 +451,15 @@ function PipeIPC() {
|
|||
};
|
||||
|
||||
this.read = function() {
|
||||
var isRead = false;
|
||||
var isReadCompleted = false;
|
||||
var text = '';
|
||||
|
||||
while (!isRead) {
|
||||
while (!isReadCompleted) {
|
||||
try {
|
||||
this.openReader();
|
||||
text += this._read(this.reader);
|
||||
isRead = true;
|
||||
isReadCompleted = true;
|
||||
|
||||
this.lastReadTime = this.getCurrentTime();
|
||||
this.closeReader();
|
||||
} catch (e) {
|
||||
|
@ -488,8 +489,8 @@ function PipeIPC() {
|
|||
|
||||
var isFileExists = checkFileExists(filename);
|
||||
if (isFileExists) {
|
||||
var isRead = false;
|
||||
while (!isRead) {
|
||||
var isReadCompleted = false;
|
||||
while (!isReadCompleted) {
|
||||
try {
|
||||
var ado = makeInterface(1);
|
||||
ado.Charset = charset;
|
||||
|
@ -497,10 +498,10 @@ function PipeIPC() {
|
|||
ado.LoadFromFile(filename);
|
||||
text += ado.ReadText();
|
||||
ado.Close();
|
||||
isRead = true;
|
||||
isReadCompleted = true;
|
||||
} catch (e) {
|
||||
//console.log(e.message);
|
||||
isRead = false;
|
||||
isReadCompleted = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -513,7 +514,8 @@ function PipeIPC() {
|
|||
this.loadFromFile = function(filename, charset) {
|
||||
charset = (typeof charset !== "undefined" ? charset : this.charset);
|
||||
|
||||
this.write(this.readTextFromFile(filename, charset), ForWriting);
|
||||
var text = this.readTextFromFile(filename, charset);
|
||||
this.write(text, ForWriting);
|
||||
};
|
||||
|
||||
this.reload = function(charset) {
|
||||
|
|
12
lib/shell.js
12
lib/shell.js
|
@ -111,16 +111,13 @@ var ShellObject = function() {
|
|||
this.stderr.reload(this.charset);
|
||||
|
||||
stdout = this.stdout.read();
|
||||
stderr = this.stderr.read();
|
||||
//stderr = this.stderr.read();
|
||||
|
||||
//stdout = this.stdout.read();
|
||||
//stderr = this.stderr.read();
|
||||
//console.log("[stdout] " + stdout);
|
||||
//console.log("[stderr] " + stderr);
|
||||
|
||||
this.stdout.destroy();
|
||||
this.stderr.destroy();
|
||||
|
||||
return stdout;
|
||||
};
|
||||
|
||||
|
@ -171,6 +168,11 @@ var ShellObject = function() {
|
|||
this._interface = null;
|
||||
};
|
||||
|
||||
this.clear = function() {
|
||||
this.stdout.destroy();
|
||||
this.stderr.destroy();
|
||||
};
|
||||
|
||||
this.create();
|
||||
};
|
||||
|
||||
|
@ -222,7 +224,7 @@ exports.getPathOfMyDocuments = function() {
|
|||
|
||||
exports.CdoCharset = PipeIPC.CdoCharset;
|
||||
|
||||
exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.13";
|
||||
exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.14";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user