Update http.js

This commit is contained in:
Namhyeon Go 2022-01-18 01:43:47 +09:00 committed by GitHub
parent 799fa588d0
commit ca5a256afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -533,11 +533,16 @@ var HTTPObject = function(engine) {
var str = String(str);
var Lpos = str.indexOf('{');
var Rpos = str.indexOf('}', Lpos + 1);
var s1 = [], s2 = null, s3, s4;
var s0 = '', s1 = [], s2 = null, s3, s4;
var regex = /^[\w\-\s]+$/;
while (Lpos > -1 && Rpos > -1) {
s1 = str.substring(Lpos + 1, Rpos).split(' ');
s0 = str.substring(Lpos + 1, Rpos);
if (!regex.test(s0)) {
s2 = '{' + s0 + '}';
} else {
s1 = s0.split(' ');
while (s1.length > 0) {
s3 = s1.pop();
@ -558,6 +563,7 @@ var HTTPObject = function(engine) {
}
}
}
}
str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1);
Lpos = str.indexOf('{');