mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
optimize webServer, move it to /lib
This commit is contained in:
@@ -106,21 +106,22 @@ function Recorder(option){
|
||||
|
||||
if(!bodyContent){
|
||||
cb(null,result);
|
||||
}else{
|
||||
var record = doc[0],
|
||||
resHeader = record['resHeader'] || {};
|
||||
try{
|
||||
var charsetMatch = JSON.stringify(resHeader).match(/charset="?([a-zA-Z0-9\-]+)"?/);
|
||||
if(charsetMatch && charsetMatch.length > 1){
|
||||
var currentCharset = charsetMatch[1].toLowerCase();
|
||||
if(currentCharset != "utf-8" && iconv.encodingExists(currentCharset)){
|
||||
bodyContent = iconv.decode(bodyContent, currentCharset);
|
||||
}
|
||||
}
|
||||
}catch(e){}
|
||||
|
||||
cb(null,bodyContent.toString());
|
||||
}
|
||||
|
||||
var record = doc[0],
|
||||
resHeader = record['resHeader'] || {};
|
||||
try{
|
||||
var charsetMatch = JSON.stringify(resHeader).match(/charset="?([a-zA-Z0-9\-]+)"?/);
|
||||
if(charsetMatch && charsetMatch.length > 1){
|
||||
var currentCharset = charsetMatch[1].toLowerCase();
|
||||
if(currentCharset != "utf-8" && iconv.encodingExists(currentCharset)){
|
||||
bodyContent = iconv.decode(bodyContent, currentCharset);
|
||||
}
|
||||
}
|
||||
}catch(e){}
|
||||
|
||||
cb(null,bodyContent.toString());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user