mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
move response data from memory to local cache file
This commit is contained in:
@@ -48,6 +48,36 @@ function webInterface(config){
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/fetchBody",function(req,res){
|
||||
var query = req.query;
|
||||
if(query && query.id){
|
||||
GLOBAL.recorder.getDecodedBody(query.id, function(err, result){
|
||||
if(err || !result || !result.content){
|
||||
res.json({});
|
||||
}else if(result.type && result.type == "image" && result.mime){
|
||||
if(query.raw){
|
||||
//TODO : cache query result
|
||||
res.type(result.mime).end(result.content);
|
||||
}else{
|
||||
res.json({
|
||||
id : query.id,
|
||||
type : result.type,
|
||||
ref : "/fetchBody?id=" + query.id + "&raw=true"
|
||||
});
|
||||
}
|
||||
}else{
|
||||
res.json({
|
||||
id : query.id,
|
||||
type : result.type,
|
||||
content : result.content
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
res.end({});
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/fetchCrtFile",function(req,res){
|
||||
if(crtFilePath){
|
||||
res.setHeader("Content-Type","application/x-x509-ca-cert");
|
||||
|
||||
Reference in New Issue
Block a user