// ...
this.isVerifySSL = false;
// ...
// If not verify SSL
if (!this.isVerifySSL) {
if (this.proxy.enabled) {
cmd.push("--proxy-insecure");
}
cmd.push("-k");
cmd.push("--ssl-no-revoke");
}
// ...
function parseURL(input) {
// 정규식 패턴
var pattern = /^(?:(https?):\/\/)?(?:([^:@]+)(?::([^:@]*))?@)?([^:]+)(?::(\d{1,5}))?$/;
// 입력된 문자열에서 protocol, username, password, host, port 추출
var matches = input.match(pattern);
if (!matches) return null;
var protocol = matches[1] || 'http'; // 프로토콜이 없는 경우 기본값으로 http 사용
var username = matches[2] || ''; // username이 없는 경우 빈 문자열 반환
var password = matches[3] || ''; // password가 없는 경우 빈 문자열 반환
var host = matches[4];
var port = matches[5] || ''; // 포트가 없는 경우 빈 문자열 반환
var credential = null;
// 로그인 정보가 존재하는 경우
if (username != '' && password != '') {
credential = {
"username": username,
"password": password
}
}
return {
"protocol": protocol,
"host": host,
"port": parseInt(port),
"credential": credential
};
}
// ...
exports.parseURL = parseURL;
prepend text
lib/file.js
function prependFile(FN, content, charset) {
var pipe = PipeIPC.connect("volatile");
pipe.setCharset(charset);
pipe.startRecorder(FN, PipeIPC.ForWriting);
pipe.write(content);
pipe.destroy();
return true;
}
lib/pipe-ipc.js
// ...
this.recorder_iomode = ForAppending;
// ...
this.startRecorder = function(filename, iomode) {
this.savefile = filename;
this.tmpfile = this.savefile + ".tmp";
this.recorder_iomode = iomode;
if (this.recorder_iomode == ForAppending) {
// read a text from save file
var isExistsSaveFile = createFSO().FileExists(this.savefile);
if (isExistsSaveFile) {
var handler = createFSO().OpenTextFile(this.tmpfile, ForWriting, true, TristateTrue);
handler.Write(this.readTextFromFile(this.savefile));
handler.Close();
}
}
this.openRecorder(iomode);
};
// ...
this._record = function(message) {
if (this.recorder_iomode == ForAppending) {
this.recorder.Write(message);
} else if (this.recorder_iomode == ForWriting) {
this.recorder.Write(message + this.delimiter + this.readTextFromFile(this.savefile));
}
};
this.record = function(message) {
var isRecorded = false;
while (!isRecorded) {
try {
this.openRecorder(this.recorder_iomode);
this._record(message);
this.closeRecorder();
this.commit(this.savefile);
isRecorded = true;
} catch (e) {
//console.log(e.message);
this.closeRecorder();
isRecorded = false;
}
}
return isRecorded;
};
Feedback 2024-04-05
lib/http.js
lib/file.js
lib/pipe-ipc.js