Revert "feature(main) add Content-Length"

This reverts commit 34f6aa72a3.
This commit is contained in:
coderaiser 2013-09-04 14:58:21 +00:00
parent 91fa4790c2
commit 0e27721f32

View file

@ -208,9 +208,6 @@
if(p.gzip)
lRet['content-encoding'] = 'gzip';
if (!Util.isUndefined(p.length))
lRet['Content-Length'] = p.length;
}
return lRet;
@ -229,34 +226,24 @@
var p = pParams,
lGzip = isGZIP(p.request) && p.gzip;
fs.stat(p.name, function(error, stat) {
var length;
if (error)
Util.log(error);
else
length = stat.size;
p.response.writeHead(OK, generateHeaders({
name : p.name,
cache : p.cache,
gzip : lGzip,
query : getQuery(p.request),
length : length
}) );
stream.createPipe({
from: p.name,
write: p.response,
zip : lGzip && !p.gziped,
callback: function(pError) {
var lError = pError && pError.toString();
if (pError) {
p.response.writeHead(FILE_NOT_FOUND, 'OK');
p.response.end(lError);
}
p.response.writeHead(OK, generateHeaders({
name : p.name,
cache : p.cache,
gzip : lGzip,
query : getQuery(p.request)
}) );
stream.createPipe({
from: p.name,
write: p.response,
zip : lGzip && !p.gziped,
callback: function(pError) {
var lError = pError && pError.toString();
if (pError) {
p.response.writeHead(FILE_NOT_FOUND, 'OK');
p.response.end(lError);
}
});
}
});
}