mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 00:45:14 +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.userAgent = "WelsonJS/0.1.4-dev (https://github.com/gnh1201/welsonjs)";
|
||||
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.cookie = null;
|
||||
|
@ -366,6 +373,32 @@ var HTTPObject = function(engine) {
|
|||
cmd.push("-d");
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user