optimize webServer, move it to /lib

This commit is contained in:
OttoMao
2015-04-25 10:28:40 +08:00
parent db4ab7d2f9
commit 8e7aef70ae
12 changed files with 817 additions and 451 deletions

View File

@@ -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());
});
}