mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
1.fix record issue with https 2.rewrite rule scheme
This commit is contained in:
@@ -45,16 +45,8 @@ function Recorder(){
|
||||
if(!id || !info.resBody) return;
|
||||
//add to body map
|
||||
//do not save image data
|
||||
if(/image/.test(info.res.headers['content-type'])){
|
||||
if(/image/.test(info.resHeader['content-type'])){
|
||||
self.recordBodyMap[id] = "(image)";
|
||||
}else if(/gzip/.test(info.res.headers['content-encoding'])){
|
||||
zlib.unzip(info.resBody,function(err,buffer){
|
||||
if(err){
|
||||
self.recordBodyMap[id] = "(err when unzip response buffer)";
|
||||
}else{
|
||||
self.recordBodyMap[id] = buffer.toString();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
self.recordBodyMap[id] = info.resBody.toString();
|
||||
}
|
||||
@@ -81,7 +73,7 @@ function normalizeInfo(id,info){
|
||||
|
||||
//general
|
||||
singleRecord._id = id;
|
||||
singleRecord.id = id;
|
||||
singleRecord.id = id;
|
||||
singleRecord.url = info.url;
|
||||
singleRecord.host = info.host;
|
||||
singleRecord.path = info.path;
|
||||
@@ -92,13 +84,13 @@ function normalizeInfo(id,info){
|
||||
singleRecord.startTime = info.startTime;
|
||||
|
||||
//res
|
||||
if(info.res){
|
||||
singleRecord.statusCode= info.res.statusCode;
|
||||
if(info.endTime){
|
||||
singleRecord.statusCode= info.statusCode;
|
||||
singleRecord.endTime = info.endTime;
|
||||
singleRecord.resHeader = info.res.headers;
|
||||
singleRecord.resHeader = info.resHeader;
|
||||
singleRecord.length = info.length;
|
||||
if(info.res.headers['content-type']){
|
||||
singleRecord.mime = info.res.headers['content-type'].split(";")[0];
|
||||
if(info.resHeader['content-type']){
|
||||
singleRecord.mime = info.resHeader['content-type'].split(";")[0];
|
||||
}else{
|
||||
singleRecord.mime = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user