mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 05:31:03 +00:00
Update http.js
This commit is contained in:
parent
3f786a3faf
commit
e7ebb7fac1
33
lib/http.js
33
lib/http.js
|
@ -16,6 +16,13 @@ var HTTPObject = function(engine) {
|
||||||
this.dataType = null;
|
this.dataType = null;
|
||||||
this.userAgent = "WelsonJS/0.1.4-dev (https://github.com/gnh1201/welsonjs)";
|
this.userAgent = "WelsonJS/0.1.4-dev (https://github.com/gnh1201/welsonjs)";
|
||||||
this.isAsync = false;
|
this.isAsync = false;
|
||||||
|
this.proxy = {
|
||||||
|
"enabled": false,
|
||||||
|
"protocol": "http",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 80,
|
||||||
|
"credential": null // { username: "user", password: "pass" }
|
||||||
|
};
|
||||||
this.engine = (typeof(engine) !== "undefined" ? engine : "MSXML");
|
this.engine = (typeof(engine) !== "undefined" ? engine : "MSXML");
|
||||||
|
|
||||||
this.cookie = null;
|
this.cookie = null;
|
||||||
|
@ -367,6 +374,32 @@ var HTTPObject = function(engine) {
|
||||||
cmd.push(this.requestBody);
|
cmd.push(this.requestBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add proxy: <[protocol://][user:password@]proxyhost[:port]>
|
||||||
|
if (this.proxy != null && this.proxy.enabled) {
|
||||||
|
cmd.push("-x");
|
||||||
|
if (this.proxy.credential != null) {
|
||||||
|
cmd.push([
|
||||||
|
this.proxy.protocol,
|
||||||
|
"://",
|
||||||
|
this.proxy.credential.username,
|
||||||
|
":",
|
||||||
|
this.proxy.credential.password,
|
||||||
|
"@",
|
||||||
|
this.proxy.host,
|
||||||
|
":",
|
||||||
|
this.proxy.port
|
||||||
|
].join(""));
|
||||||
|
} else {
|
||||||
|
cmd.push([
|
||||||
|
this.proxy.protocol,
|
||||||
|
"://",
|
||||||
|
this.proxy.host,
|
||||||
|
":",
|
||||||
|
this.proxy.port
|
||||||
|
].join(""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cmd.push(state.url);
|
cmd.push(state.url);
|
||||||
|
|
||||||
// Get response text
|
// Get response text
|
||||||
|
|
Loading…
Reference in New Issue
Block a user