mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(server) combine: add mainSetHeader
This commit is contained in:
parent
1761a61a81
commit
7e87b35dc6
1 changed files with 21 additions and 3 deletions
|
|
@ -24,6 +24,7 @@
|
|||
AppCache = main.appcache,
|
||||
Socket = main.socket,
|
||||
|
||||
zlib = main.zlib,
|
||||
http = main.http,
|
||||
https = main.https,
|
||||
Util = main.util,
|
||||
|
|
@ -217,15 +218,32 @@
|
|||
funcs = [],
|
||||
config = main.config,
|
||||
dir = DIR,
|
||||
gzip = zlib.createGzip(),
|
||||
p = params,
|
||||
isGzip = main.isGZIP(p.request),
|
||||
path = params.name,
|
||||
COMBINE = '/combine/',
|
||||
isCombine = Util.isContainStrAtBegin(path, COMBINE),
|
||||
readPipe = function() {
|
||||
files.readPipe(names, dir, p.response, function(error) {
|
||||
if (error)
|
||||
main.sendError(params, error);
|
||||
main.mainSetHeader({
|
||||
name : name,
|
||||
cache : config.cache,
|
||||
gzip : isGzip,
|
||||
request : p.request,
|
||||
response : p.response
|
||||
});
|
||||
|
||||
files.readPipe({
|
||||
names : names,
|
||||
dir : dir,
|
||||
write : gzip,
|
||||
callback : function(error) {
|
||||
if (error)
|
||||
main.sendError(params, error);
|
||||
}
|
||||
});
|
||||
|
||||
gzip.pipe(p.response);
|
||||
};
|
||||
|
||||
if (isCombine) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue