mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 10:09:04 +00:00
fix(server) add gzip
This commit is contained in:
parent
cdec597f6e
commit
b0a453c6df
1 changed files with 10 additions and 6 deletions
|
|
@ -214,7 +214,7 @@
|
|||
}
|
||||
|
||||
function combine(params) {
|
||||
var names, i, n, name, minName,
|
||||
var names, i, n, name, minName, stream,
|
||||
funcs = [],
|
||||
config = main.config,
|
||||
dir = DIR,
|
||||
|
|
@ -226,24 +226,30 @@
|
|||
isCombine = Util.isContainStrAtBegin(path, COMBINE),
|
||||
readPipe = function() {
|
||||
main.mainSetHeader({
|
||||
name : name,
|
||||
name : names[0],
|
||||
cache : config.cache,
|
||||
gzip : isGzip,
|
||||
request : p.request,
|
||||
response : p.response
|
||||
});
|
||||
|
||||
if (!isGzip)
|
||||
stream = p.response;
|
||||
else
|
||||
stream = gzip;
|
||||
|
||||
files.readPipe({
|
||||
names : names,
|
||||
dir : dir,
|
||||
write : gzip,
|
||||
write : stream,
|
||||
callback : function(error) {
|
||||
if (error)
|
||||
main.sendError(params, error);
|
||||
}
|
||||
});
|
||||
|
||||
gzip.pipe(p.response);
|
||||
if (isGzip)
|
||||
gzip.pipe(p.response);
|
||||
};
|
||||
|
||||
if (isCombine) {
|
||||
|
|
@ -265,10 +271,8 @@
|
|||
|
||||
funcs.push(minify(name));
|
||||
}
|
||||
|
||||
Util.asyncCall(funcs, readPipe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return isCombine;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue