Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial addition of the sample files, volo directory structure, web f…

…iles in www
  • Loading branch information...
commit 36a6716d4dcbbc5dc648fe5aa6d14781fb2cbfa1 0 parents
Chris Mills authored
Showing with 27,522 additions and 0 deletions.
  1. +45 −0 .gitignore
  2. +21 −0 README.md
  3. +12 −0 node_modules/connect/.npmignore
  4. +24 −0 node_modules/connect/LICENSE
  5. +4 −0 node_modules/connect/index.js
  6. +81 −0 node_modules/connect/lib/cache.js
  7. +93 −0 node_modules/connect/lib/connect.js
  8. +50 −0 node_modules/connect/lib/index.js
  9. +101 −0 node_modules/connect/lib/middleware/basicAuth.js
  10. +61 −0 node_modules/connect/lib/middleware/bodyParser.js
  11. +142 −0 node_modules/connect/lib/middleware/compress.js
  12. +62 −0 node_modules/connect/lib/middleware/cookieParser.js
  13. +118 −0 node_modules/connect/lib/middleware/cookieSession.js
  14. +73 −0 node_modules/connect/lib/middleware/csrf.js
  15. +229 −0 node_modules/connect/lib/middleware/directory.js
  16. +87 −0 node_modules/connect/lib/middleware/errorHandler.js
  17. +81 −0 node_modules/connect/lib/middleware/favicon.js
  18. +80 −0 node_modules/connect/lib/middleware/json.js
  19. +55 −0 node_modules/connect/lib/middleware/limit.js
  20. +337 −0 node_modules/connect/lib/middleware/logger.js
  21. +40 −0 node_modules/connect/lib/middleware/methodOverride.js
  22. +120 −0 node_modules/connect/lib/middleware/multipart.js
  23. +46 −0 node_modules/connect/lib/middleware/query.js
  24. +32 −0 node_modules/connect/lib/middleware/responseTime.js
  25. +344 −0 node_modules/connect/lib/middleware/session.js
  26. +128 −0 node_modules/connect/lib/middleware/session/cookie.js
  27. +131 −0 node_modules/connect/lib/middleware/session/memory.js
  28. +116 −0 node_modules/connect/lib/middleware/session/session.js
  29. +86 −0 node_modules/connect/lib/middleware/session/store.js
  30. +94 −0 node_modules/connect/lib/middleware/static.js
  31. +234 −0 node_modules/connect/lib/middleware/staticCache.js
  32. +45 −0 node_modules/connect/lib/middleware/timeout.js
  33. +76 −0 node_modules/connect/lib/middleware/urlencoded.js
  34. +40 −0 node_modules/connect/lib/middleware/vhost.js
  35. +79 −0 node_modules/connect/lib/patch.js
  36. +230 −0 node_modules/connect/lib/proto.js
  37. +75 −0 node_modules/connect/lib/public/directory.html
  38. +13 −0 node_modules/connect/lib/public/error.html
  39. BIN  node_modules/connect/lib/public/favicon.ico
  40. BIN  node_modules/connect/lib/public/icons/page.png
  41. BIN  node_modules/connect/lib/public/icons/page_add.png
  42. BIN  node_modules/connect/lib/public/icons/page_attach.png
  43. BIN  node_modules/connect/lib/public/icons/page_code.png
  44. BIN  node_modules/connect/lib/public/icons/page_copy.png
  45. BIN  node_modules/connect/lib/public/icons/page_delete.png
  46. BIN  node_modules/connect/lib/public/icons/page_edit.png
  47. BIN  node_modules/connect/lib/public/icons/page_error.png
  48. BIN  node_modules/connect/lib/public/icons/page_excel.png
  49. BIN  node_modules/connect/lib/public/icons/page_find.png
  50. BIN  node_modules/connect/lib/public/icons/page_gear.png
  51. BIN  node_modules/connect/lib/public/icons/page_go.png
  52. BIN  node_modules/connect/lib/public/icons/page_green.png
  53. BIN  node_modules/connect/lib/public/icons/page_key.png
  54. BIN  node_modules/connect/lib/public/icons/page_lightning.png
  55. BIN  node_modules/connect/lib/public/icons/page_link.png
  56. BIN  node_modules/connect/lib/public/icons/page_paintbrush.png
  57. BIN  node_modules/connect/lib/public/icons/page_paste.png
  58. BIN  node_modules/connect/lib/public/icons/page_red.png
  59. BIN  node_modules/connect/lib/public/icons/page_refresh.png
  60. BIN  node_modules/connect/lib/public/icons/page_save.png
  61. BIN  node_modules/connect/lib/public/icons/page_white.png
  62. BIN  node_modules/connect/lib/public/icons/page_white_acrobat.png
  63. BIN  node_modules/connect/lib/public/icons/page_white_actionscript.png
  64. BIN  node_modules/connect/lib/public/icons/page_white_add.png
  65. BIN  node_modules/connect/lib/public/icons/page_white_c.png
  66. BIN  node_modules/connect/lib/public/icons/page_white_camera.png
  67. BIN  node_modules/connect/lib/public/icons/page_white_cd.png
  68. BIN  node_modules/connect/lib/public/icons/page_white_code.png
  69. BIN  node_modules/connect/lib/public/icons/page_white_code_red.png
  70. BIN  node_modules/connect/lib/public/icons/page_white_coldfusion.png
  71. BIN  node_modules/connect/lib/public/icons/page_white_compressed.png
  72. BIN  node_modules/connect/lib/public/icons/page_white_copy.png
  73. BIN  node_modules/connect/lib/public/icons/page_white_cplusplus.png
  74. BIN  node_modules/connect/lib/public/icons/page_white_csharp.png
  75. BIN  node_modules/connect/lib/public/icons/page_white_cup.png
  76. BIN  node_modules/connect/lib/public/icons/page_white_database.png
  77. BIN  node_modules/connect/lib/public/icons/page_white_delete.png
  78. BIN  node_modules/connect/lib/public/icons/page_white_dvd.png
  79. BIN  node_modules/connect/lib/public/icons/page_white_edit.png
  80. BIN  node_modules/connect/lib/public/icons/page_white_error.png
  81. BIN  node_modules/connect/lib/public/icons/page_white_excel.png
  82. BIN  node_modules/connect/lib/public/icons/page_white_find.png
  83. BIN  node_modules/connect/lib/public/icons/page_white_flash.png
  84. BIN  node_modules/connect/lib/public/icons/page_white_freehand.png
  85. BIN  node_modules/connect/lib/public/icons/page_white_gear.png
  86. BIN  node_modules/connect/lib/public/icons/page_white_get.png
  87. BIN  node_modules/connect/lib/public/icons/page_white_go.png
  88. BIN  node_modules/connect/lib/public/icons/page_white_h.png
  89. BIN  node_modules/connect/lib/public/icons/page_white_horizontal.png
  90. BIN  node_modules/connect/lib/public/icons/page_white_key.png
  91. BIN  node_modules/connect/lib/public/icons/page_white_lightning.png
  92. BIN  node_modules/connect/lib/public/icons/page_white_link.png
  93. BIN  node_modules/connect/lib/public/icons/page_white_magnify.png
  94. BIN  node_modules/connect/lib/public/icons/page_white_medal.png
  95. BIN  node_modules/connect/lib/public/icons/page_white_office.png
  96. BIN  node_modules/connect/lib/public/icons/page_white_paint.png
  97. BIN  node_modules/connect/lib/public/icons/page_white_paintbrush.png
  98. BIN  node_modules/connect/lib/public/icons/page_white_paste.png
  99. BIN  node_modules/connect/lib/public/icons/page_white_php.png
  100. BIN  node_modules/connect/lib/public/icons/page_white_picture.png
  101. BIN  node_modules/connect/lib/public/icons/page_white_powerpoint.png
  102. BIN  node_modules/connect/lib/public/icons/page_white_put.png
  103. BIN  node_modules/connect/lib/public/icons/page_white_ruby.png
  104. BIN  node_modules/connect/lib/public/icons/page_white_stack.png
  105. BIN  node_modules/connect/lib/public/icons/page_white_star.png
  106. BIN  node_modules/connect/lib/public/icons/page_white_swoosh.png
  107. BIN  node_modules/connect/lib/public/icons/page_white_text.png
  108. BIN  node_modules/connect/lib/public/icons/page_white_text_width.png
  109. BIN  node_modules/connect/lib/public/icons/page_white_tux.png
  110. BIN  node_modules/connect/lib/public/icons/page_white_vector.png
  111. BIN  node_modules/connect/lib/public/icons/page_white_visualstudio.png
  112. BIN  node_modules/connect/lib/public/icons/page_white_width.png
  113. BIN  node_modules/connect/lib/public/icons/page_white_word.png
  114. BIN  node_modules/connect/lib/public/icons/page_white_world.png
  115. BIN  node_modules/connect/lib/public/icons/page_white_wrench.png
  116. BIN  node_modules/connect/lib/public/icons/page_white_zip.png
  117. BIN  node_modules/connect/lib/public/icons/page_word.png
  118. BIN  node_modules/connect/lib/public/icons/page_world.png
  119. +141 −0 node_modules/connect/lib/public/style.css
  120. +373 −0 node_modules/connect/lib/utils.js
  121. +1 −0  node_modules/connect/node_modules/bytes/.npmignore
  122. +5 −0 node_modules/connect/node_modules/bytes/History.md
  123. +7 −0 node_modules/connect/node_modules/bytes/Makefile
  124. +51 −0 node_modules/connect/node_modules/bytes/Readme.md
  125. +7 −0 node_modules/connect/node_modules/bytes/component.json
  126. +39 −0 node_modules/connect/node_modules/bytes/index.js
  127. +35 −0 node_modules/connect/node_modules/bytes/package.json
  128. +1 −0  node_modules/connect/node_modules/cookie/.npmignore
  129. +3 −0  node_modules/connect/node_modules/cookie/.travis.yml
  130. +44 −0 node_modules/connect/node_modules/cookie/README.md
  131. +57 −0 node_modules/connect/node_modules/cookie/index.js
  132. +39 −0 node_modules/connect/node_modules/cookie/package.json
  133. +1 −0  node_modules/connect/node_modules/cookie/test/mocha.opts
  134. +25 −0 node_modules/connect/node_modules/cookie/test/parse.js
  135. +59 −0 node_modules/connect/node_modules/cookie/test/serialize.js
  136. +3 −0  node_modules/connect/node_modules/crc/.gitmodules
  137. +1 −0  node_modules/connect/node_modules/crc/.npmignore
  138. +7 −0 node_modules/connect/node_modules/crc/Makefile
  139. +31 −0 node_modules/connect/node_modules/crc/README.md
  140. +403 −0 node_modules/connect/node_modules/crc/lib/crc.js
  141. +36 −0 node_modules/connect/node_modules/crc/package.json
  142. +63 −0 node_modules/connect/node_modules/crc/test/crc.js
  143. +4 −0 node_modules/connect/node_modules/debug/.npmignore
  144. +47 −0 node_modules/connect/node_modules/debug/History.md
  145. +4 −0 node_modules/connect/node_modules/debug/Makefile
  146. +130 −0 node_modules/connect/node_modules/debug/Readme.md
  147. +120 −0 node_modules/connect/node_modules/debug/debug.component.js
  148. +116 −0 node_modules/connect/node_modules/debug/debug.js
  149. +19 −0 node_modules/connect/node_modules/debug/example/app.js
  150. +24 −0 node_modules/connect/node_modules/debug/example/browser.html
  151. +10 −0 node_modules/connect/node_modules/debug/example/wildcards.js
  152. +22 −0 node_modules/connect/node_modules/debug/example/worker.js
  153. +1 −0  node_modules/connect/node_modules/debug/head.js
  154. +2 −0  node_modules/connect/node_modules/debug/index.js
  155. +135 −0 node_modules/connect/node_modules/debug/lib/debug.js
  156. +39 −0 node_modules/connect/node_modules/debug/package.json
  157. +4 −0 node_modules/connect/node_modules/debug/tail.js
  158. +4 −0 node_modules/connect/node_modules/formidable/.npmignore
  159. +4 −0 node_modules/connect/node_modules/formidable/.travis.yml
  160. +14 −0 node_modules/connect/node_modules/formidable/Makefile
  161. +311 −0 node_modules/connect/node_modules/formidable/Readme.md
  162. +3 −0  node_modules/connect/node_modules/formidable/TODO
  163. +70 −0 node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
  164. +43 −0 node_modules/connect/node_modules/formidable/example/post.js
  165. +48 −0 node_modules/connect/node_modules/formidable/example/upload.js
  166. +1 −0  node_modules/connect/node_modules/formidable/index.js
  167. +73 −0 node_modules/connect/node_modules/formidable/lib/file.js
  168. +384 −0 node_modules/connect/node_modules/formidable/lib/incoming_form.js
  169. +3 −0  node_modules/connect/node_modules/formidable/lib/index.js
  170. +312 −0 node_modules/connect/node_modules/formidable/lib/multipart_parser.js
  171. +25 −0 node_modules/connect/node_modules/formidable/lib/querystring_parser.js
  172. +6 −0 node_modules/connect/node_modules/formidable/lib/util.js
  173. +4 −0 node_modules/connect/node_modules/formidable/node-gently/Makefile
  174. +167 −0 node_modules/connect/node_modules/formidable/node-gently/Readme.md
  175. +22 −0 node_modules/connect/node_modules/formidable/node-gently/example/dog.js
  176. +11 −0 node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js
  177. +1 −0  node_modules/connect/node_modules/formidable/node-gently/index.js
  178. +184 −0 node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js
  179. +1 −0  node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js
  180. +14 −0 node_modules/connect/node_modules/formidable/node-gently/package.json
  181. +8 −0 node_modules/connect/node_modules/formidable/node-gently/test/common.js
  182. +348 −0 node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js
  183. +33 −0 node_modules/connect/node_modules/formidable/package.json
  184. +19 −0 node_modules/connect/node_modules/formidable/test/common.js
  185. +1 −0  node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
  186. +1 −0  node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
  187. +3 −0  node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
  188. +3 −0  node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
  189. +21 −0 node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
  190. +72 −0 node_modules/connect/node_modules/formidable/test/fixture/multipart.js
  191. +89 −0 node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
  192. +24 −0 node_modules/connect/node_modules/formidable/test/legacy/common.js
  193. +80 −0 node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
  194. +104 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
  195. +727 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
  196. +50 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
  197. +45 −0 node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
  198. +75 −0 node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
  199. +2 −0  node_modules/connect/node_modules/formidable/test/run.js
  200. +63 −0 node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
  201. +47 −0 node_modules/connect/node_modules/formidable/tool/record.js
  202. +1 −0  node_modules/connect/node_modules/fresh/.npmignore
  203. +7 −0 node_modules/connect/node_modules/fresh/Makefile
  204. +32 −0 node_modules/connect/node_modules/fresh/Readme.md
  205. +49 −0 node_modules/connect/node_modules/fresh/index.js
  206. +30 −0 node_modules/connect/node_modules/fresh/package.json
  207. +4 −0 node_modules/connect/node_modules/pause/.npmignore
  208. +5 −0 node_modules/connect/node_modules/pause/History.md
  209. +7 −0 node_modules/connect/node_modules/pause/Makefile
  210. +29 −0 node_modules/connect/node_modules/pause/Readme.md
  211. +29 −0 node_modules/connect/node_modules/pause/index.js
  212. +30 −0 node_modules/connect/node_modules/pause/package.json
  213. +6 −0 node_modules/connect/node_modules/qs/.gitmodules
  214. +1 −0  node_modules/connect/node_modules/qs/.npmignore
  215. +4 −0 node_modules/connect/node_modules/qs/.travis.yml
  216. +73 −0 node_modules/connect/node_modules/qs/History.md
  217. +5 −0 node_modules/connect/node_modules/qs/Makefile
  218. +54 −0 node_modules/connect/node_modules/qs/Readme.md
  219. +17 −0 node_modules/connect/node_modules/qs/benchmark.js
  220. +51 −0 node_modules/connect/node_modules/qs/examples.js
  221. +2 −0  node_modules/connect/node_modules/qs/index.js
  222. +264 −0 node_modules/connect/node_modules/qs/lib/querystring.js
  223. +34 −0 node_modules/connect/node_modules/qs/package.json
  224. +2 −0  node_modules/connect/node_modules/qs/test/mocha.opts
  225. +167 −0 node_modules/connect/node_modules/qs/test/parse.js
  226. +103 −0 node_modules/connect/node_modules/qs/test/stringify.js
  227. +4 −0 node_modules/connect/node_modules/send/.npmignore
  228. +20 −0 node_modules/connect/node_modules/send/History.md
  229. +8 −0 node_modules/connect/node_modules/send/Makefile
  230. +123 −0 node_modules/connect/node_modules/send/Readme.md
  231. +2 −0  node_modules/connect/node_modules/send/index.js
  232. +462 −0 node_modules/connect/node_modules/send/lib/send.js
  233. +47 −0 node_modules/connect/node_modules/send/lib/utils.js
  234. +19 −0 node_modules/connect/node_modules/send/node_modules/mime/LICENSE
  235. +63 −0 node_modules/connect/node_modules/send/node_modules/mime/README.md
  236. +104 −0 node_modules/connect/node_modules/send/node_modules/mime/mime.js
  237. +42 −0 node_modules/connect/node_modules/send/node_modules/mime/package.json
  238. +55 −0 node_modules/connect/node_modules/send/node_modules/mime/test.js
  239. +1,510 −0 node_modules/connect/node_modules/send/node_modules/mime/types/mime.types
  240. +65 −0 node_modules/connect/node_modules/send/node_modules/mime/types/node.types
  241. +1 −0  node_modules/connect/node_modules/send/node_modules/range-parser/.npmignore
  242. +15 −0 node_modules/connect/node_modules/send/node_modules/range-parser/History.md
  243. +7 −0 node_modules/connect/node_modules/send/node_modules/range-parser/Makefile
  244. +28 −0 node_modules/connect/node_modules/send/node_modules/range-parser/Readme.md
  245. +49 −0 node_modules/connect/node_modules/send/node_modules/range-parser/index.js
  246. +30 −0 node_modules/connect/node_modules/send/node_modules/range-parser/package.json
  247. +44 −0 node_modules/connect/node_modules/send/package.json
  248. +53 −0 node_modules/connect/package.json
  249. +11 −0 node_modules/connect/test.js
  250. +1 −0  node_modules/less-middleware/.npmignore
  251. +263 −0 node_modules/less-middleware/lib/middleware.js
  252. +1 −0  node_modules/less-middleware/node_modules/.bin/lessc
  253. +2 −0  node_modules/less-middleware/node_modules/less/.npmignore
  254. +26 −0 node_modules/less-middleware/node_modules/less/CHANGELOG
  255. +179 −0 node_modules/less-middleware/node_modules/less/LICENSE
  256. +75 −0 node_modules/less-middleware/node_modules/less/Makefile
  257. +20 −0 node_modules/less-middleware/node_modules/less/README.md
  258. +47 −0 node_modules/less-middleware/node_modules/less/benchmark/less-benchmark.js
  259. +139 −0 node_modules/less-middleware/node_modules/less/bin/lessc
  260. +2,695 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.0.js
  261. +16 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.0.min.js
  262. +2,710 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.1.js
  263. +16 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.1.min.js
  264. +2,712 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.2.js
  265. +16 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.2.min.js
  266. +2,721 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.3.js
  267. +16 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.3.min.js
  268. +2,769 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.4.js
  269. +16 −0 node_modules/less-middleware/node_modules/less/dist/less-1.1.4.min.js
Sorry, we could not display the entire diff because too many files (401) changed.
45 .gitignore
@@ -0,0 +1,45 @@
+# Numerous always-ignore extensions
+*.diff
+*.err
+*.orig
+*.log
+*.rej
+*.swo
+*.swp
+*.vi
+*~
+*.sass-cache
+
+# OS or Editor folders
+.DS_Store
+._*
+Thumbs.db
+.cache
+.project
+.settings
+.tmproj
+nbproject
+*.sublime-project
+*.sublime-workspace
+
+# Espresso
+*.esproj
+*.espressostorage
+
+# Rubinius
+*.rbc
+
+# Folders to ignore
+.hg
+.svn
+.CVS
+intermediate
+publish
+.idea
+
+# build script local files
+build/buildinfo.properties
+build/config/buildinfo.properties
+
+www-built
+www-ghdeploy
21 README.md
@@ -0,0 +1,21 @@
+# A Blank Template for Open Web Apps
+
+The is a minimal template that has a little HTML, CSS, and js to help
+you start writing an Open Web App.
+
+This is part of the [mortar](https://github.com/mozilla/mortar/)
+template collection for building Open Web Apps.
+
+# Usage
+
+There are a few ways to get this template:
+
+* git clone git://github.com/mozilla/mortar-app-stub.git myapp
+* volo create myapp mozilla/mortar-app-stub
+
+If you have node installed, you can run a development server with volo:
+
+1. cd myapp
+2. volo serve
+
+View the app at http://localhost:8008/.
12 node_modules/connect/.npmignore
@@ -0,0 +1,12 @@
+*.markdown
+*.md
+.git*
+Makefile
+benchmarks/
+docs/
+examples/
+install.sh
+support/
+test/
+.DS_Store
+coverage.html
24 node_modules/connect/LICENSE
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2010 Sencha Inc.
+Copyright (c) 2011 LearnBoost
+Copyright (c) 2011 TJ Holowaychuk
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 node_modules/connect/index.js
@@ -0,0 +1,4 @@
+
+module.exports = process.env.CONNECT_COV
+ ? require('./lib-cov/connect')
+ : require('./lib/connect');
81 node_modules/connect/lib/cache.js
@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - Cache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Expose `Cache`.
+ */
+
+module.exports = Cache;
+
+/**
+ * LRU cache store.
+ *
+ * @param {Number} limit
+ * @api private
+ */
+
+function Cache(limit) {
+ this.store = {};
+ this.keys = [];
+ this.limit = limit;
+}
+
+/**
+ * Touch `key`, promoting the object.
+ *
+ * @param {String} key
+ * @param {Number} i
+ * @api private
+ */
+
+Cache.prototype.touch = function(key, i){
+ this.keys.splice(i,1);
+ this.keys.push(key);
+};
+
+/**
+ * Remove `key`.
+ *
+ * @param {String} key
+ * @api private
+ */
+
+Cache.prototype.remove = function(key){
+ delete this.store[key];
+};
+
+/**
+ * Get the object stored for `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.get = function(key){
+ return this.store[key];
+};
+
+/**
+ * Add a cache `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.add = function(key){
+ // initialize store
+ var len = this.keys.push(key);
+
+ // limit reached, invalidate LRU
+ if (len > this.limit) this.remove(this.keys.shift());
+
+ var arr = this.store[key] = [];
+ arr.createdAt = new Date;
+ return arr;
+};
93 node_modules/connect/lib/connect.js
@@ -0,0 +1,93 @@
+
+/*!
+ * Connect
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , proto = require('./proto')
+ , utils = require('./utils')
+ , path = require('path')
+ , basename = path.basename
+ , fs = require('fs');
+
+// node patches
+
+require('./patch');
+
+// expose createServer() as the module
+
+exports = module.exports = createServer;
+
+/**
+ * Framework version.
+ */
+
+exports.version = '2.4.3';
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = require('./middleware/static').mime;
+
+/**
+ * Expose the prototype.
+ */
+
+exports.proto = proto;
+
+/**
+ * Auto-load middleware getters.
+ */
+
+exports.middleware = {};
+
+/**
+ * Expose utilities.
+ */
+
+exports.utils = utils;
+
+/**
+ * Create a new connect server.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createServer() {
+ function app(req, res){ app.handle(req, res); }
+ utils.merge(app, proto);
+ utils.merge(app, EventEmitter.prototype);
+ app.route = '/';
+ app.stack = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ app.use(arguments[i]);
+ }
+ return app;
+};
+
+/**
+ * Support old `.createServer()` method.
+ */
+
+createServer.createServer = createServer;
+
+/**
+ * Auto-load bundled middleware with getters.
+ */
+
+fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
+ if (!/\.js$/.test(filename)) return;
+ var name = basename(filename, '.js');
+ function load(){ return require('./middleware/' + name); }
+ exports.middleware.__defineGetter__(name, load);
+ exports.__defineGetter__(name, load);
+});
50 node_modules/connect/lib/index.js
@@ -0,0 +1,50 @@
+
+/**
+ * Connect is a middleware framework for node,
+ * shipping with over 18 bundled middleware and a rich selection of
+ * 3rd-party middleware.
+ *
+ * var app = connect()
+ * .use(connect.logger('dev'))
+ * .use(connect.static('public'))
+ * .use(function(req, res){
+ * res.end('hello world\n');
+ * })
+ * .listen(3000);
+ *
+ * Installation:
+ *
+ * $ npm install connect
+ *
+ * Middleware:
+ *
+ * - [logger](logger.html) request logger with custom format support
+ * - [timeout](timeout.html) request timeout support
+ * - [csrf](csrf.html) Cross-site request forgery protection
+ * - [compress](compress.html) Gzip compression middleware
+ * - [basicAuth](basicAuth.html) basic http authentication
+ * - [bodyParser](bodyParser.html) extensible request body parser
+ * - [json](json.html) application/json parser
+ * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser
+ * - [multipart](multipart.html) multipart/form-data parser
+ * - [cookieParser](cookieParser.html) cookie parser
+ * - [session](session.html) session management support with bundled MemoryStore
+ * - [cookieSession](cookieSession.html) cookie-based session support
+ * - [methodOverride](methodOverride.html) faux HTTP method support
+ * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time
+ * - [staticCache](staticCache.html) memory cache layer for the static() middleware
+ * - [static](static.html) streaming static file server supporting `Range` and more
+ * - [directory](directory.html) directory listing middleware
+ * - [vhost](vhost.html) virtual host sub-domain mapping middleware
+ * - [favicon](favicon.html) efficient favicon server (with default icon)
+ * - [limit](limit.html) limit the bytesize of request bodies
+ * - [query](query.html) automatic querystring parser, populating `req.query`
+ * - [errorHandler](errorHandler.html) flexible error handler
+ *
+ * Links:
+ *
+ * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware
+ * - GitHub [repository](http://github.com/senchalabs/connect)
+ * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md)
+ *
+ */
101 node_modules/connect/lib/middleware/basicAuth.js
@@ -0,0 +1,101 @@
+
+/*!
+ * Connect - basicAuth
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , unauthorized = utils.unauthorized;
+
+/**
+ * Basic Auth:
+ *
+ * Enfore basic authentication by providing a `callback(user, pass)`,
+ * which must return `true` in order to gain access. Alternatively an async
+ * method is provided as well, invoking `callback(user, pass, callback)`. Populates
+ * `req.user`. The final alternative is simply passing username / password
+ * strings.
+ *
+ * Simple username and password
+ *
+ * connect(connect.basicAuth('username', 'password'));
+ *
+ * Callback verification
+ *
+ * connect()
+ * .use(connect.basicAuth(function(user, pass){
+ * return 'tj' == user & 'wahoo' == pass;
+ * }))
+ *
+ * Async callback verification, accepting `fn(err, user)`.
+ *
+ * connect()
+ * .use(connect.basicAuth(function(user, pass, fn){
+ * User.authenticate({ user: user, pass: pass }, fn);
+ * }))
+ *
+ * @param {Function|String} callback or username
+ * @param {String} realm
+ * @api public
+ */
+
+module.exports = function basicAuth(callback, realm) {
+ var username, password;
+
+ // user / pass strings
+ if ('string' == typeof callback) {
+ username = callback;
+ password = realm;
+ if ('string' != typeof password) throw new Error('password argument required');
+ realm = arguments[2];
+ callback = function(user, pass){
+ return user == username && pass == password;
+ }
+ }
+
+ realm = realm || 'Authorization Required';
+
+ return function(req, res, next) {
+ var authorization = req.headers.authorization;
+
+ if (req.user) return next();
+ if (!authorization) return unauthorized(res, realm);
+
+ var parts = authorization.split(' ')
+
+ if (parts.length !== 2) return next(utils.error(400));
+
+ var scheme = parts[0]
+ , credentials = new Buffer(parts[1], 'base64').toString().split(':')
+ , user = credentials[0]
+ , pass = credentials[1];
+
+ if ('Basic' != scheme) return next(utils.error(400));
+
+ // async
+ if (callback.length >= 3) {
+ var pause = utils.pause(req);
+ callback(user, pass, function(err, user){
+ if (err || !user) return unauthorized(res, realm);
+ req.user = req.remoteUser = user;
+ next();
+ pause.resume();
+ });
+ // sync
+ } else {
+ if (callback(user, pass)) {
+ req.user = req.remoteUser = user;
+ next();
+ } else {
+ unauthorized(res, realm);
+ }
+ }
+ }
+};
+
61 node_modules/connect/lib/middleware/bodyParser.js
@@ -0,0 +1,61 @@
+
+/*!
+ * Connect - bodyParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var multipart = require('./multipart')
+ , urlencoded = require('./urlencoded')
+ , json = require('./json');
+
+/**
+ * Body parser:
+ *
+ * Parse request bodies, supports _application/json_,
+ * _application/x-www-form-urlencoded_, and _multipart/form-data_.
+ *
+ * This is equivalent to:
+ *
+ * app.use(connect.json());
+ * app.use(connect.urlencoded());
+ * app.use(connect.multipart());
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.bodyParser())
+ * .use(function(req, res) {
+ * res.end('viewing user ' + req.body.user.name);
+ * });
+ *
+ * $ curl -d 'user[name]=tj' http://local/
+ * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
+ *
+ * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function bodyParser(options){
+ var _urlencoded = urlencoded(options)
+ , _multipart = multipart(options)
+ , _json = json(options);
+
+ return function bodyParser(req, res, next) {
+ _json(req, res, function(err){
+ if (err) return next(err);
+ _urlencoded(req, res, function(err){
+ if (err) return next(err);
+ _multipart(req, res, next);
+ });
+ });
+ }
+};
142 node_modules/connect/lib/middleware/compress.js
@@ -0,0 +1,142 @@
+/*!
+ * Connect - compress
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var zlib = require('zlib');
+
+/**
+ * Supported content-encoding methods.
+ */
+
+exports.methods = {
+ gzip: zlib.createGzip
+ , deflate: zlib.createDeflate
+};
+
+/**
+ * Default filter function.
+ */
+
+exports.filter = function(req, res){
+ return /json|text|javascript/.test(res.getHeader('Content-Type'));
+};
+
+/**
+ * Compress:
+ *
+ * Compress response data with gzip/deflate.
+ *
+ * Filter:
+ *
+ * A `filter` callback function may be passed to
+ * replace the default logic of:
+ *
+ * exports.filter = function(req, res){
+ * return /json|text|javascript/.test(res.getHeader('Content-Type'));
+ * };
+ *
+ * Options:
+ *
+ * All remaining options are passed to the gzip/deflate
+ * creation functions. Consult node's docs for additional details.
+ *
+ * - `chunkSize` (default: 16*1024)
+ * - `windowBits`
+ * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression
+ * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more
+ * - `strategy`: compression strategy
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function compress(options) {
+ var options = options || {}
+ , names = Object.keys(exports.methods)
+ , filter = options.filter || exports.filter;
+
+ return function(req, res, next){
+ var accept = req.headers['accept-encoding']
+ , write = res.write
+ , end = res.end
+ , stream
+ , method;
+
+ // vary
+ res.setHeader('Vary', 'Accept-Encoding');
+
+ // proxy
+
+ res.write = function(chunk, encoding){
+ if (!this.headerSent) this._implicitHeader();
+ return stream
+ ? stream.write(new Buffer(chunk, encoding))
+ : write.call(res, chunk, encoding);
+ };
+
+ res.end = function(chunk, encoding){
+ if (chunk) this.write(chunk, encoding);
+ return stream
+ ? stream.end()
+ : end.call(res);
+ };
+
+ res.on('header', function(){
+ // default request filter
+ if (!filter(req, res)) return;
+
+ // SHOULD use identity
+ if (!accept) return;
+
+ // head
+ if ('HEAD' == req.method) return;
+
+ // default to gzip
+ if ('*' == accept.trim()) method = 'gzip';
+
+ // compression method
+ if (!method) {
+ for (var i = 0, len = names.length; i < len; ++i) {
+ if (~accept.indexOf(names[i])) {
+ method = names[i];
+ break;
+ }
+ }
+ }
+
+ // compression method
+ if (!method) return;
+
+ // compression stream
+ stream = exports.methods[method](options);
+
+ // header fields
+ res.setHeader('Content-Encoding', method);
+ res.removeHeader('Content-Length');
+
+ // compression
+
+ stream.on('data', function(chunk){
+ write.call(res, chunk);
+ });
+
+ stream.on('end', function(){
+ end.call(res);
+ });
+
+ stream.on('drain', function() {
+ res.emit('drain');
+ });
+ });
+
+ next();
+ };
+}
62 node_modules/connect/lib/middleware/cookieParser.js
@@ -0,0 +1,62 @@
+
+/*!
+ * Connect - cookieParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+ , cookie = require('cookie');
+
+/**
+ * Cookie parser:
+ *
+ * Parse _Cookie_ header and populate `req.cookies`
+ * with an object keyed by the cookie names. Optionally
+ * you may enabled signed cookie support by passing
+ * a `secret` string, which assigns `req.secret` so
+ * it may be used by other middleware.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.cookieParser('optional secret string'))
+ * .use(function(req, res, next){
+ * res.end(JSON.stringify(req.cookies));
+ * })
+ *
+ * @param {String} secret
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieParser(secret){
+ return function cookieParser(req, res, next) {
+ if (req.cookies) return next();
+ var cookies = req.headers.cookie;
+
+ req.secret = secret;
+ req.cookies = {};
+ req.signedCookies = {};
+
+ if (cookies) {
+ try {
+ req.cookies = cookie.parse(cookies);
+ if (secret) {
+ req.signedCookies = utils.parseSignedCookies(req.cookies, secret);
+ var obj = utils.parseJSONCookies(req.signedCookies);
+ req.signedCookies = obj;
+ }
+ req.cookies = utils.parseJSONCookies(req.cookies);
+ } catch (err) {
+ return next(err);
+ }
+ }
+ next();
+ };
+};
118 node_modules/connect/lib/middleware/cookieSession.js
@@ -0,0 +1,118 @@
+
+/*!
+ * Connect - cookieSession
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+ , Cookie = require('./session/cookie')
+ , debug = require('debug')('connect:cookieSession')
+ , crc16 = require('crc').crc16;
+
+// environment
+
+var env = process.env.NODE_ENV;
+
+/**
+ * Cookie Session:
+ *
+ * Cookie session middleware.
+ *
+ * var app = connect();
+ * app.use(connect.cookieParser());
+ * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));
+ *
+ * Options:
+ *
+ * - `key` cookie name defaulting to `connect.sess`
+ * - `secret` prevents cookie tampering
+ * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Clearing sessions:
+ *
+ * To clear the session simply set its value to `null`,
+ * `cookieSession()` will then respond with a 1970 Set-Cookie.
+ *
+ * req.session = null;
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieSession(options){
+ // TODO: utilize Session/Cookie to unify API
+ var options = options || {}
+ , key = options.key || 'connect.sess'
+ , trustProxy = options.proxy;
+
+ return function cookieSession(req, res, next) {
+
+ // req.secret is for backwards compatibility
+ var secret = options.secret || req.secret;
+ if (!secret) throw new Error('`secret` option required for cookie sessions');
+
+ // default session
+ req.session = {};
+ var cookie = req.session.cookie = new Cookie(options.cookie);
+
+ // pathname mismatch
+ if (0 != req.originalUrl.indexOf(cookie.path)) return next();
+
+ // cookieParser secret
+ if (!options.secret && req.secret) {
+ req.session = req.signedCookies[key] || {};
+ } else {
+ // TODO: refactor
+ var rawCookie = req.cookies[key];
+ if (rawCookie) {
+ var unsigned = utils.parseSignedCookie(rawCookie, secret);
+ if (unsigned) {
+ var originalHash = crc16(unsigned);
+ req.session = utils.parseJSONCookie(unsigned) || {};
+ }
+ }
+ }
+
+ res.on('header', function(){
+ // removed
+ if (!req.session) {
+ debug('clear session');
+ cookie.expires = new Date(0);
+ res.setHeader('Set-Cookie', cookie.serialize(key, ''));
+ return;
+ }
+
+ delete req.session.cookie;
+
+ // check security
+ var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
+ , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
+ , secured = cookie.secure && tls;
+
+ // only send secure cookies via https
+ if (cookie.secure && !secured) return debug('not secured');
+
+ // serialize
+ debug('serializing %j', req.session);
+ var val = 'j:' + JSON.stringify(req.session);
+
+ // compare hashes, no need to set-cookie if unchanged
+ if (originalHash == crc16(val)) return debug('unmodified session');
+
+ // set-cookie
+ val = 's:' + utils.sign(val, secret);
+ val = cookie.serialize(key, val);
+ debug('set-cookie %j', cookie);
+ res.setHeader('Set-Cookie', val);
+ });
+
+ next();
+ };
+};
73 node_modules/connect/lib/middleware/csrf.js
@@ -0,0 +1,73 @@
+/*!
+ * Connect - csrf
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Anti CSRF:
+ *
+ * CRSF protection middleware.
+ *
+ * By default this middleware generates a token named "_csrf"
+ * which should be added to requests which mutate
+ * state, within a hidden form field, query-string etc. This
+ * token is validated against the visitor's `req.session._csrf`
+ * property.
+ *
+ * The default `value` function checks `req.body` generated
+ * by the `bodyParser()` middleware, `req.query` generated
+ * by `query()`, and the "X-CSRF-Token" header field.
+ *
+ * This middleware requires session support, thus should be added
+ * somewhere _below_ `session()` and `cookieParser()`.
+ *
+ * Options:
+ *
+ * - `value` a function accepting the request, returning the token
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+module.exports = function csrf(options) {
+ var options = options || {}
+ , value = options.value || defaultValue;
+
+ return function(req, res, next){
+ // generate CSRF token
+ var token = req.session._csrf || (req.session._csrf = utils.uid(24));
+
+ // ignore these methods
+ if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();
+
+ // determine value
+ var val = value(req);
+
+ // check
+ if (val != token) return next(utils.error(403));
+
+ next();
+ }
+};
+
+/**
+ * Default value function, checking the `req.body`
+ * and `req.query` for the CSRF token.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+function defaultValue(req) {
+ return (req.body && req.body._csrf)
+ || (req.query && req.query._csrf)
+ || (req.headers['x-csrf-token']);
+}
229 node_modules/connect/lib/middleware/directory.js
@@ -0,0 +1,229 @@
+
+/*!
+ * Connect - directory
+ * Copyright(c) 2011 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+// TODO: icon / style for directories
+// TODO: arrow key navigation
+// TODO: make icons extensible
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+ , parse = require('url').parse
+ , utils = require('../utils')
+ , path = require('path')
+ , normalize = path.normalize
+ , extname = path.extname
+ , join = path.join;
+
+/*!
+ * Icon cache.
+ */
+
+var cache = {};
+
+/**
+ * Directory:
+ *
+ * Serve directory listings with the given `root` path.
+ *
+ * Options:
+ *
+ * - `hidden` display hidden (dot) files. Defaults to false.
+ * - `icons` display icons. Defaults to false.
+ * - `filter` Apply this filter function to files. Defaults to false.
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function directory(root, options){
+ options = options || {};
+
+ // root required
+ if (!root) throw new Error('directory() root path required');
+ var hidden = options.hidden
+ , icons = options.icons
+ , filter = options.filter
+ , root = normalize(root);
+
+ return function directory(req, res, next) {
+ if ('GET' != req.method && 'HEAD' != req.method) return next();
+
+ var accept = req.headers.accept || 'text/plain'
+ , url = parse(req.url)
+ , dir = decodeURIComponent(url.pathname)
+ , path = normalize(join(root, dir))
+ , originalUrl = parse(req.originalUrl)
+ , originalDir = decodeURIComponent(originalUrl.pathname)
+ , showUp = path != root && path != root + '/';
+
+ // null byte(s), bad request
+ if (~path.indexOf('\0')) return next(utils.error(400));
+
+ // malicious path, forbidden
+ if (0 != path.indexOf(root)) return next(utils.error(403));
+
+ // check if we have a directory
+ fs.stat(path, function(err, stat){
+ if (err) return 'ENOENT' == err.code
+ ? next()
+ : next(err);
+
+ if (!stat.isDirectory()) return next();
+
+ // fetch files
+ fs.readdir(path, function(err, files){
+ if (err) return next(err);
+ if (!hidden) files = removeHidden(files);
+ if (filter) files = files.filter(filter);
+ files.sort();
+
+ // content-negotiation
+ for (var key in exports) {
+ if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {
+ exports[key](req, res, files, next, originalDir, showUp, icons);
+ return;
+ }
+ }
+
+ // not acceptable
+ next(utils.error(406));
+ });
+ });
+ };
+};
+
+/**
+ * Respond with text/html.
+ */
+
+exports.html = function(req, res, files, next, dir, showUp, icons){
+ fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){
+ if (err) return next(err);
+ fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){
+ if (err) return next(err);
+ if (showUp) files.unshift('..');
+ str = str
+ .replace('{style}', style)
+ .replace('{files}', html(files, dir, icons))
+ .replace('{directory}', dir)
+ .replace('{linked-path}', htmlPath(dir));
+ res.setHeader('Content-Type', 'text/html');
+ res.setHeader('Content-Length', str.length);
+ res.end(str);
+ });
+ });
+};
+
+/**
+ * Respond with application/json.
+ */
+
+exports.json = function(req, res, files){
+ files = JSON.stringify(files);
+ res.setHeader('Content-Type', 'application/json');
+ res.setHeader('Content-Length', files.length);
+ res.end(files);
+};
+
+/**
+ * Respond with text/plain.
+ */
+
+exports.plain = function(req, res, files){
+ files = files.join('\n') + '\n';
+ res.setHeader('Content-Type', 'text/plain');
+ res.setHeader('Content-Length', files.length);
+ res.end(files);
+};
+
+/**
+ * Map html `dir`, returning a linked path.
+ */
+
+function htmlPath(dir) {
+ var curr = [];
+ return dir.split('/').map(function(part){
+ curr.push(part);
+ return '<a href="' + curr.join('/') + '">' + part + '</a>';
+ }).join(' / ');
+}
+
+/**
+ * Map html `files`, returning an html unordered list.
+ */
+
+function html(files, dir, useIcons) {
+ return '<ul id="files">' + files.map(function(file){
+ var icon = ''
+ , classes = [];
+
+ if (useIcons && '..' != file) {
+ icon = icons[extname(file)] || icons.default;
+ icon = '<img src="data:image/png;base64,' + load(icon) + '" />';
+ classes.push('icon');
+ }
+
+ return '<li><a href="'
+ + join(dir, file)
+ + '" class="'
+ + classes.join(' ') + '"'
+ + ' title="' + file + '">'
+ + icon + file + '</a></li>';
+
+ }).join('\n') + '</ul>';
+}
+
+/**
+ * Load and cache the given `icon`.
+ *
+ * @param {String} icon
+ * @return {String}
+ * @api private
+ */
+
+function load(icon) {
+ if (cache[icon]) return cache[icon];
+ return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
+}
+
+/**
+ * Filter "hidden" `files`, aka files
+ * beginning with a `.`.
+ *
+ * @param {Array} files
+ * @return {Array}
+ * @api private
+ */
+
+function removeHidden(files) {
+ return files.filter(function(file){
+ return '.' != file[0];
+ });
+}
+
+/**
+ * Icon map.
+ */
+
+var icons = {
+ '.js': 'page_white_code_red.png'
+ , '.c': 'page_white_c.png'
+ , '.h': 'page_white_h.png'
+ , '.cc': 'page_white_cplusplus.png'
+ , '.php': 'page_white_php.png'
+ , '.rb': 'page_white_ruby.png'
+ , '.cpp': 'page_white_cplusplus.png'
+ , '.swf': 'page_white_flash.png'
+ , '.pdf': 'page_white_acrobat.png'
+ , 'default': 'page_white.png'
+};
87 node_modules/connect/lib/middleware/errorHandler.js
@@ -0,0 +1,87 @@
+/*!
+ * Connect - errorHandler
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , url = require('url')
+ , fs = require('fs');
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Error handler:
+ *
+ * Development error handler, providing stack traces
+ * and error message responses for requests accepting text, html,
+ * or json.
+ *
+ * Text:
+ *
+ * By default, and when _text/plain_ is accepted a simple stack trace
+ * or error message will be returned.
+ *
+ * JSON:
+ *
+ * When _application/json_ is accepted, connect will respond with
+ * an object in the form of `{ "error": error }`.
+ *
+ * HTML:
+ *
+ * When accepted connect will output a nice html stack trace.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function errorHandler(){
+ return function errorHandler(err, req, res, next){
+ if (err.status) res.statusCode = err.status;
+ if (res.statusCode < 400) res.statusCode = 500;
+ if ('test' != env) console.error(err.stack);
+ var accept = req.headers.accept || '';
+ // html
+ if (~accept.indexOf('html')) {
+ fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
+ fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
+ var stack = (err.stack || '')
+ .split('\n').slice(1)
+ .map(function(v){ return '<li>' + v + '</li>'; }).join('');
+ html = html
+ .replace('{style}', style)
+ .replace('{stack}', stack)
+ .replace('{title}', exports.title)
+ .replace('{statusCode}', res.statusCode)
+ .replace(/\{error\}/g, utils.escape(err.toString()));
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
+ res.end(html);
+ });
+ });
+ // json
+ } else if (~accept.indexOf('json')) {
+ var error = { message: err.message, stack: err.stack };
+ for (var prop in err) error[prop] = err[prop];
+ var json = JSON.stringify({ error: error });
+ res.setHeader('Content-Type', 'application/json');
+ res.end(json);
+ // plain text
+ } else {
+ res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
+ res.end(err.stack);
+ }
+ };
+};
+
+/**
+ * Template title, framework authors may override this value.
+ */
+
+exports.title = 'Connect';
81 node_modules/connect/lib/middleware/favicon.js
@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - favicon
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+ , utils = require('../utils');
+
+/**
+ * Favicon:
+ *
+ * By default serves the connect favicon, or the favicon
+ * located by the given `path`.
+ *
+ * Options:
+ *
+ * - `maxAge` cache-control max-age directive, defaulting to 1 day
+ *
+ * Examples:
+ *
+ * Serve default favicon:
+ *
+ * connect()
+ * .use(connect.favicon())
+ *
+ * Serve favicon before logging for brevity:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.logger('dev'))
+ *
+ * Serve custom favicon:
+ *
+ * connect()
+ * .use(connect.favicon('public/favicon.ico))
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function favicon(path, options){
+ var options = options || {}
+ , path = path || __dirname + '/../public/favicon.ico'
+ , maxAge = options.maxAge || 86400000
+ , icon; // favicon cache
+
+ return function favicon(req, res, next){
+ if ('/favicon.ico' == req.url) {
+ if (icon) {
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ } else {
+ fs.readFile(path, function(err, buf){
+ if (err) return next(err);
+ icon = {
+ headers: {
+ 'Content-Type': 'image/x-icon'
+ , 'Content-Length': buf.length
+ , 'ETag': '"' + utils.md5(buf) + '"'
+ , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)
+ },
+ body: buf
+ };
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ });
+ }
+ } else {
+ next();
+ }
+ };
+};
80 node_modules/connect/lib/middleware/json.js
@@ -0,0 +1,80 @@
+
+/*!
+ * Connect - json
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , _limit = require('./limit');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * JSON:
+ *
+ * Parse JSON request bodies, providing the
+ * parsed object as `req.body`.
+ *
+ * Options:
+ *
+ * - `strict` when `false` anything `JSON.parse()` accepts will be parsed
+ * - `reviver` used as the second "reviver" argument for JSON.parse
+ * - `limit` byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ var options = options || {}
+ , strict = options.strict === false
+ ? false
+ : true;
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function json(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+
+ // check Content-Type
+ if ('application/json' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+ var buf = '';
+ req.setEncoding('utf8');
+ req.on('data', function(chunk){ buf += chunk });
+ req.on('end', function(){
+ if (strict && '{' != buf[0] && '[' != buf[0]) return next(utils.error(400, 'invalid json'));
+ try {
+ req.body = JSON.parse(buf, options.reviver);
+ next();
+ } catch (err){
+ err.body = buf;
+ err.status = 400;
+ next(err);
+ }
+ });
+ });
+ }
+};
55 node_modules/connect/lib/middleware/limit.js
@@ -0,0 +1,55 @@
+
+/*!
+ * Connect - limit
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Limit:
+ *
+ * Limit request bodies to the given size in `bytes`.
+ *
+ * A string representation of the bytesize may also be passed,
+ * for example "5mb", "200kb", "1gb", etc.
+ *
+ * connect()
+ * .use(connect.limit('5.5mb'))
+ * .use(handleImageUpload)
+ *
+ * @param {Number|String} bytes
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function limit(bytes){
+ if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);
+ if ('number' != typeof bytes) throw new Error('limit() bytes required');
+ return function limit(req, res, next){
+ var received = 0
+ , len = req.headers['content-length']
+ ? parseInt(req.headers['content-length'], 10)
+ : null;
+
+ // self-awareness
+ if (req._limit) return next();
+ req._limit = true;
+
+ // limit by content-length
+ if (len && len > bytes) return next(utils.error(413));
+
+ // limit
+ req.on('data', function(chunk){
+ received += chunk.length;
+ if (received > bytes) req.destroy();
+ });
+
+ next();
+ };
+};
337 node_modules/connect/lib/middleware/logger.js
@@ -0,0 +1,337 @@
+
+/*!
+ * Connect - logger
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var bytes = require('bytes');
+
+/*!
+ * Log buffer.
+ */
+
+var buf = [];
+
+/*!
+ * Default log buffer duration.
+ */
+
+var defaultBufferDuration = 1000;
+
+/**
+ * Logger:
+ *
+ * Log requests with the given `options` or a `format` string.
+ *
+ * Options:
+ *
+ * - `format` Format string, see below for tokens
+ * - `stream` Output stream, defaults to _stdout_
+ * - `buffer` Buffer duration, defaults to 1000ms when _true_
+ * - `immediate` Write log line on request instead of response (for response times)
+ *
+ * Tokens:
+ *
+ * - `:req[header]` ex: `:req[Accept]`
+ * - `:res[header]` ex: `:res[Content-Length]`
+ * - `:http-version`
+ * - `:response-time`
+ * - `:remote-addr`
+ * - `:date`
+ * - `:method`
+ * - `:url`
+ * - `:referrer`
+ * - `:user-agent`
+ * - `:status`
+ *
+ * Formats:
+ *
+ * Pre-defined formats that ship with connect:
+ *
+ * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
+ * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
+ * - `tiny` ':method :url :status :res[content-length] - :response-time ms'
+ * - `dev` concise output colored by response status for development use
+ *
+ * Examples:
+ *
+ * connect.logger() // default
+ * connect.logger('short')
+ * connect.logger('tiny')
+ * connect.logger({ immediate: true, format: 'dev' })
+ * connect.logger(':method :url - :referrer')
+ * connect.logger(':req[content-type] -> :res[content-type]')
+ * connect.logger(function(req, res){ return 'some format string' })
+ *
+ * Defining Tokens:
+ *
+ * To define a token, simply invoke `connect.logger.token()` with the
+ * name and a callback function. The value returned is then available
+ * as ":type" in this case.
+ *
+ * connect.logger.token('type', function(req, res){ return req.headers['content-type']; })
+ *
+ * Defining Formats:
+ *
+ * All default formats are defined this way, however it's public API as well:
+ *
+ * connect.logger.format('name', 'string or function')
+ *
+ * @param {String|Function|Object} format or options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function logger(options) {
+ if ('object' == typeof options) {
+ options = options || {};
+ } else if (options) {
+ options = { format: options };
+ } else {
+ options = {};
+ }
+
+ // output on request instead of response
+ var immediate = options.immediate;
+
+ // format name
+ var fmt = exports[options.format] || options.format || exports.default;
+
+ // compile format
+ if ('function' != typeof fmt) fmt = compile(fmt);
+
+ // options
+ var stream = options.stream || process.stdout
+ , buffer = options.buffer;
+
+ // buffering support
+ if (buffer) {
+ var realStream = stream
+ , interval = 'number' == typeof buffer
+ ? buffer
+ : defaultBufferDuration;
+
+ // flush interval
+ setInterval(function(){
+ if (buf.length) {
+ realStream.write(buf.join(''), 'ascii');
+ buf.length = 0;
+ }
+ }, interval);
+
+ // swap the stream
+ stream = {
+ write: function(str){
+ buf.push(str);
+ }
+ };
+ }
+
+ return function logger(req, res, next) {
+ req._startTime = new Date;
+
+ // immediate
+ if (immediate) {
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n', 'ascii');
+ // proxy end to output logging
+ } else {
+ var end = res.end;
+ res.end = function(chunk, encoding){
+ res.end = end;
+ res.end(chunk, encoding);
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n', 'ascii');
+ };
+ }
+
+
+ next();
+ };
+};
+
+/**
+ * Compile `fmt` into a function.
+ *
+ * @param {String} fmt
+ * @return {Function}
+ * @api private
+ */
+
+function compile(fmt) {
+ fmt = fmt.replace(/"/g, '\\"');
+ var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
+ return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "';
+ }) + '";'
+ return new Function('tokens, req, res', js);
+};
+
+/**
+ * Define a token function with the given `name`,
+ * and callback `fn(req, res)`.
+ *
+ * @param {String} name
+ * @param {Function} fn
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.token = function(name, fn) {
+ exports[name] = fn;
+ return this;
+};
+
+/**
+ * Define a `fmt` with the given `name`.
+ *
+ * @param {String} name
+ * @param {String|Function} fmt
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.format = function(name, str){
+ exports[name] = str;
+ return this;
+};
+
+/**
+ * Default format.
+ */
+
+exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
+
+/**
+ * Short format.
+ */
+
+exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
+
+/**
+ * Tiny format.
+ */
+
+exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
+
+/**
+ * dev (colored)
+ */
+
+exports.format('dev', function(tokens, req, res){
+ var status = res.statusCode
+ , len = parseInt(res.getHeader('Content-Length'), 10)
+ , color = 32;
+
+ if (status >= 500) color = 31
+ else if (status >= 400) color = 33
+ else if (status >= 300) color = 36;
+
+ len = isNaN(len)
+ ? ''
+ : len = ' - ' + bytes(len);
+
+ return '\033[90m' + req.method
+ + ' ' + req.originalUrl + ' '
+ + '\033[' + color + 'm' + res.statusCode
+ + ' \033[90m'
+ + (new Date - req._startTime)
+ + 'ms' + len
+ + '\033[0m';
+});
+
+/**
+ * request url
+ */
+
+exports.token('url', function(req){
+ return req.originalUrl;
+});
+
+/**
+ * request method
+ */
+
+exports.token('method', function(req){
+ return req.method;
+});
+
+/**
+ * response time in milliseconds
+ */
+
+exports.token('response-time', function(req){
+ return new Date - req._startTime;
+});
+
+/**
+ * UTC date
+ */
+
+exports.token('date', function(){
+ return new Date().toUTCString();
+});
+
+/**
+ * response status code
+ */
+
+exports.token('status', function(req, res){
+ return res.statusCode;
+});
+
+/**
+ * normalized referrer
+ */
+
+exports.token('referrer', function(req){
+ return req.headers['referer'] || req.headers['referrer'];
+});
+
+/**
+ * remote address
+ */
+
+exports.token('remote-addr', function(req){
+ return req.socket && (req.socket.remoteAddress || (req.socket.socket && req.socket.socket.remoteAddress));
+});
+
+/**
+ * HTTP version
+ */
+
+exports.token('http-version', function(req){
+ return req.httpVersionMajor + '.' + req.httpVersionMinor;
+});
+
+/**
+ * UA string
+ */
+
+exports.token('user-agent', function(req){
+ return req.headers['user-agent'];
+});
+
+/**
+ * request header
+ */
+
+exports.token('req', function(req, res, field){
+ return req.headers[field.toLowerCase()];
+});
+
+/**
+ * response header
+ */
+
+exports.token('res', function(req, res, field){
+ return (res._headers || {})[field.toLowerCase()];
+});
+
40 node_modules/connect/lib/middleware/methodOverride.js
@@ -0,0 +1,40 @@
+
+/*!
+ * Connect - methodOverride
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Method Override:
+ *
+ * Provides faux HTTP method support.
+ *
+ * Pass an optional `key` to use when checking for
+ * a method override, othewise defaults to _\_method_.
+ * The original method is available via `req.originalMethod`.
+ *
+ * @param {String} key
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function methodOverride(key){
+ key = key || "_method";
+ return function methodOverride(req, res, next) {
+ req.originalMethod = req.originalMethod || req.method;
+
+ // req.body
+ if (req.body && key in req.body) {
+ req.method = req.body[key].toUpperCase();
+ delete req.body[key];
+ // check X-HTTP-Method-Override
+ } else if (req.headers['x-http-method-override']) {
+ req.method = req.headers['x-http-method-override'].toUpperCase();
+ }
+
+ next();
+ };
+};
+
120 node_modules/connect/lib/middleware/multipart.js
@@ -0,0 +1,120 @@
+/*!
+ * Connect - multipart
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var formidable = require('formidable')
+ , _limit = require('./limit')
+ , utils = require('../utils')
+ , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * Multipart:
+ *
+ * Parse multipart/form-data request bodies,
+ * providing the parsed object as `req.body`
+ * and `req.files`.
+ *
+ * Configuration:
+ *
+ * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s
+ * `IncomingForm` object, allowing you to configure the upload directory,
+ * size limits, etc. For example if you wish to change the upload dir do the following.
+ *
+ * app.use(connect.multipart({ uploadDir: path }));
+ *
+ * Options:
+ *
+ * - `limit` byte limit defaulting to none
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ options = options || {};
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function multipart(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+ req.files = req.files || {};
+
+ // ignore GET
+ if ('GET' == req.method || 'HEAD' == req.method) return next();
+
+ // check Content-Type
+ if ('multipart/form-data' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+
+ var form = new formidable.IncomingForm
+ , data = {}
+ , files = {}
+ , done;
+
+ Object.keys(options).forEach(function(key){
+ form[key] = options[key];
+ });
+
+ function ondata(name, val, data){
+ if (Array.isArray(data[name])) {
+ data[name].push(val);
+ } else if (data[name]) {
+ data[name] = [data[name], val];
+ } else {
+ data[name] = val;
+ }
+ }
+
+ form.on('field', function(name, val){
+ ondata(name, val, data);
+ });
+
+ form.on('file', function(name, val){
+ ondata(name, val, files);
+ });
+
+ form.on('error', function(err){
+ next(err);
+ done = true;
+ });
+
+ form.on('end', function(){
+ if (done) return;
+ try {
+ req.body = qs.parse(data);
+ req.files = qs.parse(files);
+ next();
+ } catch (err) {
+ next(err);
+ }
+ });
+
+ form.parse(req);
+ });
+ }
+};
46 node_modules/connect/lib/middleware/query.js
@@ -0,0 +1,46 @@
+/*!
+ * Connect - query
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var qs = require('qs')
+ , parse = require('../utils').parseUrl;
+
+/**
+ * Query:
+ *
+ * Automatically parse the query-string when available,
+ * populating the `req.query` object.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.query())
+ * .use(function(req, res){
+ * res.end(JSON.stringify(req.query));
+ * });
+ *
+ * The `options` passed are provided to qs.parse function.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function query(options){
+ return function query(req, res, next){
+ if (!req.query) {
+ req.query = ~req.url.indexOf('?')
+ ? qs.parse(parse(req).query, options)
+ : {};