В ответ на запрос:
Remote Address:127.0.0.1:80
Request URL:http://localhost/js/jquery.js
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,ru;q=0.6,de;q=0.4
Connection:keep-alive
Host:localhost
User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
Response Headersview source
Connection:keep-alive
Content-Type:text/javascript
Date:Mon, 03 Nov 2014 16:17:10 GMT
Transfer-Encoding:chunked
браузера
Chrome 38.0.2125.111 m (Win 8)
при загрузке страницы с сервера
Node.js v0.10.33:
<!doctype html>
<html>
<head>
<script src="js/jquery.js"></script>
...
сервер пытается отдать скрипт(js/jquery.js)
вот так:
path = './js/jquery.js';
var stream = fs.createReadStream(path, 'utf8');
stream.on('readable', function () {
response.writeHead(200, {'Content-Type': 'text/javascript'});
var out;
while ((out = stream.read()) !== null)
response.write(out, 'utf8');
});
stream.once('end', function () {
response.end();
});
на что в консоль браузера вываливается ошибка:
GET localhost/js/jquery.js net::ERR_INVALID_CHUNKED_ENCODING