43 Commits

Author SHA1 Message Date
Nick Martin
33a4cd617b Add a bunch of comments. 2013-02-14 21:50:17 -08:00
Andrew Wilcox
cc27c50339 Browser identification and html attributes hook
This commit is theoretically independent of the route policy PR, but
had multiple merge conflicts with it.  This PR branch thus is based on
the route policy PR.  (That is you should only merge this PR if you've
already merged the route policy PR).

Adds an html attribute hook, used by the appcache package to insert the
manifest attribute into the app HTML.

However, to use the hook the appcache package needs to be able to
identify the browser (to decide whether to include the attribute or
not for that browser).

We now have multiple places that want to identify the browser: the
unsupported browser page, the appcache package, and, if we eventually
implement not delivering large polyfills to browsers that don't need
them, in app HTML generation code as well.

To avoid detecting the browser in multiple places ad-hoc, this commit
creates a Meteor "browser" object, intended to be a standard way of
identifying the browser server-side.  It uses but does not expose the
npm useragent module (we could choose a different mechanism to
identify the browser in the future if we wanted to).  The browser
object contains

* `name`: the name of the browser in camel case
* `major`, `minor`, `patch`: integers describing the browser version

In addition to the html attribute hook, the appcache package also
needs a way to get from the connect `req` object to the identified
browser (browsers *start* caching when they see the manifest
attribute, but only *stop* caching when they get a 404 for the
manifest...)

Eventually though we'd like smart packages to be able to serve content
without having to plug directly into connect.

This commit thus also introduces an early version of a Meteor
`request` object, intended to be a high-level description of the
request without exposing details of connect's low-level `req`.
Currently it contains:

* `browser`: browser identification object described above
* `url`: parsed url, including parsed query params

To get started, as a temporary measure I've added a
`categorizeRequest` function to __meteor_bootstrap__ which converts a
connect `req` to a Meteor `request`.  (Suggestions for a better name
are welcome).  This can go away once smart packages such as appcache
are being passed a `request` object directly when they serve content.

This allows `request` to be used uniformly: it is passed to the html
attributes hook, and the appcache package can use it when deciding
whether to generate a 404 for the manifest.
2013-02-14 20:14:49 -08:00
Andrew Wilcox
f2d9792f90 Route policy declarations (for network routes only for now).
Allows packages such as stream and accounts to declare URL prefixes
such as /sockjs/ and /_oauth/ to be network routes.

Updates server to avoid serving app HTML on network routes.

Checks for conflict between files in public/ and network routes.  For
example, the developer might not know that /sockjs/ is reserved, and
might create a file "public/sockjs/socks-are-great.png".
2013-02-13 13:12:59 +00:00
Andrew Wilcox
93b31e563c Code review updates to the bundle manifest.
`__meteor_bootstrap__.bundler` => `__meteor_bootstrap__.bundle`

`bundle.bundle_dir` => `bundle.root`

Rather than placing app_info/appInfo containing the manifest in the
bundle object, instead I'm now placing the manifest directly in the
bundle object.  A) no code currently uses bundle.appInfo.load; B) if
someday we expand the manifest to also include server side resources
than we'd be getting rid of `load` anyway; C) I think it reads better:

`bundle.appInfo.manifest` => `bundle.manifest`

cp_r now returns a list of os-specific relative file system paths as
strings, instead of paths as arrays.

I changed the normalized "path" field in the manifest to be a relative
path instead of an absolute path (`"/static/cat.jpg"` =>
`"static/cat.jpg"`).  This felt better when looking at the manifest; I
think because the path is relative to the bundle root.
2013-02-12 12:35:30 -08:00
Andrew Wilcox
99ebc78d7a Generate a bundler manifest.
Creates a manifest of the static files delivered to the client, for use
by the app cache.  The manifest is also designed to be usable to generate
etag's for issue #626.

In the original bundler code `self.css` and `self.js.client` starts
out as an array of os-specific file paths and later becomes an array
of URLs (including query parameters).  While I tried to minimize code
changes to avoid creating extra work for the engine project, this
turned out to be too crazy to deal with.  In this version `self.css`
and `self.js.client` stay as file paths, and _generate_app_html now
pulls the client URLs from the new manifest.

This PR is thus proposing a design where the bundler manifest becomes
the source of knowledge about client static resources included in the
bundle, and is then used to generate the app html, the app cache, and
perhaps etag's in the future.  (If it made sense then the `load` list
of server Javascript files could also be folded into the manifest,
making the manifest the source of knowledge about all static
resources... but the code in this PR don't include any steps in that
direction).
2013-02-12 12:35:30 -08:00
Andrew Wilcox
d4534c5f15 Make static not cacheable.
Fixes #631.

Update the dev_bundle to use the Meteor version of gzippo which allows
clientMaxAge to be set to 0, and change server.js to set the
clientMaxAge to 0 for static.
2013-02-07 20:39:05 -08:00
Nick Martin
48010de100 Comment on app.manifest exclusion. 2013-02-01 11:20:22 -08:00
Andrew Wilcox
0fcb503fa4 also exclude app.manifest from returning app_html 2013-02-01 11:15:59 -08:00
David Glasser
5a54a5c79f Update Node to 0.8.18.
We now used TypedArrays (Uint8Arrays), and versions of Node prior to 0.8.17 have
a security vulnerability related to TypedArrays.
2013-01-30 09:55:47 -08:00
Andrew Wilcox
a8349f3973 Fix exclusion of favicon.ico and robots.txt on Windows.
The use of path.sep is incorrect because req.url is a URL, not a file
path, and so always contains forward slashes.

I verified that the original code does not work on Windows and that
the new code does.
2013-01-18 19:04:32 -08:00
David Glasser
2aa92b2ed3 Update to use APIs from new versions of fibers and uglify-js.
Combine files before minimizing.

minimongo - subkey sort fails when minized, so clearly there is some sort of
uglify bug.
2013-01-16 11:34:30 -05:00
David Glasser
13074d58b9 Remove two copies of underscore.js from Meteor, using NPM package instead.
Follow-up to 27382c6. A step towards addressing issue #302.

We still have one copy in the underscore smart package, for serving to clients.
2012-12-21 11:20:01 -08:00
Nick Martin
34b7bdbbac Bump underscore version. 2012-11-15 20:44:56 -08:00
David Glasser
cb464b7ee4 For both CLI meteor and the server, require up-to-date Node.
We allow Node versions later than the version in the dev bundle (which is the
version that is used for pre-release QA) but not earlier.
2012-11-05 14:04:48 -08:00
Tom Wijsman
8f83b2c32e Made sure all file system related statements use proper path.join and path.sep to support other platforms. 2012-10-30 15:53:49 -07:00
Nick Martin
65aaa2e991 Specify UTF-8 for app HTML. Fixes #264 2012-09-24 18:11:24 -07:00
David Glasser
f340c35c02 Basic email support. 2012-09-14 18:38:29 -07:00
Nick Martin
70e82dd5f9 Replace path.existsSync with fs.existsSync 2012-08-31 14:04:06 -07:00
Nick Martin
1df6b74ada Feedback from review. 2012-08-16 21:16:31 -07:00
Nick Martin
f18b58763b Initial absolute-url package. 2012-08-15 23:28:51 -07:00
Avital Oliver
a2d5bfa6db Allow packages to hook in before app html serving. Cherry picked from auth branch. 2012-07-20 19:35:48 -07:00
Nick Martin
bb3bc2049f Up keepalive timeout.
This will cause it to take a little longer before an abandoned server dies and frees it's port, but should reduce accidental deaths when the supervising process is backlogged.
2012-07-12 13:55:05 -07:00
Nick Martin
a248f0ff28 Allowing passing in a default DDP endpoint as an environment variable. 2012-06-26 15:14:30 -07:00
Nick Martin
69f8121b88 Don't serve app_html for robots.txt. Allow robots on docs site. 2012-06-25 14:00:30 -07:00
Islam Sharabash
eb8a847c06 check static cacheable dir exists before using gzippo 2012-06-19 17:01:25 -07:00
Nick Martin
82e0a7b4b9 Upgrade all 3 copies of underscore. *sigh* 2012-04-23 21:45:02 -07:00
Nick Martin
f894cce907 Use new gzippo package. 2012-04-05 17:51:48 -07:00
Nick Martin
675a08f868 Use staticGzip to avoid forking a gzip for every static file served. 2012-04-03 20:44:20 -07:00
Nick Martin
d820a7f8b8 Disable unsupported browser check. No one uses IE5, and it broke IE10. 2012-02-14 18:00:50 -08:00
David Greenspan
f2cd91ef6b updated Underscore to 1.3.1 to fix livedata bug 2012-02-13 14:55:07 -08:00
matt debergalis
6c7a31b1fb don't serve app html for missing /favicon.ico 2012-02-09 17:23:33 -08:00
matt debergalis
99d3c6cdf5 cache bundled CSS and JS forever 2012-02-09 14:08:38 -08:00
Nick Martin
8def45079a Queue connections while server is restarting. 2012-02-06 23:15:31 -08:00
Nick Martin
4de4bbfd45 Set Content-Type on main page. ServerDensity needs this for some reason. 2012-01-23 23:22:10 -08:00
Nick Martin
459dac9cac Merge branch 'master' into meteor
conflicts hand resolved. deftemplate and liveui reverted to master, will re-do later.

Conflicts:
	admin/generate-dev-bundle.sh
	admin/install-s3.sh
	admin/manifest.json
	app/meteor/deploy.js
	app/meteor/meteor.js
	examples/leaderboard/leaderboard.js
	examples/unfinished/azrael/client/azrael.js
	examples/unfinished/azrael/model.js
	packages/liveui/liveui.js
	packages/templating/deftemplate.js
	packages/templating/html_scanner.js
	tests/minimongo/test.html
2012-01-18 16:14:54 -08:00
Nick Martin
5312de215f Actually allow IE6 and 7 like we promised. 2012-01-17 21:10:37 -08:00
Nick Martin
3faff2de78 perl -pi -e 's/Sky/Meteor/g' **/* 2012-01-04 20:52:46 -08:00
Nick Martin
05794f5643 perl -pi -e 's/skybreak/meteor/g' **/* 2012-01-04 18:32:23 -08:00
Nick Martin
918d15afdc Factor socket.io into stream package on the server as well. Much cleaner now. 2011-12-13 13:40:13 -08:00
Geoff Schmidt
ce565dcaea kill basics package 2011-12-07 22:28:43 -08:00
Nick Martin
282346ee11 Serve a separate HTML page to unsupported browsers. Still needs styling. 2011-12-06 22:46:40 -08:00
Nick Martin
f57b6e1bd6 Make keepalives opt-in, instead of on by default. Turn them on in dev mode. 2011-11-29 22:18:51 -08:00
Nick Martin
d69c2d1f19 Initial import from old busted repo. 2011-11-17 18:35:20 -08:00