Update http.js

This commit is contained in:
Namhyeon Go 2022-01-13 17:46:57 +09:00 committed by GitHub
parent d366427b62
commit 3a565759be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,8 +227,7 @@ var HTTPObject = function(engine) {
}
this.setUserAgent = function(agent) {
this.userAgent = agent;
this.setHeader("User-Agent", this.userAgent);
this.userAgent = agent;
return this;
};
@ -290,7 +289,8 @@ var HTTPObject = function(engine) {
var url = this.serializeParameters(url);
this.setMethod(method.toUpperCase()); // set method
this.pushState(null, null, url); // push state
this.pushState(null, null, url); // push stat
this.setHeader("User-Agent", (this.userAgent != null ? this.userAgent : "")); // set user agent
try {
if (this.engine == "MSXML") {
@ -364,11 +364,9 @@ var HTTPObject = function(engine) {
cmd.push("-b");
cmd.push(this.cookie);
}
if (this.userAgent != null) {
cmd.push("-A");
cmd.push(this.userAgent);
}
cmd.push("-A");
cmd.push((this.userAgent != null ? this.userAgent : ''));
var pos = url.indexOf('?');
if (pos > -1) {
@ -477,7 +475,6 @@ var HTTPObject = function(engine) {
};
this.create();
this.setUserAgent(this.userAgent);
};
exports.create = function(engine) {