little css

This commit is contained in:
2013-02-14 08:18:17 -05:00
parent e96147b7ff
commit b603f2404c
73 changed files with 6191 additions and 24 deletions

View File

@@ -0,0 +1,14 @@
<!doctype html>
<html>
<head><title>Index Test</title></head>
<body>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</body>
</html>

0
node_modules/gzippo/test/fixtures/js/nestedTest.js generated vendored Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

1
node_modules/gzippo/test/fixtures/test.js generated vendored Normal file
View File

@@ -0,0 +1 @@
alert("hello");

BIN
node_modules/gzippo/test/fixtures/test.js.gzip generated vendored Normal file

Binary file not shown.

BIN
node_modules/gzippo/test/fixtures/tomg.co.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
node_modules/gzippo/test/fixtures/user.gzip generated vendored Normal file

Binary file not shown.

4
node_modules/gzippo/test/fixtures/user.json generated vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "tomgallacher",
"website": "www.tomgallacher.info"
}

0
node_modules/gzippo/test/fixtures/utf8.gz generated vendored Normal file
View File

32
node_modules/gzippo/test/fixtures/utf8.txt generated vendored Normal file
View File

@@ -0,0 +1,32 @@
English: The quick brown fox jumps over the lazy dog.
Jamaican: Chruu, a kwik di kwik brong fox a jomp huova di liezi daag de, yu no siit?
Irish: "An ḃfuil do ċroí ag bualaḋ ó ḟaitíos an ġrá a ṁeall lena ṗóg éada ó ṡlí do leasa ṫú?" "D'ḟuascail Íosa Úrṁac na hÓiġe Beannaiṫe pór Éava agus Áḋaiṁ."
Dutch: Pa's wijze lynx bezag vroom het fikse aquaduct.
German: Falsches Üben von Xylophonmusik quält jeden größeren Zwerg. (1)
German: Im finſteren Jagdſchloß am offenen Felsquellwaſſer patzte der affig-flatterhafte kauzig-höfliche Bäcker über ſeinem verſifften kniffligen C-Xylophon. (2)
Norwegian: Blåbærsyltetøy ("blueberry jam", includes every extra letter used in Norwegian).
Swedish: Flygande bäckasiner söka strax hwila på mjuka tuvor.
Icelandic: Sævör grét áðan því úlpan var ónýt.
Finnish: (5) Törkylempijävongahdus (This is a perfect pangram, every letter appears only once. Translating it is an art on its own, but I'll say "rude lover's yelp". :-D)
Finnish: (5) Albert osti fagotin ja töräytti puhkuvan melodian. (Albert bought a bassoon and hooted an impressive melody.)
Finnish: (5) On sangen hauskaa, että polkupyörä on maanteiden jokapäiväinen ilmiö. (It's pleasantly amusing, that the bicycle is an everyday sight on the roads.)
Polish: Pchnąć w tę łódź jeża lub osiem skrzyń fig.
Czech: Příliš žluťoučký kůň úpěl ďábelské kódy.
Slovak: Starý kôň na hŕbe kníh žuje tíško povädnuté ruže, na stĺpe sa ďateľ učí kvákať novú ódu o živote.
Greek (monotonic): ξεσκεπάζω την ψυχοφθόρα βδελυγμία
Greek (polytonic): ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
Russian: Съешь же ещё этих мягких французских булок да выпей чаю.
Russian: В чащах юга жил-был цитрус? Да, но фальшивый экземпляр! ёъ.
Bulgarian: Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
Sami (Northern): Vuol Ruoŧa geđggiid leat máŋga luosa ja čuovžža.
Hungarian: Árvíztűrő tükörfúrógép.
Spanish: El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro.
Portuguese: O próximo vôo à noite sobre o Atlântico, põe freqüentemente o único médico. (3)
French: Les naïfs ægithales hâtifs pondant à Noël où il gèle sont sûrs d'être déçus en voyant leurs drôles d'œufs abîmés.
Esperanto: Eĥoŝanĝo ĉiuĵaŭde.
Hebrew: זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
Japanese (Hiragana):
いろはにほへど ちりぬるを
わがよたれぞ つねならむ
うゐのおくやま けふこえて
あさきゆめみじ ゑひもせず (4)

BIN
node_modules/gzippo/test/fixtures/utf8.txt.gz generated vendored Normal file

Binary file not shown.

88
node_modules/gzippo/test/prefexTest.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
/**
* Module dependencies.
*/
var staticProvider,
assert = require('assert'),
should = require('should'),
http = require('http'),
gzippo = require('../');
try {
staticProvider = require('connect');
} catch (e) {
staticProvider = require('express');
}
/**
* Path to ./test/fixtures/
*/
var fixturesPath = __dirname + '/fixtures';
module.exports = {
'requesting without a prefix succeeds': function() {
var app = staticProvider.createServer(
gzippo.staticGzip(fixturesPath)
);
assert.response(app,
{
url: '/user.json',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
res.headers.should.have.property('content-length', '69');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
},
'requesting with a prefix succeeds': function() {
var app = staticProvider.createServer(
gzippo.staticGzip(fixturesPath, { prefix: '/resource' })
);
assert.response(app,
{
url: '/resource/user.json',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
res.headers.should.have.property('content-length', '69');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
},
'requesting with a / prefix succeeds': function() {
var app = staticProvider.createServer(
gzippo.staticGzip(fixturesPath, { prefix: '/'})
);
assert.response(app,
{
url: '/user.json',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
res.headers.should.have.property('content-length', '69');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
}
};

67
node_modules/gzippo/test/prefix.test.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
var assert = require('assert')
, http = require('http')
, fs = require('fs')
, connect = require('connect')
, join = require('path').join
, gzippo = require('../')
;
var fixtures = join(__dirname, 'fixtures')
, port = 32124
, app
, request
;
// read a fixture file synchronously
function file(name) {
return fs.readFileSync(join(fixtures, name));
}
describe('gzippo.statisGzip (with prefix)', function() {
it('should successfully serve a .json file with a path prefix', function(done) {
var app = connect.createServer();
app.use(gzippo.staticGzip(fixtures, { prefix: '/foo' }));
request = require('./request')({ port: port + 5 });
app.listen(port + 5, function() {
request('/foo/user.json', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(res.headers['content-type'], 'application/json; charset=UTF-8');
assert.equal(data.length, '69');
assert.equal(res.headers['content-encoding'], 'gzip');
assert.deepEqual(data, file('user.gzip'));
done();
}
);
});
});
it('should serve files as expected with a / prefix', function(done) {
var app = connect.createServer();
app.use(gzippo.staticGzip(fixtures, { prefix: '/' }));
request = require('./request')({ port: port + 6});
app.listen(port + 6, function() {
request('/user.json', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(res.headers['content-type'], 'application/json; charset=UTF-8');
assert.equal(data.length, '69');
assert.equal(res.headers['content-encoding'], 'gzip');
assert.deepEqual(data, file('user.gzip'));
done();
}
);
});
});
});

51
node_modules/gzippo/test/request.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
var http = require('http')
;
var port;
// basic request mocking function
module.exports = function (options) {
port = options.port || 32123;
return request;
};
var request = function(path, headers, callback) {
var options = {
host: '127.0.0.1',
port: port,
path: path,
headers: headers || {},
method: 'GET'
};
var req = http.request(options, function(res) {
var buffers = []
, total = 0;
res.on('data', function(buf) {
buffers.push(buf);
total += buf.length;
});
res.on('end', function() {
var data = new Buffer(total)
, offset = 0;
for (var i = 0; i < buffers.length; i++) {
buffers[i].copy(data, offset);
offset += buffers[i].length;
}
callback(null, res, data);
});
res.on('error', function(err) {
callback(err);
});
});
req.on('error', function(err) {
callback(err);
});
req.end();
};

180
node_modules/gzippo/test/staticGzipTest.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
/**
* Module dependencies.
*/
var staticProvider,
assert = require('assert'),
should = require('should'),
http = require('http'),
gzippo = require('../'),
crypto = require('crypto'),
fs = require('fs'),
shasum = crypto.createHash('sha1');
try {
staticProvider = require('connect');
} catch (e) {
staticProvider = require('express');
}
/**
* Path to ./test/fixtures/
*/
var fixturesPath = __dirname + '/fixtures';
function getApp() {
return staticProvider.createServer(gzippo.staticGzip(fixturesPath, {clientMaxAge: 604800000}));
}
module.exports = {
'requesting gzipped json file succeeds': function() {
assert.response(getApp(),
{
url: '/user.json',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
assert.response(getApp(), { url: '/user.gzip' }, function(res) {
assert.equal(gzippedData, res.body, "Data is not gzipped");
});
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'application/json; charset=UTF-8');
// res.headers.should.have.property('content-length', '69');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
},
'requesting gzipped js file succeeds': function() {
assert.response(getApp(),
{
url: '/test.js',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
assert.response(getApp(), { url: '/test.js.gzip' }, function(res) {
assert.equal(gzippedData, res.body, "Data is not gzipped");
});
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'application/javascript; charset=UTF-8');
res.headers.should.have.property('content-length', '35');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
},
'requesting js file without gzip succeeds': function() {
assert.response(getApp(),
{
url: '/test.js'
},
function(res){
var gzippedData = res.body;
fs.readFile(fixturesPath + '/test.js', function (err, data) {
if (err) throw err;
assert.equal(gzippedData, data, "Data returned does not match file data on filesystem");
});
res.statusCode.should.equal(200);
res.headers.should.have.property('content-length', '15');
}
);
},
'requesting gzipped utf-8 file succeeds': function() {
assert.response(getApp(),
{
url: '/utf8.txt',
headers: {
'Accept-Encoding':"gzip"
}
},
function(res){
var gzippedData = res.body;
assert.response(getApp(), { url: '/utf8.txt.gz' }, function(res) {
assert.equal(gzippedData, res.body, "Data is not gzipped");
});
res.statusCode.should.equal(200);
res.headers.should.have.property('content-type', 'text/plain; charset=UTF-8');
res.headers.should.have.property('content-length', '2031');
res.headers.should.have.property('content-encoding', 'gzip');
}
);
},
'requesting gzipped utf-8 file returns 304': function() {
assert.response(getApp(),
{
url: '/utf8.txt',
headers: {
'Accept-Encoding': "gzip"
}
},
function(res) {
res.statusCode.should.equal(200);
assert.response(getApp(),
{
url: '/utf8.txt',
headers: {
'Accept-Encoding': "gzip",
'If-Modified-Since': res.headers['last-modified']
}
},
function(res2) {
res2.statusCode.should.equal(304);
}
);
}
);
},
'requesting gzipped utf-8 file returns 200': function() {
assert.response(getApp(),
{
url: '/utf8.txt',
headers: {
'Accept-Encoding': "gzip"
}
},
function(res) {
res.statusCode.should.equal(200);
}
);
},
'ensuring max age is set on resources which are passed to the default static content provider': function() {
assert.response(getApp(),
{
url: '/tomg.co.png'
},
function(res) {
res.headers.should.have.property('cache-control', 'public, max-age=604800');
}
);
},
'Ensuring that when viewing a directory a redirect works correctly': function() {
assert.response(getApp(),
{
url: '/js'
},
function(res) {
res.statusCode.should.not.equal(301);
}
);
},
'ensuring that gzippo works with a space in a static content path': function() {
assert.response(getApp(),
{
url: '/space%20the%20final%20frontier/tomg.co.png'
},
function(res) {
res.statusCode.should.not.equal(404);
}
);
}
};

203
node_modules/gzippo/test/test-static.js generated vendored Normal file
View File

@@ -0,0 +1,203 @@
var assert = require('assert')
, fs = require('fs')
, express = require('express')
, join = require('path').join
, gzippo = require('../')
;
var fixtures = join(__dirname, 'fixtures')
, port = 32123
, app
, request = require('./request')({ port: port })
;
// builds a `request` callback which asserts that the response's statusCode is
// what we expect
function statusCode(expected, callback) {
return function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, expected);
callback();
};
}
// read a fixture file synchronously
function file(name) {
return fs.readFileSync(join(fixtures, name));
}
describe('gzippo.staticGzip', function() {
app = express();
app.use(gzippo.staticGzip(fixtures));
app.use(app.router);
app.listen(port);
// set up a new server for each test
// beforeEach(function(done) {
// });
// afterEach(function() {
// app.exit();
// });
it('should gzip static .json file', function(done) {
request('/user.json', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(res.headers['content-type'], 'application/json; charset=UTF-8');
assert.equal(data.length, '69');
assert.equal(res.headers['content-encoding'], 'gzip');
assert.deepEqual(data, file('user.gzip'));
done();
}
);
});
// it('should get a route', function(done) {
// request('/', { },
// function(err, res, data) {
// console.log(data.toString());
// if (err) throw err;
// assert.equal(res.statusCode, 200);
// assert.deepEqual(data, 'ok');
// done();
// }
// );
// });
it('should gzip static .js file', function(done) {
request('/test.js', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(res.headers['content-type'], 'application/javascript; charset=UTF-8');
assert.equal(data.length, '35');
assert.equal(res.headers['content-encoding'], 'gzip');
assert.deepEqual(data, file('test.js.gzip'));
done();
}
);
});
it('should serve a .js file uncompressed when the accept-encoding header has not been set', function(done) {
request('/test.js', {}, function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(data.length, '15');
assert.deepEqual(data, file('test.js'));
done();
});
});
it('should successfully gzip a utf-8 file', function(done) {
request('/utf8.txt', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.equal(res.headers['content-type'], 'text/plain; charset=UTF-8');
assert.equal(data.length, '2031');
assert.equal(res.headers['content-encoding'], 'gzip');
assert.deepEqual(data, file('utf8.txt.gz'));
done();
}
);
});
it('should cache a previously gzipped utf-8 file (and respond with a 304 Not Modified)', function(done) {
request('/utf8.txt', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
var headers = {
'Accept-Encoding': 'gzip',
'If-Modified-Since': res.headers['last-modified']
};
request('/utf8.txt', headers, statusCode(304, done));
}
);
});
it('should set max age resources which are passed to the default static content provider', function(done) {
request('/tomg.co.png', {},
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.notEqual(res.headers['cache-control'].indexOf('max-age=604800'), -1);
done();
}
);
});
it('should allow normal traversal', function(done) {
request('/nom/../tomg.co.png', {},
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
assert.deepEqual(data, file('tomg.co.png'));
done();
}
);
});
it('should redirect on directories', function(done) {
request('/js', {}, statusCode(301, done));
});
it('should work for paths containing URI-encoded spaces', function(done) {
request('/space%20the%20final%20frontier/tomg.co.png', { 'Accept-Encoding': 'gzip' }, statusCode(200, done));
});
it('should not let the user access files outside of the static directory (urlencoded)', function(done) {
request('/../test-static.js', { 'Accept-Encoding': 'gzip' }, statusCode(403, done));
});
it('should not let the user access files outside of the static directory', function(done) {
request('/%2e%2e/test-static.js', { 'Accept-Encoding': 'gzip' }, statusCode(403, done));
});
it('should not let the user access files from root of file system', function(done) {
request('/etc/password', { 'Accept-Encoding': 'gzip' }, statusCode(404, done));
});
it('should serve index.html for directories (if found)', function(done) {
request('/index_test/', { 'Accept-Encoding': 'gzip' },
function(err, res, data) {
if (err) throw err;
assert.equal(res.statusCode, 200);
// assert.equal(res.headers['content-length'], '616');
done();
}
);
});
});