Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

livepool inited

  • Loading branch information...
commit 2db0fd37f4a7170bdf2739c73c93d771143e3f79 1 parent 1b0ca9d
@rehorn authored
Showing with 21,268 additions and 0 deletions.
  1. +6 −0 bin/livepool.cmd
  2. +2 −0  bin/livepool.js
  3. 0  lib/core.js
  4. +2 −0  livepool.js
  5. +3 −0  node_modules/http-proxy/.npmignore
  6. +9 −0 node_modules/http-proxy/.travis.yml
  7. +97 −0 node_modules/http-proxy/CHANGELOG.md
  8. +23 −0 node_modules/http-proxy/LICENSE
  9. +626 −0 node_modules/http-proxy/README.md
  10. +88 −0 node_modules/http-proxy/benchmark/websockets-throughput.js
  11. +113 −0 node_modules/http-proxy/bin/node-http-proxy
  12. +10 −0 node_modules/http-proxy/config.sample.json
  13. +58 −0 node_modules/http-proxy/examples/balancer/simple-balancer-with-websockets.js
  14. +36 −0 node_modules/http-proxy/examples/balancer/simple-balancer.js
  15. +64 −0 node_modules/http-proxy/examples/helpers/store.js
  16. +58 −0 node_modules/http-proxy/examples/http/basic-proxy.js
  17. +66 −0 node_modules/http-proxy/examples/http/concurrent-proxy.js
  18. +54 −0 node_modules/http-proxy/examples/http/custom-proxy-error.js
  19. +63 −0 node_modules/http-proxy/examples/http/forward-proxy.js
  20. +56 −0 node_modules/http-proxy/examples/http/latent-proxy.js
  21. +51 −0 node_modules/http-proxy/examples/http/proxy-https-to-http.js
  22. +55 −0 node_modules/http-proxy/examples/http/proxy-https-to-https.js
  23. +51 −0 node_modules/http-proxy/examples/http/proxy-table.js
  24. +57 −0 node_modules/http-proxy/examples/http/standalone-proxy.js
  25. +87 −0 node_modules/http-proxy/examples/middleware/bodyDecoder-middleware.js
  26. +54 −0 node_modules/http-proxy/examples/middleware/gzip-middleware-proxytable.js
  27. +50 −0 node_modules/http-proxy/examples/middleware/gzip-middleware.js
  28. +30 −0 node_modules/http-proxy/examples/middleware/jsonp-middleware.js
  29. +57 −0 node_modules/http-proxy/examples/middleware/modifyResponse-middleware.js
  30. +58 −0 node_modules/http-proxy/examples/middleware/url-middleware.js
  31. +30 −0 node_modules/http-proxy/examples/middleware/url-middleware2.js
  32. +2 −0  node_modules/http-proxy/examples/node_modules/connect-gzip/.npmignore
  33. +102 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/README.md
  34. +2 −0  node_modules/http-proxy/examples/node_modules/connect-gzip/index.js
  35. +112 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/lib/gzip.js
  36. +125 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/lib/staticGzip.js
  37. +19 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/LICENSE
  38. +63 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/README.md
  39. +113 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/mime.js
  40. +36 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/package.json
  41. +55 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/test.js
  42. +1,588 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/types/mime.types
  43. +60 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/node_modules/mime/types/node.types
  44. +29 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/package.json
  45. BIN  node_modules/http-proxy/examples/node_modules/connect-gzip/test/fixtures/blank.gif
  46. +1 −0  node_modules/http-proxy/examples/node_modules/connect-gzip/test/fixtures/index.html
  47. +4 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/test/fixtures/style.css
  48. +1 −0  node_modules/http-proxy/examples/node_modules/connect-gzip/test/fixtures/sub/index.html
  49. +154 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/test/gzip.test.js
  50. +104 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/test/helpers/index.js
  51. +96 −0 node_modules/http-proxy/examples/node_modules/connect-gzip/test/staticGzip.test.js
  52. +3 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/.gitmodules
  53. +2 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/.npmignore
  54. +20 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/History.md
  55. +11 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/Makefile
  56. +50 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/README.md
  57. +33 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/examples/example.js
  58. +1 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/index.js
  59. +109 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/lib/connect-jsonp.js
  60. +35 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/package.json
  61. +3 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/.gitmodules
  62. +3 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/.npmignore
  63. +133 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/History.md
  64. +53 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/Makefile
  65. +61 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/Readme.md
  66. +864 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/bin/expresso
  67. +1,080 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/docs/api.html
  68. +377 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/docs/index.html
  69. +290 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/docs/index.md
  70. +3 −0  node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/docs/layout/foot.html
  71. +42 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/docs/layout/head.html
  72. +4 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/lib/bar.js
  73. +16 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/lib/foo.js
  74. +12 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/package.json
  75. +91 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/assert.test.js
  76. +12 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/async.test.js
  77. +13 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/bar.test.js
  78. +14 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/foo.test.js
  79. +146 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/http.test.js
  80. +39 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/serial/async.test.js
  81. +48 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/support/expresso/test/serial/http.test.js
  82. +63 −0 node_modules/http-proxy/examples/node_modules/connect-jsonp/test/test.js
  83. +3 −0  node_modules/http-proxy/examples/node_modules/connect-restreamer/.npmignore
  84. +20 −0 node_modules/http-proxy/examples/node_modules/connect-restreamer/index.js
  85. +23 −0 node_modules/http-proxy/examples/node_modules/connect-restreamer/package.json
  86. +47 −0 node_modules/http-proxy/examples/node_modules/connect-restreamer/readme.markdown
  87. +11 −0 node_modules/http-proxy/examples/node_modules/connect/.npmignore
  88. +24 −0 node_modules/http-proxy/examples/node_modules/connect/LICENSE
  89. +2 −0  node_modules/http-proxy/examples/node_modules/connect/index.js
  90. +106 −0 node_modules/http-proxy/examples/node_modules/connect/lib/connect.js
  91. +212 −0 node_modules/http-proxy/examples/node_modules/connect/lib/http.js
  92. +47 −0 node_modules/http-proxy/examples/node_modules/connect/lib/https.js
  93. +45 −0 node_modules/http-proxy/examples/node_modules/connect/lib/index.js
  94. +93 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/basicAuth.js
  95. +92 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/bodyParser.js
  96. +163 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/compiler.js
  97. +46 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/cookieParser.js
  98. +105 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/csrf.js
  99. +222 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/directory.js
  100. +100 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/errorHandler.js
  101. +76 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/favicon.js
  102. +78 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/limit.js
  103. +299 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/logger.js
  104. +38 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/methodOverride.js
  105. +100 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/profiler.js
  106. +40 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/query.js
  107. +34 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/responseTime.js
  108. +379 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/router.js
  109. +346 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/session.js
  110. +126 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/session/cookie.js
  111. +131 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/session/memory.js
  112. +137 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/session/session.js
  113. +59 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/session/store.js
  114. +219 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/static.js
  115. +44 −0 node_modules/http-proxy/examples/node_modules/connect/lib/middleware/vhost.js
  116. +67 −0 node_modules/http-proxy/examples/node_modules/connect/lib/patch.js
  117. +75 −0 node_modules/http-proxy/examples/node_modules/connect/lib/public/directory.html
  118. +13 −0 node_modules/http-proxy/examples/node_modules/connect/lib/public/error.html
  119. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/favicon.ico
  120. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page.png
  121. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_add.png
  122. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_attach.png
  123. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_code.png
  124. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_copy.png
  125. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_delete.png
  126. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_edit.png
  127. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_error.png
  128. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_excel.png
  129. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_find.png
  130. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_gear.png
  131. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_go.png
  132. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_green.png
  133. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_key.png
  134. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_lightning.png
  135. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_link.png
  136. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_paintbrush.png
  137. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_paste.png
  138. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_red.png
  139. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_refresh.png
  140. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_save.png
  141. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white.png
  142. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_acrobat.png
  143. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_actionscript.png
  144. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_add.png
  145. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_c.png
  146. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_camera.png
  147. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_cd.png
  148. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_code.png
  149. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_code_red.png
  150. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_coldfusion.png
  151. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_compressed.png
  152. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_copy.png
  153. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_cplusplus.png
  154. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_csharp.png
  155. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_cup.png
  156. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_database.png
  157. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_delete.png
  158. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_dvd.png
  159. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_edit.png
  160. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_error.png
  161. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_excel.png
  162. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_find.png
  163. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_flash.png
  164. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_freehand.png
  165. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_gear.png
  166. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_get.png
  167. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_go.png
  168. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_h.png
  169. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_horizontal.png
  170. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_key.png
  171. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_lightning.png
  172. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_link.png
  173. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_magnify.png
  174. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_medal.png
  175. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_office.png
  176. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_paint.png
  177. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_paintbrush.png
  178. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_paste.png
  179. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_php.png
  180. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_picture.png
  181. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_powerpoint.png
  182. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_put.png
  183. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_ruby.png
  184. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_stack.png
  185. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_star.png
  186. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_swoosh.png
  187. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_text.png
  188. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_text_width.png
  189. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_tux.png
  190. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_vector.png
  191. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_visualstudio.png
  192. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_width.png
  193. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_word.png
  194. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_world.png
  195. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_wrench.png
  196. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_white_zip.png
  197. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_word.png
  198. BIN  node_modules/http-proxy/examples/node_modules/connect/lib/public/icons/page_world.png
  199. +141 −0 node_modules/http-proxy/examples/node_modules/connect/lib/public/style.css
  200. +427 −0 node_modules/http-proxy/examples/node_modules/connect/lib/utils.js
  201. +1 −0  node_modules/http-proxy/examples/node_modules/connect/meta.json
  202. +45 −0 node_modules/http-proxy/examples/node_modules/connect/package.json
  203. +41 −0 node_modules/http-proxy/examples/node_modules/connect/test.js
  204. +3 −0  node_modules/http-proxy/examples/node_modules/proxy-by-url/.npmignore
  205. +58 −0 node_modules/http-proxy/examples/node_modules/proxy-by-url/index.js
  206. +28 −0 node_modules/http-proxy/examples/node_modules/proxy-by-url/package.json
  207. +13 −0 node_modules/http-proxy/examples/node_modules/proxy-by-url/readme.markdown
  208. +12 −0 node_modules/http-proxy/examples/package.json
  209. +92 −0 node_modules/http-proxy/examples/websocket/latent-websocket-proxy.js
  210. +87 −0 node_modules/http-proxy/examples/websocket/standalone-websocket-proxy.js
  211. +69 −0 node_modules/http-proxy/examples/websocket/websocket-proxy.js
  212. +394 −0 node_modules/http-proxy/lib/node-http-proxy.js
  213. +913 −0 node_modules/http-proxy/lib/node-http-proxy/http-proxy.js
  214. +282 −0 node_modules/http-proxy/lib/node-http-proxy/proxy-table.js
  215. +320 −0 node_modules/http-proxy/lib/node-http-proxy/routing-proxy.js
  216. +22 −0 node_modules/http-proxy/node_modules/colors/MIT-LICENSE.txt
  217. +77 −0 node_modules/http-proxy/node_modules/colors/ReadMe.md
  218. +269 −0 node_modules/http-proxy/node_modules/colors/colors.js
  219. +74 −0 node_modules/http-proxy/node_modules/colors/example.html
  220. +65 −0 node_modules/http-proxy/node_modules/colors/example.js
  221. +20 −0 node_modules/http-proxy/node_modules/colors/package.json
  222. +65 −0 node_modules/http-proxy/node_modules/colors/test.js
  223. +2 −0  node_modules/http-proxy/node_modules/pkginfo/.npmignore
  224. +85 −0 node_modules/http-proxy/node_modules/pkginfo/README.md
  225. +194 −0 node_modules/http-proxy/node_modules/pkginfo/docs/docco.css
  226. +101 −0 node_modules/http-proxy/node_modules/pkginfo/docs/pkginfo.html
  227. +19 −0 node_modules/http-proxy/node_modules/pkginfo/examples/all-properties.js
  228. +20 −0 node_modules/http-proxy/node_modules/pkginfo/examples/array-argument.js
  229. +19 −0 node_modules/http-proxy/node_modules/pkginfo/examples/multiple-properties.js
  230. +22 −0 node_modules/http-proxy/node_modules/pkginfo/examples/object-argument.js
  231. +10 −0 node_modules/http-proxy/node_modules/pkginfo/examples/package.json
  232. +19 −0 node_modules/http-proxy/node_modules/pkginfo/examples/single-property.js
  233. +132 −0 node_modules/http-proxy/node_modules/pkginfo/lib/pkginfo.js
  234. +32 −0 node_modules/http-proxy/node_modules/pkginfo/package.json
  235. +69 −0 node_modules/http-proxy/node_modules/pkginfo/test/pkginfo-test.js
  236. +4 −0 node_modules/http-proxy/node_modules/utile/.npmignore
  237. +10 −0 node_modules/http-proxy/node_modules/utile/.travis.yml
  238. +16 −0 node_modules/http-proxy/node_modules/utile/CHANGELOG.md
  239. +19 −0 node_modules/http-proxy/node_modules/utile/LICENSE
  240. +87 −0 node_modules/http-proxy/node_modules/utile/README.md
  241. +46 −0 node_modules/http-proxy/node_modules/utile/lib/args.js
  242. +44 −0 node_modules/http-proxy/node_modules/utile/lib/base64.js
  243. +33 −0 node_modules/http-proxy/node_modules/utile/lib/file.js
  244. +25 −0 node_modules/http-proxy/node_modules/utile/lib/format.js
  245. +467 −0 node_modules/http-proxy/node_modules/utile/lib/index.js
  246. +15 −0 node_modules/http-proxy/node_modules/utile/node_modules/.bin/ncp
  247. +6 −0 node_modules/http-proxy/node_modules/utile/node_modules/.bin/ncp.cmd
  248. +9 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/.gitmodules
  249. +4 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/.npmignore
  250. +19 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/LICENSE
  251. +25 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/Makefile
  252. +1,021 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/README.md
  253. +3 −0  node_modules/http-proxy/node_modules/utile/node_modules/async/index.js
  254. +692 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/lib/async.js
  255. +31 −0 node_modules/http-proxy/node_modules/utile/node_modules/async/package.json
  256. +55 −0 node_modules/http-proxy/node_modules/utile/node_modules/deep-equal/README.markdown
  257. +11 −0 node_modules/http-proxy/node_modules/utile/node_modules/deep-equal/example/cmp.js
  258. +84 −0 node_modules/http-proxy/node_modules/utile/node_modules/deep-equal/index.js
  259. +39 −0 node_modules/http-proxy/node_modules/utile/node_modules/deep-equal/package.json
  260. +18 −0 node_modules/http-proxy/node_modules/utile/node_modules/deep-equal/test/cmp.js
  261. +3 −0  node_modules/http-proxy/node_modules/utile/node_modules/i/.npmignore
  262. +9 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/.travis.yml
  263. +18 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/LICENSE
  264. +174 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/README.md
  265. +63 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/defaults.js
  266. +11 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/inflect.js
  267. +116 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/inflections.js
  268. +233 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/methods.js
  269. +26 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/native.js
  270. +136 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/lib/util.js
  271. +61 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/package.json
  272. +208 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/test/inflector/cases.js
  273. +87 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/test/inflector/inflections-test.js
  274. +342 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/test/inflector/methods-test.js
  275. +39 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/test/utils/array-test.js
  276. +88 −0 node_modules/http-proxy/node_modules/utile/node_modules/i/test/utils/string-test.js
  277. +2 −0  node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/.npmignore
  278. +5 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/.travis.yml
  279. +21 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/LICENSE
  280. +6 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/examples/pow.js
  281. +82 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/index.js
  282. +34 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/package.json
  283. +63 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/readme.markdown
  284. +38 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/chmod.js
  285. +37 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/clobber.js
  286. +28 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/mkdirp.js
  287. +32 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/perm.js
  288. +39 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/perm_sync.js
  289. +41 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/race.js
  290. +32 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/rel.js
  291. +25 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/return.js
  292. +24 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/return_sync.js
  293. +18 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/root.js
  294. +32 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/sync.js
  295. +28 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/umask.js
  296. +32 −0 node_modules/http-proxy/node_modules/utile/node_modules/mkdirp/test/umask_sync.js
  297. +4 −0 node_modules/http-proxy/node_modules/utile/node_modules/ncp/.npmignore
  298. +6 −0 node_modules/http-proxy/node_modules/utile/node_modules/ncp/.travis.yml
  299. +21 −0 node_modules/http-proxy/node_modules/utile/node_modules/ncp/LICENSE.md
  300. +46 −0 node_modules/http-proxy/node_modules/utile/node_modules/ncp/README.md
Sorry, we could not display the entire diff because too many files (379) changed.
View
6 bin/livepool.cmd
@@ -0,0 +1,6 @@
+:: Created by npm, please don't edit manually.
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\livepool.js" %*
+) ELSE (
+ node "livepool.js" %*
+)
View
2  bin/livepool.js
@@ -0,0 +1,2 @@
+#!/usr/bin/env node
+// TODO
View
0  lib/core.js
No changes.
View
2  livepool.js
@@ -0,0 +1,2 @@
+
+exports = require('./lib/core');
View
3  node_modules/http-proxy/.npmignore
@@ -0,0 +1,3 @@
+config.json
+node_modules/
+npm-debug.log
View
9 node_modules/http-proxy/.travis.yml
@@ -0,0 +1,9 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
+
+notifications:
+ email:
+ - travis@nodejitsu.com
+ irc: "irc.freenode.org#nodejitsu"
View
97 node_modules/http-proxy/CHANGELOG.md
@@ -0,0 +1,97 @@
+## ChangeLog for: node-http-proxy
+
+## Version 0.10.0 - 3/18/2013
+
+- Breaking change: `proxyResponse` events are emitted on the `HttpProxy` or `RoutingProxy` instances as originally was intended in `0.9.x`.
+
+## Version 0.9.1 - 3/9/2013
+
+- Ensure that `webSocketProxyError` and `proxyError` both receive the error (indexzero).
+
+## Version 0.9.0 - 3/9/2013
+- Fix #276 Ensure response.headers.location is defined (indexzero)
+- Fix #248 Make options immutable in RoutingProxy (indexzero)
+- Fix #359 Do not modify the protocol in redirect request for external sites. (indexzero)
+- Fix #373 Do not use "Transfer-Encoding: chunked" header for proxied DELETE requests with no "Content-Length" header. (indexzero)
+- Fix #338 Set "content-length" header to "0" if it is not already set on DELETE requests. (indexzero)
+- Updates to README.md and Examples (ramitos, jamie-stackhouse, oost, indexzero)
+- Fixes to ProxyTable and Routing Proxy (adjohnson916, otavoijr)
+- New API for ProxyTable (mikkel, tglines)
+- Add `options.timeout` for specifying socket timeouts (pdoran)
+- Improve bin/node-http-proxy (niallo)
+- Don't emit `proxyError` twice (erasmospunk)
+- Fix memory leaks in WebSocket proxying
+- Support UNIX Sockets (yosefd)
+- Fix truncated chunked respones (jpetazzo)
+- Allow upstream listeners to get `proxyResponse` (colinmollenhour)
+
+## Version 0.8.1 - 6/5/2012
+- Fix re-emitting of events in RoutingProxy (coderarity)
+- New load balancer and middleware examples (marak)
+- Docs updated including changelog (lot of gently people)
+
+## Version 0.8.0 - 12/23/2011
+- Improve support and tests for url segment routing (maxogden)
+- Fix aborting connections when request close (c4milo)
+- Avoid 'Transfer-Encoding' on HTTP/1.0 clients (koichik).
+- Support for Node.js 0.6.x (mmalecki)
+
+## Version 0.7.3 - 10/4/2011
+- Fix setting x-forwarded headers (jesusabdullah)
+- Updated examples (AvianFlu)
+
+## Version 0.7.0 - 9/10/2011
+- Handles to every throw-able resume() call (isaacs)
+- Updated tests, README and package.json (indexzero)
+- Added HttpProxy.close() method (indexzero)
+
+## Version 0.6.6 - 8/31/2011
+- Add more examples (dominictarr)
+- Use of 'pkginfo' (indexzero)
+- Handle cases where res.write throws (isaacs)
+- Handles to every throw-able res.end call (isaacs)
+
+## Version 0.5.11 - 6/21/2011
+- Add more examples with WebSockets (indexzero)
+- Update the documentation (indexzero)
+
+## Version 0.5.7 - 5/19/2011
+- Fix to README related to markup and fix some examples (benatkin)
+- Improve WebSockets handling (indexzero)
+- Improve WebSockets tests (indexzero)
+- Improve https tests (olauzon)
+- Add devDependencies to package.json (olauzon)
+- Add 'proxyError' event (indexzero)
+- Add 'x-forwarded-{port|proto}' headers support (indexzero)
+- Keep-Alive connection supported (indexzero)
+
+## Version 0.5.0 - 4/15/2011
+- Remove winston in favor of custom events (indexzero)
+- Add x-forwarded-for Header (indexzero)
+- Fix WebSocket support (indexzero)
+- Add tests / examples for WebSocket support (indexzero)
+- Update .proxyRequest() and .proxyWebSocketRequest() APIs (indexzero)
+- Add HTTPS support (indexzero)
+- Add tests / examples for HTTPS support (indexzero)
+
+## Version 0.4.1 - 3/20/2011
+- Include missing dependency in package.json (indexzero)
+
+## Version 0.4.0 - 3/20/2011
+- Update for node.js 0.4.0 (indexzero)
+- Remove pool dependency in favor of http.Agent (indexzero)
+- Store buffered data using `.buffer()` instead of on the HttpProxy instance (indexzero)
+- Change the ProxyTable to be a lookup table instead of actively proxying (indexzero)
+- Allow for pure host-only matching in ProxyTable (indexzero)
+- Use winston for logging (indexzero)
+- Improve tests with async setup and more coverage (indexzero)
+- Improve code documentation (indexzero)
+
+### Version 0.3.1 - 11/22/2010
+- Added node-http-proxy binary script (indexzero)
+- Added experimental WebSocket support (indutny)
+- Added forward proxy functionality (indexzero)
+- Added proxy table for multiple target lookup (indexzero)
+- Simplified tests using helpers.js (indexzero)
+- Fixed uncaughtException bug with invalid proxy target (indutny)
+- Added configurable logging for HttpProxy and ProxyTable (indexzero)
View
23 node_modules/http-proxy/LICENSE
@@ -0,0 +1,23 @@
+
+ node-http-proxy
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires
+
+ 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.
View
626 node_modules/http-proxy/README.md
@@ -0,0 +1,626 @@
+# node-http-proxy [![Build Status](https://secure.travis-ci.org/nodejitsu/node-http-proxy.png)](http://travis-ci.org/nodejitsu/node-http-proxy)
+
+<img src="http://i.imgur.com/8fTt9.png" />
+
+## Battle-hardened node.js http proxy
+
+### Features
+
+* Reverse proxies incoming http.ServerRequest streams
+* Can be used as a CommonJS module in node.js
+* Uses event buffering to support application latency in proxied requests
+* Reverse or Forward Proxy based on simple JSON-based configuration
+* Supports [WebSockets][1]
+* Supports [HTTPS][2]
+* Minimal request overhead and latency
+* Full suite of functional tests
+* Battled-hardened through __production usage__ @ [nodejitsu.com][0]
+* Written entirely in Javascript
+* Easy to use API
+
+### When to use node-http-proxy
+
+Let's suppose you were running multiple http application servers, but you only wanted to expose one machine to the internet. You could setup node-http-proxy on that one machine and then reverse-proxy the incoming http requests to locally running services which were not exposed to the outside network.
+
+### Installing npm (node package manager)
+
+```
+curl https://npmjs.org/install.sh | sh
+```
+
+### Installing node-http-proxy
+
+```
+npm install http-proxy
+```
+
+## Using node-http-proxy
+
+There are several ways to use node-http-proxy; the library is designed to be flexible so that it can be used by itself, or in conjunction with other node.js libraries / tools:
+
+1. Standalone HTTP Proxy server
+2. Inside of another HTTP server (like Connect)
+3. In conjunction with a Proxy Routing Table
+4. As a forward-proxy with a reverse proxy
+5. From the command-line as a long running process
+6. customized with 3rd party middleware.
+
+In each of these scenarios node-http-proxy can handle any of these types of requests:
+
+1. HTTP Requests (http://)
+2. HTTPS Requests (https://)
+3. WebSocket Requests (ws://)
+4. Secure WebSocket Requests (wss://)
+
+See the [examples][3] for more working sample code.
+
+### Setup a basic stand-alone proxy server
+
+``` js
+var http = require('http'),
+ httpProxy = require('http-proxy');
+//
+// Create your proxy server
+//
+httpProxy.createServer(9000, 'localhost').listen(8000);
+
+//
+// Create your target server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+```
+
+### Setup a stand-alone proxy server with custom server logic
+
+``` js
+var http = require('http'),
+ httpProxy = require('http-proxy');
+
+//
+// Create a proxy server with custom application logic
+//
+httpProxy.createServer(function (req, res, proxy) {
+ //
+ // Put your custom server logic here
+ //
+ proxy.proxyRequest(req, res, {
+ host: 'localhost',
+ port: 9000
+ });
+}).listen(8000);
+
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+```
+
+### Setup a stand-alone proxy server with latency (e.g. IO, etc)
+
+``` js
+var http = require('http'),
+ httpProxy = require('http-proxy');
+
+//
+// Create a proxy server with custom application logic
+//
+httpProxy.createServer(function (req, res, proxy) {
+ //
+ // Buffer the request so that `data` and `end` events
+ // are not lost during async operation(s).
+ //
+ var buffer = httpProxy.buffer(req);
+
+ //
+ // Wait for two seconds then respond: this simulates
+ // performing async actions before proxying a request
+ //
+ setTimeout(function () {
+ proxy.proxyRequest(req, res, {
+ host: 'localhost',
+ port: 9000,
+ buffer: buffer
+ });
+ }, 2000);
+}).listen(8000);
+
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+```
+
+### Proxy requests within another http server
+
+``` js
+var http = require('http'),
+ httpProxy = require('http-proxy');
+
+//
+// Create a new instance of HttProxy to use in your server
+//
+var proxy = new httpProxy.RoutingProxy();
+
+//
+// Create a regular http server and proxy its handler
+//
+http.createServer(function (req, res) {
+ //
+ // Put your custom server logic here, then proxy
+ //
+ proxy.proxyRequest(req, res, {
+ host: 'localhost',
+ port: 9000
+ });
+}).listen(8001);
+
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied: ' + req.url +'\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+```
+
+### Proxy requests using a ProxyTable
+A Proxy Table is a simple lookup table that maps incoming requests to proxy target locations. Take a look at an example of the options you need to pass to httpProxy.createServer:
+
+``` js
+var options = {
+ router: {
+ 'foo.com/baz': '127.0.0.1:8001',
+ 'foo.com/buz': '127.0.0.1:8002',
+ 'bar.com/buz': '127.0.0.1:8003'
+ }
+};
+```
+
+The above route table will take incoming requests to 'foo.com/baz' and forward them to '127.0.0.1:8001'. Likewise it will take incoming requests to 'foo.com/buz' and forward them to '127.0.0.1:8002'. The routes themselves are later converted to regular expressions to enable more complex matching functionality. We can create a proxy server with these options by using the following code:
+
+``` js
+var proxyServer = httpProxy.createServer(options);
+proxyServer.listen(80);
+```
+
+### Proxy requests using a 'Hostname Only' ProxyTable
+As mentioned in the previous section, all routes passes to the ProxyTable are by default converted to regular expressions that are evaluated at proxy-time. This is good for complex URL rewriting of proxy requests, but less efficient when one simply wants to do pure hostname routing based on the HTTP 'Host' header. If you are only concerned with hostname routing, you change the lookup used by the internal ProxyTable:
+
+``` js
+var options = {
+ hostnameOnly: true,
+ router: {
+ 'foo.com': '127.0.0.1:8001',
+ 'bar.com': '127.0.0.1:8002'
+ }
+}
+```
+
+Notice here that I have not included paths on the individual domains because this is not possible when using only the HTTP 'Host' header. Care to learn more? See [RFC2616: HTTP/1.1, Section 14.23, "Host"][4].
+
+### Proxy requests using a 'Pathname Only' ProxyTable
+
+If you dont care about forwarding to different hosts, you can redirect based on the request path.
+
+``` js
+var options = {
+ pathnameOnly: true,
+ router: {
+ '/wiki': '127.0.0.1:8001',
+ '/blog': '127.0.0.1:8002',
+ '/api': '127.0.0.1:8003'
+ }
+}
+```
+
+This comes in handy if you are running separate services or applications on separate paths. Note, using this option disables routing by hostname entirely.
+
+
+### Proxy requests with an additional forward proxy
+Sometimes in addition to a reverse proxy, you may want your front-facing server to forward traffic to another location. For example, if you wanted to load test your staging environment. This is possible when using node-http-proxy using similar JSON-based configuration to a proxy table:
+
+``` js
+var proxyServerWithForwarding = httpProxy.createServer(9000, 'localhost', {
+ forward: {
+ port: 9000,
+ host: 'staging.com'
+ }
+});
+proxyServerWithForwarding.listen(80);
+```
+
+The forwarding option can be used in conjunction with the proxy table options by simply including both the 'forward' and 'router' properties in the options passed to 'createServer'.
+
+### Listening for proxy events
+Sometimes you want to listen to an event on a proxy. For example, you may want to listen to the 'end' event, which represents when the proxy has finished proxying a request.
+
+``` js
+var httpProxy = require('http-proxy');
+
+var server = httpProxy.createServer(function (req, res, proxy) {
+ var buffer = httpProxy.buffer(req);
+
+ proxy.proxyRequest(req, res, {
+ host: '127.0.0.1',
+ port: 9000,
+ buffer: buffer
+ });
+});
+
+server.proxy.on('end', function () {
+ console.log("The request was proxied.");
+});
+
+server.listen(8000);
+```
+
+It's important to remember not to listen for events on the proxy object in the function passed to `httpProxy.createServer`. Doing so would add a new listener on every request, which would end up being a disaster.
+
+## Using HTTPS
+You have all the full flexibility of node-http-proxy offers in HTTPS as well as HTTP. The two basic scenarios are: with a stand-alone proxy server or in conjunction with another HTTPS server.
+
+### Proxying to HTTP from HTTPS
+This is probably the most common use-case for proxying in conjunction with HTTPS. You have some front-facing HTTPS server, but all of your internal traffic is HTTP. In this way, you can reduce the number of servers to which your CA and other important security files are deployed and reduce the computational overhead from HTTPS traffic.
+
+Using HTTPS in `node-http-proxy` is relatively straight-forward:
+
+``` js
+var fs = require('fs'),
+ http = require('http'),
+ https = require('https'),
+ httpProxy = require('http-proxy');
+
+var options = {
+ https: {
+ key: fs.readFileSync('path/to/your/key.pem', 'utf8'),
+ cert: fs.readFileSync('path/to/your/cert.pem', 'utf8')
+ }
+};
+
+//
+// Create a standalone HTTPS proxy server
+//
+httpProxy.createServer(8000, 'localhost', options).listen(8001);
+
+//
+// Create an instance of HttpProxy to use with another HTTPS server
+//
+var proxy = new httpProxy.HttpProxy({
+ target: {
+ host: 'localhost',
+ port: 8000
+ }
+});
+https.createServer(options.https, function (req, res) {
+ proxy.proxyRequest(req, res)
+}).listen(8002);
+
+//
+// Create the target HTTPS server for both cases
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('hello https\n');
+ res.end();
+}).listen(8000);
+```
+
+### Using two certificates
+
+Suppose that your reverse proxy will handle HTTPS traffic for two different domains `fobar.com` and `barbaz.com`.
+If you need to use two different certificates you can take advantage of [Server Name Indication](http://en.wikipedia.org/wiki/Server_Name_Indication).
+
+``` js
+var https = require('https'),
+ path = require("path"),
+ fs = require("fs"),
+ crypto = require("crypto");
+
+//
+// generic function to load the credentials context from disk
+//
+function getCredentialsContext (cer) {
+ return crypto.createCredentials({
+ key: fs.readFileSync(path.join(__dirname, 'certs', cer + '.key')),
+ cert: fs.readFileSync(path.join(__dirname, 'certs', cer + '.crt'))
+ }).context;
+}
+
+//
+// A certificate per domain hash
+//
+var certs = {
+ "fobar.com": getCredentialsContext("foobar"),
+ "barbaz.com": getCredentialsContext("barbaz")
+};
+
+//
+// Proxy options
+//
+var options = {
+ https: {
+ SNICallback: function (hostname) {
+ return certs[hostname];
+ }
+ },
+ hostnameOnly: true,
+ router: {
+ 'fobar.com': '127.0.0.1:8001',
+ 'barbaz.com': '127.0.0.1:8002'
+ }
+};
+
+//
+// Create a standalone HTTPS proxy server
+//
+httpProxy.createServer(options).listen(8001);
+
+//
+// Create the target HTTPS server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('hello https\n');
+ res.end();
+}).listen(8000);
+
+```
+
+### Proxying to HTTPS from HTTPS
+Proxying from HTTPS to HTTPS is essentially the same as proxying from HTTPS to HTTP, but you must include the `target` option in when calling `httpProxy.createServer` or instantiating a new instance of `HttpProxy`.
+
+``` js
+var fs = require('fs'),
+ https = require('https'),
+ httpProxy = require('http-proxy');
+
+var options = {
+ https: {
+ key: fs.readFileSync('path/to/your/key.pem', 'utf8'),
+ cert: fs.readFileSync('path/to/your/cert.pem', 'utf8')
+ },
+ target: {
+ https: true // This could also be an Object with key and cert properties
+ }
+};
+
+//
+// Create a standalone HTTPS proxy server
+//
+httpProxy.createServer(8000, 'localhost', options).listen(8001);
+
+//
+// Create an instance of HttpProxy to use with another HTTPS server
+//
+var proxy = new httpProxy.HttpProxy({
+ target: {
+ host: 'localhost',
+ port: 8000,
+ https: true
+ }
+});
+
+https.createServer(options.https, function (req, res) {
+ proxy.proxyRequest(req, res);
+}).listen(8002);
+
+//
+// Create the target HTTPS server for both cases
+//
+https.createServer(options.https, function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('hello https\n');
+ res.end();
+}).listen(8000);
+```
+## Middleware
+
+`node-http-proxy` now supports connect middleware. Add middleware functions to your createServer call:
+
+``` js
+httpProxy.createServer(
+ require('connect-gzip').gzip(),
+ 9000, 'localhost'
+).listen(8000);
+```
+
+A regular request we receive is to support the modification of html/xml content that is returned in the response from an upstream server.
+
+[Harmon](https://github.com/No9/harmon/) is a stream based middleware plugin that is designed to solve that problem in the most effective way possible.
+
+## Proxying WebSockets
+Websockets are handled automatically when using `httpProxy.createServer()`, however, if you supply a callback inside the createServer call, you will need to handle the 'upgrade' proxy event yourself. Here's how:
+
+```js
+
+var options = {
+ ....
+};
+
+var server = httpProxy.createServer(
+ callback/middleware,
+ options
+);
+
+server.listen(port, function () { ... });
+server.on('upgrade', function (req, socket, head) {
+ server.proxy.proxyWebSocketRequest(req, socket, head);
+});
+```
+
+If you would rather not use createServer call, and create the server that proxies yourself, see below:
+
+``` js
+var http = require('http'),
+ httpProxy = require('http-proxy');
+
+//
+// Create an instance of node-http-proxy
+//
+var proxy = new httpProxy.HttpProxy({
+ target: {
+ host: 'localhost',
+ port: 8000
+ }
+});
+
+var server = http.createServer(function (req, res) {
+ //
+ // Proxy normal HTTP requests
+ //
+ proxy.proxyRequest(req, res);
+});
+
+server.on('upgrade', function (req, socket, head) {
+ //
+ // Proxy websocket requests too
+ //
+ proxy.proxyWebSocketRequest(req, socket, head);
+});
+
+server.listen(8080);
+```
+
+### with custom server logic
+
+``` js
+var httpProxy = require('http-proxy')
+
+var server = httpProxy.createServer(function (req, res, proxy) {
+ //
+ // Put your custom server logic here
+ //
+ proxy.proxyRequest(req, res, {
+ host: 'localhost',
+ port: 9000
+ });
+})
+
+server.on('upgrade', function (req, socket, head) {
+ //
+ // Put your custom server logic here
+ //
+ server.proxy.proxyWebSocketRequest(req, socket, head, {
+ host: 'localhost',
+ port: 9000
+ });
+});
+
+server.listen(8080);
+```
+
+### Configuring your Socket limits
+
+By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways:
+
+1. By passing the `maxSockets` option to `httpProxy.createServer()`
+2. By calling `httpProxy.setMaxSockets(n)`, where `n` is the number of sockets you with to use.
+
+## POST requests and buffering
+
+express.bodyParser will interfere with proxying of POST requests (and other methods that have a request
+body). With bodyParser active, proxied requests will never send anything to the upstream server, and
+the original client will just hang. See https://github.com/nodejitsu/node-http-proxy/issues/180 for options.
+
+## Using node-http-proxy from the command line
+When you install this package with npm, a node-http-proxy binary will become available to you. Using this binary is easy with some simple options:
+
+``` js
+usage: node-http-proxy [options]
+
+All options should be set with the syntax --option=value
+
+options:
+ --port PORT Port that the proxy server should run on
+ --target HOST:PORT Location of the server the proxy will target
+ --config OUTFILE Location of the configuration file for the proxy server
+ --silent Silence the log output from the proxy server
+ -h, --help You're staring at it
+```
+
+<br/>
+## Why doesn't node-http-proxy have more advanced features like x, y, or z?
+
+If you have a suggestion for a feature currently not supported, feel free to open a [support issue][6]. node-http-proxy is designed to just proxy http requests from one server to another, but we will be soon releasing many other complimentary projects that can be used in conjunction with node-http-proxy.
+
+## Options
+
+### Http Proxy
+
+`createServer()` supports the following options
+
+```javascript
+{
+ forward: { // options for forward-proxy
+ port: 8000,
+ host: 'staging.com'
+ },
+ target : { // options for proxy target
+ port : 8000,
+ host : 'localhost',
+ };
+ source : { // additional options for websocket proxying
+ host : 'localhost',
+ port : 8000,
+ https: true
+ },
+ enable : {
+ xforward: true // enables X-Forwarded-For
+ },
+ changeOrigin: false, // changes the origin of the host header to the target URL
+ timeout: 120000 // override the default 2 minute http socket timeout value in milliseconds
+}
+```
+
+## Run Tests
+The test suite is designed to fully cover the combinatoric possibilities of HTTP and HTTPS proxying:
+
+1. HTTP --> HTTP
+2. HTTPS --> HTTP
+3. HTTPS --> HTTPS
+4. HTTP --> HTTPS
+
+```
+vows test/*-test.js --spec
+vows test/*-test.js --spec --https
+vows test/*-test.js --spec --https --target=https
+vows test/*-test.js --spec --target=https
+```
+
+<br/>
+### License
+
+(The MIT License)
+
+Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires
+
+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.
+
+[0]: http://nodejitsu.com
+[1]: https://github.com/nodejitsu/node-http-proxy/blob/master/examples/websocket/websocket-proxy.js
+[2]: https://github.com/nodejitsu/node-http-proxy/blob/master/examples/http/proxy-https-to-http.js
+[3]: https://github.com/nodejitsu/node-http-proxy/tree/master/examples
+[4]: http://www.ietf.org/rfc/rfc2616.txt
+[5]: http://socket.io
+[6]: http://github.com/nodejitsu/node-http-proxy/issues
View
88 node_modules/http-proxy/benchmark/websockets-throughput.js
@@ -0,0 +1,88 @@
+var crypto = require('crypto'),
+ WebSocket = require('ws'),
+ async = require('async'),
+ httpProxy = require('../');
+
+var SERVER_PORT = 8415,
+ PROXY_PORT = 8514;
+
+var testSets = [
+ {
+ size: 1024 * 1024, // 1 MB
+ count: 128 // 128 MB
+ },
+ {
+ size: 1024, // 1 KB,
+ count: 1024 // 1 MB
+ },
+ {
+ size: 128, // 128 B
+ count: 1024 * 8 // 1 MB
+ }
+];
+
+testSets.forEach(function (set) {
+ set.buffer = new Buffer(crypto.randomBytes(set.size));
+
+ set.buffers = [];
+ for (var i = 0; i < set.count; i++) {
+ set.buffers.push(set.buffer);
+ }
+});
+
+function runSet(set, callback) {
+ function runAgainst(port, callback) {
+ function send(sock) {
+ sock.send(set.buffers[got++]);
+ if (got === set.count) {
+ t = new Date() - t;
+
+ server.close();
+ proxy.close();
+
+ callback(null, t);
+ }
+ }
+
+ var server = new WebSocket.Server({ port: SERVER_PORT }),
+ proxy = httpProxy.createServer(SERVER_PORT, 'localhost').listen(PROXY_PORT),
+ client = new WebSocket('ws://localhost:' + port),
+ got = 0,
+ t = new Date();
+
+ server.on('connection', function (ws) {
+ send(ws);
+
+ ws.on('message', function (msg) {
+ send(ws);
+ });
+ });
+
+ client.on('message', function () {
+ send(client);
+ });
+ }
+
+ async.series({
+ server: async.apply(runAgainst, SERVER_PORT),
+ proxy: async.apply(runAgainst, PROXY_PORT)
+ }, function (err, results) {
+ if (err) {
+ throw err;
+ }
+
+ var mb = (set.size * set.count) / (1024 * 1024);
+ console.log(set.size / (1024) + ' KB * ' + set.count + ' (' + mb + ' MB)');
+
+ Object.keys(results).forEach(function (key) {
+ var t = results[key],
+ throughput = mb / (t / 1000);
+
+ console.log(' ' + key + ' took ' + t + ' ms (' + throughput + ' MB/s)');
+ });
+
+ callback();
+ });
+}
+
+async.forEachLimit(testSets, 1, runSet);
View
113 node_modules/http-proxy/bin/node-http-proxy
@@ -0,0 +1,113 @@
+#!/usr/bin/env node
+
+var path = require('path'),
+ fs = require('fs'),
+ util = require('util'),
+ argv = require('optimist').argv,
+ httpProxy = require('../lib/node-http-proxy');
+
+var help = [
+ "usage: node-http-proxy [options] ",
+ "",
+ "Starts a node-http-proxy server using the specified command-line options",
+ "",
+ "options:",
+ " --port PORT Port that the proxy server should run on",
+ " --host HOST Host that the proxy server should run on",
+ " --target HOST:PORT Location of the server the proxy will target",
+ " --config OUTFILE Location of the configuration file for the proxy server",
+ " --silent Silence the log output from the proxy server",
+ " --user USER User to drop privileges to once server socket is bound",
+ " -h, --help You're staring at it"
+].join('\n');
+
+if (argv.h || argv.help || Object.keys(argv).length === 2) {
+ return util.puts(help);
+}
+
+var location, config = {},
+ port = argv.port || 80,
+ host = argv.host || undefined,
+ target = argv.target;
+ user = argv.user;
+
+//
+// If we were passed a config, parse it
+//
+if (argv.config) {
+ try {
+ var data = fs.readFileSync(argv.config);
+ config = JSON.parse(data.toString());
+ } catch (ex) {
+ util.puts('Error starting node-http-proxy: ' + ex);
+ process.exit(1);
+ }
+}
+
+//
+// If `config.https` is set, then load the required file contents into the config options.
+//
+if (config.https) {
+ Object.keys(config.https).forEach(function (key) {
+ // If CA certs are specified, load those too.
+ if (key === "ca") {
+ for (var i=0; i < config.https.ca.length; i++) {
+ if (config.https.ca === undefined) {
+ config.https.ca = [];
+ }
+ config.https.ca[i] = fs.readFileSync(config.https[key][i], 'utf8');
+ }
+ } else {
+ config.https[key] = fs.readFileSync(config.https[key], 'utf8');
+ }
+ });
+}
+
+//
+// Check to see if we should silence the logs
+//
+config.silent = typeof argv.silent !== 'undefined' ? argv.silent : config.silent;
+
+//
+// If we were passed a target, parse the url string
+//
+if (typeof target === 'string') location = target.split(':');
+
+//
+// Create the server with the specified options
+//
+var server;
+if (location) {
+ var targetPort = location.length === 1 ? 80 : parseInt(location[1]);
+ server = httpProxy.createServer(targetPort, location[0], config);
+}
+else if (config.router) {
+ server = httpProxy.createServer(config);
+}
+else {
+ return util.puts(help);
+}
+
+//
+// Start the server
+//
+if (host) {
+ server.listen(port, host);
+} else {
+ server.listen(port);
+}
+
+
+//
+// Drop privileges if requested
+//
+if (typeof user === 'string') {
+ process.setuid(user);
+}
+
+//
+// Notify that the server is started
+//
+if (!config.silent) {
+ util.puts('node-http-proxy server now listening on port: ' + port);
+}
View
10 node_modules/http-proxy/config.sample.json
@@ -0,0 +1,10 @@
+{
+ "silent": false,
+ "router": {
+ "localhost": "localhost:9000"
+ },
+ "forward": {
+ "port": 9001,
+ "host": "localhost"
+ }
+}
View
58 node_modules/http-proxy/examples/balancer/simple-balancer-with-websockets.js
@@ -0,0 +1,58 @@
+var http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// A simple round-robin load balancing strategy.
+//
+// First, list the servers you want to use in your rotation.
+//
+var addresses = [
+ {
+ host: 'ws1.0.0.0',
+ port: 80
+ },
+ {
+ host: 'ws2.0.0.0',
+ port: 80
+ }
+];
+
+//
+// Create a HttpProxy object for each target
+//
+
+var proxies = addresses.map(function (target) {
+ return new httpProxy.HttpProxy({
+ target: target
+ });
+});
+
+//
+// Get the proxy at the front of the array, put it at the end and return it
+// If you want a fancier balancer, put your code here
+//
+
+function nextProxy() {
+ var proxy = proxies.shift();
+ proxies.push(proxy);
+ return proxy;
+}
+
+//
+// Get the 'next' proxy and send the http request
+//
+
+var server = http.createServer(function (req, res) {
+ nextProxy().proxyRequest(req, res);
+});
+
+//
+// Get the 'next' proxy and send the upgrade request
+//
+
+server.on('upgrade', function (req, socket, head) {
+ nextProxy().proxyWebSocketRequest(req, socket, head);
+});
+
+server.listen(8080);
+
View
36 node_modules/http-proxy/examples/balancer/simple-balancer.js
@@ -0,0 +1,36 @@
+var httpProxy = require('../../lib/node-http-proxy');
+//
+// A simple round-robin load balancing strategy.
+//
+// First, list the servers you want to use in your rotation.
+//
+var addresses = [
+ {
+ host: 'ws1.0.0.0',
+ port: 80
+ },
+ {
+ host: 'ws2.0.0.0',
+ port: 80
+ }
+];
+
+httpProxy.createServer(function (req, res, proxy) {
+ //
+ // On each request, get the first location from the list...
+ //
+ var target = addresses.shift();
+
+ //
+ // ...then proxy to the server whose 'turn' it is...
+ //
+ console.log('balancing request to: ', target);
+ proxy.proxyRequest(req, res, target);
+
+ //
+ // ...and then the server you just used becomes the last item in the list.
+ //
+ addresses.push(target);
+}).listen(8000);
+
+// Rinse; repeat; enjoy.
View
64 node_modules/http-proxy/examples/helpers/store.js
@@ -0,0 +1,64 @@
+
+//
+// just to make these example a little bit interesting,
+// make a little key value store with an http interface
+// (see couchbd for a grown-up version of this)
+//
+// API:
+// GET /
+// retrive list of keys
+//
+// GET /[url]
+// retrive object stored at [url]
+// will respond with 404 if there is nothing stored at [url]
+//
+// POST /[url]
+//
+// JSON.parse the body and store it under [url]
+// will respond 400 (bad request) if body is not valid json.
+//
+// TODO: cached map-reduce views and auto-magic sharding.
+//
+var Store = module.exports = function Store () {
+ this.store = {};
+};
+
+Store.prototype = {
+ get: function (key) {
+ return this.store[key]
+ },
+ set: function (key, value) {
+ return this.store[key] = value
+ },
+ handler:function () {
+ var store = this
+ return function (req, res) {
+ function send (obj, status) {
+ res.writeHead(200 || status,{'Content-Type': 'application/json'})
+ res.write(JSON.stringify(obj) + '\n')
+ res.end()
+ }
+ var url = req.url.split('?').shift()
+ if (url === '/') {
+ console.log('get index')
+ return send(Object.keys(store.store))
+ } else if (req.method == 'GET') {
+ var obj = store.get (url)
+ send(obj || {error: 'not_found', url: url}, obj ? 200 : 404)
+ } else {
+ //post: buffer body, and parse.
+ var body = '', obj
+ req.on('data', function (c) { body += c})
+ req.on('end', function (c) {
+ try {
+ obj = JSON.parse(body)
+ } catch (err) {
+ return send (err, 400)
+ }
+ store.set(url, obj)
+ send({ok: true})
+ })
+ }
+ }
+ }
+}
View
58 node_modules/http-proxy/examples/http/basic-proxy.js
@@ -0,0 +1,58 @@
+/*
+ basic-proxy.js: Basic example of proxying over HTTP
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+var welcome = [
+ '# # ##### ##### ##### ##### ##### #### # # # #',
+ '# # # # # # # # # # # # # # # # ',
+ '###### # # # # ##### # # # # # # ## # ',
+ '# # # # ##### ##### ##### # # ## # ',
+ '# # # # # # # # # # # # # ',
+ '# # # # # # # # #### # # # '
+].join('\n');
+
+util.puts(welcome.rainbow.bold);
+
+//
+// Basic Http Proxy Server
+//
+httpProxy.createServer(9000, 'localhost').listen(8000);
+
+//
+// Target Http Server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+
+util.puts('http proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8000'.yellow);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
View
66 node_modules/http-proxy/examples/http/concurrent-proxy.js
@@ -0,0 +1,66 @@
+/*
+ concurrent-proxy.js: check levelof concurrency through proxy.
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Basic Http Proxy Server
+//
+httpProxy.createServer(9000, 'localhost').listen(8000);
+
+//
+// Target Http Server
+//
+// to check apparent problems with concurrent connections
+// make a server which only responds when there is a given nubmer on connections
+//
+
+
+var connections = [],
+ go;
+
+http.createServer(function (req, res) {
+ connections.push(function () {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+ });
+
+ process.stdout.write(connections.length + ', ');
+
+ if (connections.length > 110 || go) {
+ go = true;
+ while (connections.length) {
+ connections.shift()();
+ }
+ }
+}).listen(9000);
+
+util.puts('http proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8000'.yellow);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
View
54 node_modules/http-proxy/examples/http/custom-proxy-error.js
@@ -0,0 +1,54 @@
+/*
+ custom-proxy-error.js: Example of using the custom `proxyError` event.
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Http Proxy Server with Latency
+//
+var server = httpProxy.createServer(9000, 'localhost');
+
+//
+// Tell the server to listen on port 8002
+//
+server.listen(8002);
+
+//
+// Listen for the `proxyError` event on `server.proxy`. _It will not
+// be raised on the server itself._
+server.proxy.on('proxyError', function (err, req, res) {
+ res.writeHead(500, {
+ 'Content-Type': 'text/plain'
+ });
+
+ res.end('Something went wrong. And we are reporting a custom error message.');
+});
+
+
+util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8002 '.yellow + 'with custom error message'.magenta.underline);
View
63 node_modules/http-proxy/examples/http/forward-proxy.js
@@ -0,0 +1,63 @@
+/*
+ forward-proxy.js: Example of proxying over HTTP with additional forward proxy
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Setup proxy server with forwarding
+//
+httpProxy.createServer(9000, 'localhost', {
+ forward: {
+ port: 9001,
+ host: 'localhost'
+ }
+}).listen(8003);
+
+//
+// Target Http Server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+
+//
+// Target Http Forwarding Server
+//
+http.createServer(function (req, res) {
+ util.puts('Receiving forward for: ' + req.url);
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully forwarded to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9001);
+
+util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8003 '.yellow + 'with forward proxy'.magenta.underline);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
+util.puts('http forward server '.blue + 'started '.green.bold + 'on port '.blue + '9001 '.yellow);
View
56 node_modules/http-proxy/examples/http/latent-proxy.js
@@ -0,0 +1,56 @@
+/*
+ latent-proxy.js: Example of proxying over HTTP with latency
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Http Proxy Server with Latency
+//
+httpProxy.createServer(function (req, res, proxy) {
+ var buffer = httpProxy.buffer(req);
+ setTimeout(function () {
+ proxy.proxyRequest(req, res, {
+ port: 9000,
+ host: 'localhost',
+ buffer: buffer
+ });
+ }, 200);
+}).listen(8002);
+
+//
+// Target Http Server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+
+util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8002 '.yellow + 'with latency'.magenta.underline);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
View
51 node_modules/http-proxy/examples/http/proxy-https-to-http.js
@@ -0,0 +1,51 @@
+/*
+ proxy-https-to-http.js: Basic example of proxying over HTTPS to a target HTTP server
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var https = require('https'),
+ http = require('http'),
+ util = require('util'),
+ colors = require('colors'),
+ httpProxy = require('../../lib/node-http-proxy'),
+ helpers = require('../../test/helpers');
+
+//
+// Create the target HTTPS server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('hello http over https\n');
+ res.end();
+}).listen(8000);
+
+//
+// Create the proxy server listening on port 443
+//
+httpProxy.createServer(8000, 'localhost', {
+ https: helpers.https
+}).listen(8080);
+
+util.puts('https proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8080'.yellow);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '8000 '.yellow);
View
55 node_modules/http-proxy/examples/http/proxy-https-to-https.js
@@ -0,0 +1,55 @@
+/*
+ proxy-https-to-https.js: Basic example of proxying over HTTPS to a target HTTPS server
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var https = require('https'),
+ http = require('http'),
+ util = require('util'),
+ colors = require('colors'),
+ httpProxy = require('../../lib/node-http-proxy'),
+ helpers = require('../../test/helpers');
+
+//
+// Create the target HTTPS server
+//
+https.createServer(helpers.https, function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('hello https\n');
+ res.end();
+}).listen(8000);
+
+//
+// Create the proxy server listening on port 443
+//
+httpProxy.createServer(8000, 'localhost', {
+ https: helpers.https,
+ target: {
+ https: true,
+ rejectUnauthorized: false
+ }
+}).listen(8080);
+
+util.puts('https proxy server'.blue + ' started '.green.bold + 'on port '.blue + '8080'.yellow);
+util.puts('https server '.blue + 'started '.green.bold + 'on port '.blue + '8000 '.yellow);
View
51 node_modules/http-proxy/examples/http/proxy-table.js
@@ -0,0 +1,51 @@
+/*
+ proxy-table.js: Example of proxying over HTTP with proxy table
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Http Proxy Server with Proxy Table
+//
+httpProxy.createServer({
+ router: {
+ 'localhost': 'localhost:9000'
+ }
+}).listen(8001);
+
+//
+// Target Http Server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+
+util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue + '8001 '.yellow + 'with proxy table'.magenta.underline);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
View
57 node_modules/http-proxy/examples/http/standalone-proxy.js
@@ -0,0 +1,57 @@
+/*
+ standalone-proxy.js: Example of proxying over HTTP with a standalone HTTP server.
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Http Server with proxyRequest Handler and Latency
+//
+var proxy = new httpProxy.RoutingProxy();
+http.createServer(function (req, res) {
+ var buffer = httpProxy.buffer(req);
+ setTimeout(function () {
+ proxy.proxyRequest(req, res, {
+ port: 9000,
+ host: 'localhost',
+ buffer: buffer
+ });
+ }, 200);
+}).listen(8004);
+
+//
+// Target Http Server
+//
+http.createServer(function (req, res) {
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
+ res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
+ res.end();
+}).listen(9000);
+
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '8004 '.yellow + 'with proxyRequest handler'.cyan.underline + ' and latency'.magenta);
+util.puts('http server '.blue + 'started '.green.bold + 'on port '.blue + '9000 '.yellow);
View
87 node_modules/http-proxy/examples/middleware/bodyDecoder-middleware.js
@@ -0,0 +1,87 @@
+
+var Store = require('../helpers/store')
+ , http = require('http')
+
+http.createServer(new Store().handler()).listen(7531, function () {
+//try these commands:
+// get index:
+// curl localhost:7531
+// []
+//
+// get a doc:
+// curl localhost:7531/foo
+// {"error":"not_found"}
+//
+// post an doc:
+// curl -X POST localhost:7531/foo -d '{"content": "hello", "type": "greeting"}'
+// {"ok":true}
+//
+// get index (now, not empty)
+// curl localhost:7531
+// ["/foo"]
+//
+// get doc
+// curl localhost:7531/foo
+// {"content": "hello", "type": "greeting"}
+
+//
+// now, suppose we wanted to direct all objects where type == "greeting" to a different store
+// than where type == "insult"
+//
+// we can use connect connect-bodyDecoder and some custom logic to send insults to another Store.
+
+//insult server:
+
+ http.createServer(new Store().handler()).listen(2600, function () {
+
+ //greetings -> 7531, insults-> 2600
+
+ // now, start a proxy server.
+
+ var bodyParser = require('connect/lib/middleware/bodyParser')
+ //don't worry about incoming contont type
+ //bodyParser.parse[''] = JSON.parse
+
+ require('../../lib/node-http-proxy').createServer(
+ //refactor the body parser and re-streamer into a separate package
+ bodyParser(),
+ //body parser absorbs the data and end events before passing control to the next
+ // middleware. if we want to proxy it, we'll need to re-emit these events after
+ //passing control to the middleware.
+ require('connect-restreamer')(),
+ function (req, res, proxy) {
+ //if your posting an obect which contains type: "insult"
+ //it will get redirected to port 2600.
+ //normal get requests will go to 7531 nad will not return insults.
+ var port = (req.body && req.body.type === 'insult' ? 2600 : 7531)
+ proxy.proxyRequest(req, res, {host: 'localhost', port: port})
+ }
+ ).listen(1337, function () {
+ var request = require('request')
+ //bodyParser needs content-type set to application/json
+ //if we use request, it will set automatically if we use the 'json:' field.
+ function post (greeting, type) {
+ request.post({
+ url: 'http://localhost:1337/' + greeting,
+ json: {content: greeting, type: type || "greeting"}
+ })
+ }
+ post("hello")
+ post("g'day")
+ post("kiora")
+ post("houdy")
+ post("java", "insult")
+
+ //now, the insult should have been proxied to 2600
+
+ //curl localhost:2600
+ //["/java"]
+
+ //but the greetings will be sent to 7531
+
+ //curl localhost:7531
+ //["/hello","/g%27day","/kiora","/houdy"]
+
+ })
+ })
+})
View
54 node_modules/http-proxy/examples/middleware/gzip-middleware-proxytable.js
@@ -0,0 +1,54 @@
+/*
+ gzip-middleware-proxytable.js: Basic example of `connect-gzip` middleware in node-http-proxy
+
+ Copyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, Marak Squires, & Dominic Tarr.
+
+ 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.
+
+*/
+
+var util = require('util'),
+ colors = require('colors'),
+ http = require('http'),
+ httpProxy = require('../../lib/node-http-proxy');
+
+//
+// Basic Http Proxy Server
+//
+httpProxy.createServer(