Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

phantom-node worker

  • Loading branch information...
commit 458f9757cb1d6718db22ca752e36684733fdc08a 1 parent a84a9d3
@thousandsofthem thousandsofthem authored
Showing with 30,283 additions and 0 deletions.
  1. +4 −0 binary/phantom-nodejs/iron.json
  2. +36 −0 binary/phantom-nodejs/nearme-slave.js
  3. +40 −0 binary/phantom-nodejs/nearme.js
  4. +2 −0  binary/phantom-nodejs/node_modules/iron_worker/.npmignore
  5. +22 −0 binary/phantom-nodejs/node_modules/iron_worker/LICENSE
  6. +4 −0 binary/phantom-nodejs/node_modules/iron_worker/Makefile
  7. +2 −0  binary/phantom-nodejs/node_modules/iron_worker/README.md
  8. +67 −0 binary/phantom-nodejs/node_modules/iron_worker/lib/api_client.js
  9. +36 −0 binary/phantom-nodejs/node_modules/iron_worker/lib/client.js
  10. +2 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/.npmignore
  11. +22 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/LICENSE
  12. +4 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/Makefile
  13. +2 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/README.md
  14. +184 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/lib/client.js
  15. +55 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/LICENSE
  16. +287 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/README.md
  17. +190 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/aws.js
  18. +128 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/aws2.js
  19. +103 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/forever.js
  20. +974 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/main.js
  21. +152 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/mimetypes.js
  22. +34 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/oauth.js
  23. +32 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/package.json
  24. BIN  .../phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/googledoodle.png
  25. +39 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/run.js
  26. +82 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/server.js
  27. +77 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/squid.conf
  28. +20 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.cnf
  29. 0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.crl
  30. +17 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.crt
  31. +13 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.csr
  32. +18 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.key
  33. +1 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/ca.srl
  34. +19 −0 ...phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/server.cnf
  35. +16 −0 ...phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/server.crt
  36. +11 −0 ...phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/server.csr
  37. +28 −0 .../phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/server.js
  38. +9 −0 ...phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/ca/server.key
  39. +16 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/npm-ca.crt
  40. +15 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/test.crt
  41. +15 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/ssl/test.key
  42. +80 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-body.js
  43. +29 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-cookie.js
  44. +90 −0 ...phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-cookiejar.js
  45. +68 −0 .../phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-defaults.js
  46. +37 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-errors.js
  47. +52 −0 ...y/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-headers.js
  48. +94 −0 ...hantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-httpModule.js
  49. +97 −0 ...ntom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-https-strict.js
  50. +86 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-https.js
  51. +117 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-oauth.js
  52. +92 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-params.js
  53. +202 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-pipes.js
  54. +16 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-pool.js
  55. +39 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-proxy.js
  56. +28 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-qs.js
  57. +154 −0 .../phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-redirect.js
  58. +13 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-s3.js
  59. +87 −0 ...y/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-timeout.js
  60. +14 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-toJSON.js
  61. +61 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tests/test-tunnel.js
  62. +229 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/tunnel.js
  63. +19 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/uuid.js
  64. +65 −0 .../phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/vendor/cookie/index.js
  65. +72 −0 ...ry/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/vendor/cookie/jar.js
  66. +28 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/package.json
  67. +118 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/src/client.coffee
  68. +2 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/.npmignore
  69. +85 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/README.md
  70. +194 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/docs/docco.css
  71. +101 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/docs/pkginfo.html
  72. +19 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/all-properties.js
  73. +20 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/array-argument.js
  74. +19 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/multiple-properties.js
  75. +22 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/object-argument.js
  76. +10 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/package.json
  77. +19 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/examples/single-property.js
  78. +132 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/lib/pkginfo.js
  79. +31 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/package.json
  80. +69 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/pkginfo/test/pkginfo-test.js
  81. +3 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/.npmignore
  82. +1 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/CNAME
  83. +22 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/LICENSE
  84. +19 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/README.md
  85. BIN  binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/favicon.ico
  86. +2,109 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/index.html
  87. +1 −0  binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/index.js
  88. +25 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/package.json
  89. BIN  binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/raw/underscore.psd
  90. +32 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/underscore-min.js
  91. +1,059 −0 binary/phantom-nodejs/node_modules/iron_worker/node_modules/underscore/underscore.js
  92. +28 −0 binary/phantom-nodejs/node_modules/iron_worker/package.json
  93. +36 −0 binary/phantom-nodejs/node_modules/iron_worker/src/api_client.coffee
  94. +22 −0 binary/phantom-nodejs/node_modules/iron_worker/src/client.coffee
  95. +6 −0 binary/phantom-nodejs/node_modules/iron_worker/test.coffee
  96. +22 −0 binary/phantom-nodejs/node_modules/phantom/Cakefile
  97. +63 −0 binary/phantom-nodejs/node_modules/phantom/README.markdown
  98. +17 −0 binary/phantom-nodejs/node_modules/phantom/index.html
  99. +1 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/.bin/express
  100. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/.travis.yml
  101. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/LICENSE
  102. +139 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/README.markdown
  103. +90 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/doc/protocol.markdown
  104. +22 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/example/proto.js
  105. +45 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/example/weak.js
  106. +125 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/index.js
  107. +6 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/lib/foreach.js
  108. +12 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/lib/is_enum.js
  109. +5 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/lib/keys.js
  110. +72 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/lib/scrub.js
  111. +34 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/README.markdown
  112. +2 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/index.js
  113. +273 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/lib/parse.js
  114. +154 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/lib/stringify.js
  115. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/package.json
  116. +16 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/test/parse.js
  117. +15 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/jsonify/test/stringify.js
  118. +1 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/.npmignore
  119. +3 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/.travis.yml
  120. +24 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/LICENSE
  121. +258 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/README.markdown
  122. +16 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/examples/json.js
  123. +15 −0 ...ry/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/examples/leaves.js
  124. +8 −0 .../phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/examples/negative.js
  125. +10 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/examples/scrub.js
  126. +38 −0 ...phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/examples/stringify.js
  127. +9 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/fail.js
  128. +310 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/index.js
  129. +47 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/package.json
  130. +117 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/circular.js
  131. +37 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/date.js
  132. +240 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/equal.js
  133. +11 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/error.js
  134. +15 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/has.js
  135. +17 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/instance.js
  136. +43 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/interface.js
  137. +49 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/json.js
  138. +31 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/keys.js
  139. +22 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/leaves.js
  140. +96 −0 ...hantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/lib/deep_equal.js
  141. +300 −0 ...ry/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/mutability.js
  142. +21 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/negative.js
  143. +11 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/obj.js
  144. +37 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/siblings.js
  145. +44 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/stop.js
  146. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/stringify.js
  147. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/subexpr.js
  148. +56 −0 ...ry/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/test/super_deep.js
  149. +22 −0 ...ry/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/node_modules/traverse/testling/leaves.js
  150. +35 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/package.json
  151. +22 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/test/circular.js
  152. +76 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/test/fn.js
  153. +66 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/test/proto.js
  154. +141 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/test/scrub.js
  155. +89 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/test/wrap.js
  156. +23 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode-protocol/testling/test.sh
  157. +3 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/.travis.yml
  158. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/LICENSE
  159. +319 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/README.markdown
  160. +21 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/bin/bundle.js
  161. +1 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/browser/bundle.js
  162. +69 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/browser/index.js
  163. +30 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/auth/client.js
  164. +18 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/auth/quotes.json
  165. +44 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/auth/server.js
  166. +21 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/bidirectional/client.js
  167. +12 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/bidirectional/server.js
  168. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/INSTALL.txt
  169. +67 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/chat.css
  170. +73 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/entry.js
  171. +23 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/index.html
  172. +7 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/package.json
  173. +50 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/chat/server.js
  174. +16 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/https/index.html
  175. +50 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/https/server.js
  176. +61 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/nested.js
  177. +15 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/perf/client.js
  178. +20 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/perf/emitter.js
  179. +83 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/saturate/index.html
  180. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/saturate/saturate.js
  181. +8 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/simple/client.js
  182. +6 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/simple/server.js
  183. +19 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-browserify/index.html
  184. +21 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-browserify/server.js
  185. +17 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-connect/index.html
  186. +14 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-connect/server.js
  187. +17 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-express/index.html
  188. +14 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-express/server.js
  189. +17 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-http/index.html
  190. +21 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/examples/web-http/server.js
  191. +301 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/index.js
  192. +112 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/lib/stream_socketio.js
  193. +1 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/.npmignore
  194. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/.travis.yml
  195. +4 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/LICENSE
  196. +115 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/README.markdown
  197. +358 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js
  198. +1 −0  ...nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/.npmignore
  199. +3 −0  ...odejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/.travis.yml
  200. +24 −0 ...om-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/LICENSE
  201. +258 −0 ...s/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/README.markdown
  202. +16 −0 .../node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/examples/json.js
  203. +15 −0 ...ode_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/examples/leaves.js
  204. +8 −0 ...e_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/examples/negative.js
  205. +10 −0 ...node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/examples/scrub.js
  206. +38 −0 ..._modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/examples/stringify.js
  207. +9 −0 ...om-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/fail.js
  208. +310 −0 ...m-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/index.js
  209. +47 −0 ...dejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/package.json
  210. +117 −0 .../node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/circular.js
  211. +37 −0 ...dejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/date.js
  212. +240 −0 ...ejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/equal.js
  213. +11 −0 ...ejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/error.js
  214. +15 −0 ...odejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/has.js
  215. +17 −0 .../node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/instance.js
  216. +43 −0 ...node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/interface.js
  217. +49 −0 ...dejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/json.js
  218. +31 −0 ...dejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/keys.js
  219. +22 −0 ...js/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/leaves.js
  220. +96 −0 ...modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/lib/deep_equal.js
  221. +300 −0 ...ode_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/mutability.js
  222. +21 −0 .../node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/negative.js
  223. +11 −0 ...odejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/obj.js
  224. +37 −0 .../node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/siblings.js
  225. +44 −0 ...dejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/stop.js
  226. +36 −0 ...node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/stringify.js
  227. +36 −0 ...s/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/subexpr.js
  228. +56 −0 ...ode_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/test/super_deep.js
  229. +22 −0 ...ode_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/node_modules/traverse/testling/leaves.js
  230. +35 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/package.json
  231. +57 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/args.js
  232. +22 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/circular.js
  233. +86 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/fn.js
  234. +76 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/proto.js
  235. +141 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/scrub.js
  236. +47 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/test/store.js
  237. +23 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/testling/test.sh
  238. +34 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/README.markdown
  239. +2 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/index.js
  240. +273 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/lib/parse.js
  241. +154 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/lib/stringify.js
  242. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/package.json
  243. +16 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/test/parse.js
  244. +15 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/jsonify/test/stringify.js
  245. +1 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/.npmignore
  246. +307 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/lazy.js
  247. +36 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/package.json
  248. +194 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/readme.txt
  249. +37 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/bucket.js
  250. +52 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/complex.js
  251. +32 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/custom.js
  252. +33 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/em.js
  253. +27 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/filter.js
  254. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/foldr.js
  255. +31 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/forEach.js
  256. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/head.js
  257. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/join.js
  258. +89 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/lines.js
  259. +29 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/map.js
  260. +38 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/pipe.js
  261. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/product.js
  262. +272 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/range.js
  263. +27 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/skip.js
  264. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/sum.js
  265. +27 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/tail.js
  266. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/take.js
  267. +26 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/lazy/test/takeWhile.js
  268. +2 −0  binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/.npmignore
  269. +125 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/History.md
  270. +23 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/Makefile
  271. +246 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/README.md
  272. +9 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/bin/browserify.js
  273. +278 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/bin/builder.js
  274. BIN  ...phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/dist/WebSocketMain.swf
  275. BIN  ...nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/dist/WebSocketMainInsecure.swf
  276. +3,751 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/dist/browserify.js
  277. +3,750 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/dist/socket.io.js
  278. +2 −0  .../phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/dist/socket.io.min.js
  279. +184 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/events.js
  280. +206 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/io.js
  281. +322 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/json.js
  282. +242 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/namespace.js
  283. +262 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/parser.js
  284. +525 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/socket.js
  285. +239 −0 binary/phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transport.js
  286. +191 −0 ...-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/flashsocket.js
  287. +172 −0 ...tom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/htmlfile.js
  288. +255 −0 ...odejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/jsonp-polling.js
  289. +184 −0 ...om-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/websocket.js
  290. +155 −0 ...-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/xhr-polling.js
  291. +213 −0 .../phantom-nodejs/node_modules/phantom/node_modules/dnode/node_modules/socket.io-client/lib/transports/xhr.js
Sorry, we could not display the entire diff because too many files (977) changed.
View
4 binary/phantom-nodejs/iron.json
@@ -0,0 +1,4 @@
+{
+ "token": "TOKEN",
+ "project_id": "PROJECT_ID"
+}
View
36 binary/phantom-nodejs/nearme-slave.js
@@ -0,0 +1,36 @@
+var phantom = require('phantom');
+var fs = require('fs');
+
+var payloadIndex = -1;
+process.argv.forEach(function(val, index, array) {
+ if (val == "-payload") payloadIndex = index + 1;
+});
+var payload = JSON.parse(fs.readFileSync(process.argv[payloadIndex]));
+
+console.log("payload:", payload);
+
+var url = payload['url'];
+if (!url){
+ console.error("No url specified");
+ process.exit(1);
+}
+
+/*
+ * Render page to .png image file
+ */
+var output = 'screenshot.png';
+
+phantom.create(function(ph) {
+ return ph.createPage(function(page) {
+ page.viewportSize = { width: 800, height: 800 };
+ return page.open(url, function(status) {
+ if (status !== 'success') {
+ console.error('Unable to load the address!');
+ } else {
+ page.render(output);
+ console.log("page rendered to " + output);
+ }
+ ph.exit();
+ });
+ });
+});
View
40 binary/phantom-nodejs/nearme.js
@@ -0,0 +1,40 @@
+var phantom, iron_worker;
+
+phantom = require('phantom');
+
+iron_worker = require('iron_worker/lib/client');
+client = new iron_worker.Client({config_file: 'iron.json'});
+
+var search_text = 'Pizza';
+var url = 'https://maps.google.com/maps?q=' + encodeURI(search_text) + '+near+san+francisco';
+
+phantom.create(function(ph) {
+ return ph.createPage(function(page) {
+ return page.open(url, function(status) {
+ if (status !== 'success') {
+ console.log('Unable to access network');
+ ph.exit();
+ }
+ page.evaluate((function() {
+ var list = document.querySelectorAll('a.pp-more-content-link'), urls = [], i;
+ // limit to 10 records
+ for (i = 0; i < list.length && i < 10; i++) {
+ urls.push(list[i].href);
+ }
+ return urls;
+ }), function(result) {
+ var target_url, i;
+ console.log('Data is', result);
+ for (i = 0; i < result.length; i++) {
+ target_url = result[i];
+ // queue personal task for each page
+ client.tasks_create('phantom-node-slave', {url: target_url}, {}, function(error, body) {
+ return console.log(body);
+ });
+ }
+
+ return ph.exit();
+ });
+ });
+ });
+});
View
2  binary/phantom-nodejs/node_modules/iron_worker/.npmignore
@@ -0,0 +1,2 @@
+node_modules
+npm-debug.log
View
22 binary/phantom-nodejs/node_modules/iron_worker/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Iron.io, Inc
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
4 binary/phantom-nodejs/node_modules/iron_worker/Makefile
@@ -0,0 +1,4 @@
+build:
+ `npm bin`/coffee -o lib -c src/*.coffee
+
+all: build
View
2  binary/phantom-nodejs/node_modules/iron_worker/README.md
@@ -0,0 +1,2 @@
+iron_worker_node
+================
View
67 binary/phantom-nodejs/node_modules/iron_worker/lib/api_client.js
@@ -0,0 +1,67 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+ var APIClient, iron_core, version, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ require('pkginfo')(module);
+
+ version = this.version;
+
+ _ = require('underscore');
+
+ iron_core = require('iron_core');
+
+ APIClient = (function(_super) {
+
+ __extends(APIClient, _super);
+
+ APIClient.prototype.AWS_US_EAST_HOST = 'worker-aws-us-east-1.iron.io';
+
+ function APIClient(options) {
+ var default_options;
+ default_options = {
+ scheme: 'https',
+ host: this.AWS_US_EAST_HOST,
+ port: 443,
+ api_version: 2
+ };
+ APIClient.__super__.constructor.call(this, 'iron', 'worker', options, default_options, ['project_id', 'token', 'api_version']);
+ }
+
+ APIClient.prototype.version = function() {
+ return "iron_worker_node-" + version + " (" + (APIClient.__super__.version.call(this)) + ")";
+ };
+
+ APIClient.prototype.url = function() {
+ return APIClient.__super__.url.call(this) + this.options.api_version.toString() + '/';
+ };
+
+ APIClient.prototype.headers = function() {
+ return _.extend({}, APIClient.__super__.headers.call(this), {
+ 'Authorization': "OAuth " + this.options.token
+ });
+ };
+
+ APIClient.prototype.tasks_create = function(code_name, payload, options, cb) {
+ var parse_response_bind;
+ parse_response_bind = _.bind(this.parse_response, this);
+ return this.post("projects/" + this.options.project_id + "/tasks", {
+ 'tasks': [
+ _.extend({
+ 'code_name': code_name,
+ 'payload': payload
+ }, options)
+ ]
+ }, function(error, response, body) {
+ return parse_response_bind(error, response, body, cb);
+ });
+ };
+
+ return APIClient;
+
+ })(iron_core.Client);
+
+ module.exports.APIClient = APIClient;
+
+}).call(this);
View
36 binary/phantom-nodejs/node_modules/iron_worker/lib/client.js
@@ -0,0 +1,36 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+ var Client, api_client;
+
+ api_client = require('./api_client');
+
+ Client = (function() {
+
+ function Client(options) {
+ this.api = new api_client.APIClient(options);
+ }
+
+ Client.prototype.tasks_create = function(code_name, params, options, cb) {
+ var payload;
+ payload = '';
+ if (typeof params === 'string') {
+ payload = params;
+ } else {
+ payload = JSON.stringify(params);
+ }
+ return this.api.tasks_create(code_name, payload, options, function(error, body) {
+ if (!(error != null)) {
+ return cb(error, body.tasks[0]);
+ } else {
+ return cb(error, body);
+ }
+ });
+ };
+
+ return Client;
+
+ })();
+
+ module.exports.Client = Client;
+
+}).call(this);
View
2  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/.npmignore
@@ -0,0 +1,2 @@
+node_modules
+npm-debug.log
View
22 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Iron.io, Inc
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
4 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/Makefile
@@ -0,0 +1,4 @@
+build:
+ `npm bin`/coffee -o lib -c src/*.coffee
+
+all: build
View
2  binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/README.md
@@ -0,0 +1,2 @@
+iron_core_node
+==============
View
184 binary/phantom-nodejs/node_modules/iron_worker/node_modules/iron_core/lib/client.js
@@ -0,0 +1,184 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+ var Client, fs, request, version, _;
+
+ require('pkginfo')(module);
+
+ version = this.version;
+
+ _ = require('underscore');
+
+ fs = require('fs');
+
+ request = require('request');
+
+ Client = (function() {
+ var MAX_RETRIES;
+
+ MAX_RETRIES = 5;
+
+ function Client(company, product, options, default_options, extra_options_list) {
+ var core_default_options;
+ if (options == null) {
+ options = {};
+ }
+ if (default_options == null) {
+ default_options = {};
+ }
+ if (extra_options_list == null) {
+ extra_options_list = [];
+ }
+ core_default_options = {
+ user_agent: this.version()
+ };
+ this.options_list = ['scheme', 'host', 'port', 'user_agent'].concat(extra_options_list);
+ this.options = {};
+ this.load_from_hash('params', options);
+ this.load_from_config(company, product, options.config_file);
+ this.load_from_env(company.toUpperCase() + '_' + product.toUpperCase());
+ this.load_from_env(company.toUpperCase());
+ this.load_from_config(company, product, "./." + company + ".json");
+ this.load_from_config(company, product, "./" + company + ".json");
+ this.load_from_config(company, product, "~/." + company + ".json");
+ this.load_from_hash('defaults', default_options);
+ this.load_from_hash('defaults', core_default_options);
+ }
+
+ Client.prototype.version = function() {
+ return "iron_core_node-" + version;
+ };
+
+ Client.prototype.set_option = function(source, name, value) {
+ if ((!(this.options[name] != null)) && (value != null)) {
+ console.log("Setting " + name + " to '" + value + "' from " + source);
+ return this.options[name] = value;
+ }
+ };
+
+ Client.prototype.load_from_hash = function(source, hash) {
+ var option, _i, _len, _ref, _results;
+ if (hash != null) {
+ _ref = this.options_list;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ _results.push(this.set_option(source, option, hash[option]));
+ }
+ return _results;
+ }
+ };
+
+ Client.prototype.load_from_env = function(prefix) {
+ var option, _i, _len, _ref, _results;
+ _ref = this.options_list;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ _results.push(this.set_option('environment_variable', option, process.env[prefix + '_' + option.toUpperCase()]));
+ }
+ return _results;
+ };
+
+ Client.prototype.load_from_config = function(company, product, config_file) {
+ var config, real_config_file;
+ if (config_file != null) {
+ try {
+ real_config_file = config_file.replace(/^~/, process.env.HOME);
+ config = JSON.parse(fs.readFileSync(real_config_file));
+ this.load_from_hash(config_file, config["" + company + "_" + product]);
+ this.load_from_hash(config_file, config[company]);
+ return this.load_from_hash(config_file, config);
+ } catch (_error) {}
+ }
+ };
+
+ Client.prototype.headers = function() {
+ return {
+ 'User-Agent': this.options.user_agent
+ };
+ };
+
+ Client.prototype.url = function() {
+ return "" + this.options.scheme + "://" + this.options.host + ":" + this.options.port + "/";
+ };
+
+ Client.prototype.request = function(request_info, cb, retry) {
+ var request_bind;
+ if (retry == null) {
+ retry = 0;
+ }
+ request_bind = _.bind(this.request, this);
+ return request(request_info, function(error, response, body) {
+ var delay;
+ if (response.statusCode === 200) {
+ return cb(error, response, body);
+ } else {
+ if (response.statusCode === 503 && retry < this.MAX_RETRIES) {
+ delay = Math.pow(4, retry) * 100 * Math.random();
+ return _.delay(request_bind, delay, request_info, cb, retry + 1);
+ } else {
+ return cb(error, response, body);
+ }
+ }
+ });
+ };
+
+ Client.prototype.get = function(method, params, cb) {
+ var request_info;
+ request_info = {
+ method: 'GET',
+ uri: this.url() + method,
+ headers: this.headers(),
+ qs: params
+ };
+ return this.request(request_info, cb);
+ };
+
+ Client.prototype.post = function(method, params, cb) {
+ var request_info;
+ request_info = {
+ method: 'POST',
+ uri: this.url() + method,
+ headers: this.headers(),
+ json: params
+ };
+ return this.request(request_info, cb);
+ };
+
+ Client.prototype.put = function(method, params, cb) {
+ var request_info;
+ request_info = {
+ method: 'PUT',
+ uri: this.url() + method,
+ headers: this.headers(),
+ json: params
+ };
+ return this.request(request_info, cb);
+ };
+
+ Client.prototype["delete"] = function(method, params, cb) {
+ var request_info;
+ request_info = {
+ method: 'DELETE',
+ uri: this.url() + method,
+ headers: this.headers(),
+ qs: params
+ };
+ return this.request(request_info, cb);
+ };
+
+ Client.prototype.parse_response = function(error, response, body, cb) {
+ if (response.statusCode === 200) {
+ return cb(null, body);
+ } else {
+ return cb(new Error(body), null);
+ }
+ };
+
+ return Client;
+
+ })();
+
+ module.exports.Client = Client;
+
+}).call(this);
View
55 ...antom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/LICENSE
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
View
287 ...tom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/README.md
@@ -0,0 +1,287 @@
+# Request -- Simplified HTTP request method
+
+## Install
+
+<pre>
+ npm install request
+</pre>
+
+Or from source:
+
+<pre>
+ git clone git://github.com/mikeal/request.git
+ cd request
+ npm link
+</pre>
+
+## Super simple to use
+
+Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.
+
+```javascript
+var request = require('request');
+request('http://www.google.com', function (error, response, body) {
+ if (!error && response.statusCode == 200) {
+ console.log(body) // Print the google web page.
+ }
+})
+```
+
+## Streaming
+
+You can stream any response to a file stream.
+
+```javascript
+request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
+```
+
+You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.
+
+```javascript
+fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))
+```
+
+Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.
+
+```javascript
+request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))
+```
+
+Now let's get fancy.
+
+```javascript
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ if (req.method === 'PUT') {
+ req.pipe(request.put('http://mysite.com/doodle.png'))
+ } else if (req.method === 'GET' || req.method === 'HEAD') {
+ request.get('http://mysite.com/doodle.png').pipe(resp)
+ }
+ }
+})
+```
+
+You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:
+
+```javascript
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ var x = request('http://mysite.com/doodle.png')
+ req.pipe(x)
+ x.pipe(resp)
+ }
+})
+```
+
+And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)
+
+```javascript
+req.pipe(request('http://mysite.com/doodle.png')).pipe(resp)
+```
+
+Also, none of this new functionality conflicts with requests previous features, it just expands them.
+
+```javascript
+var r = request.defaults({'proxy':'http://localproxy.com'})
+
+http.createServer(function (req, resp) {
+ if (req.url === '/doodle.png') {
+ r.get('http://google.com/doodle.png').pipe(resp)
+ }
+})
+```
+
+You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
+
+## OAuth Signing
+
+```javascript
+// Twitter OAuth
+var qs = require('querystring')
+ , oauth =
+ { callback: 'http://mysite.com/callback/'
+ , consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ }
+ , url = 'https://api.twitter.com/oauth/request_token'
+ ;
+request.post({url:url, oauth:oauth}, function (e, r, body) {
+ // Assume by some stretch of magic you aquired the verifier
+ var access_token = qs.parse(body)
+ , oauth =
+ { consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ , token: access_token.oauth_token
+ , verifier: VERIFIER
+ , token_secret: access_token.oauth_token_secret
+ }
+ , url = 'https://api.twitter.com/oauth/access_token'
+ ;
+ request.post({url:url, oauth:oauth}, function (e, r, body) {
+ var perm_token = qs.parse(body)
+ , oauth =
+ { consumer_key: CONSUMER_KEY
+ , consumer_secret: CONSUMER_SECRET
+ , token: perm_token.oauth_token
+ , token_secret: perm_token.oauth_token_secret
+ }
+ , url = 'https://api.twitter.com/1/users/show.json?'
+ , params =
+ { screen_name: perm_token.screen_name
+ , user_id: perm_token.user_id
+ }
+ ;
+ url += qs.stringify(params)
+ request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {
+ console.log(user)
+ })
+ })
+})
+```
+
+
+
+### request(options, callback)
+
+The first argument can be either a url or an options object. The only required option is uri, all others are optional.
+
+* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()
+* `qs` - object containing querystring values to be appended to the uri
+* `method` - http method, defaults to GET
+* `headers` - http headers, defaults to {}
+* `body` - entity body for POST and PUT requests. Must be buffer or string.
+* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header.
+* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header.
+* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
+* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
+* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.
+* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.
+* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.
+* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.
+* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.
+* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request
+* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.
+* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.
+* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.
+* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section)
+
+
+The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer.
+
+## Convenience methods
+
+There are also shorthand methods for different HTTP METHODs and some other conveniences.
+
+### request.defaults(options)
+
+This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.
+
+### request.put
+
+Same as request() but defaults to `method: "PUT"`.
+
+```javascript
+request.put(url)
+```
+
+### request.post
+
+Same as request() but defaults to `method: "POST"`.
+
+```javascript
+request.post(url)
+```
+
+### request.head
+
+Same as request() but defaults to `method: "HEAD"`.
+
+```javascript
+request.head(url)
+```
+
+### request.del
+
+Same as request() but defaults to `method: "DELETE"`.
+
+```javascript
+request.del(url)
+```
+
+### request.get
+
+Alias to normal request method for uniformity.
+
+```javascript
+request.get(url)
+```
+### request.cookie
+
+Function that creates a new cookie.
+
+```javascript
+request.cookie('cookie_string_here')
+```
+### request.jar
+
+Function that creates a new cookie jar.
+
+```javascript
+request.jar()
+```
+
+
+## Examples:
+
+```javascript
+ var request = require('request')
+ , rand = Math.floor(Math.random()*100000000).toString()
+ ;
+ request(
+ { method: 'PUT'
+ , uri: 'http://mikeal.iriscouch.com/testjs/' + rand
+ , multipart:
+ [ { 'content-type': 'application/json'
+ , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})
+ }
+ , { body: 'I am an attachment' }
+ ]
+ }
+ , function (error, response, body) {
+ if(response.statusCode == 201){
+ console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)
+ } else {
+ console.log('error: '+ response.statusCode)
+ console.log(body)
+ }
+ }
+ )
+```
+Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent).
+
+```javascript
+var request = request.defaults({jar: false})
+request('http://www.google.com', function () {
+ request('http://images.google.com')
+})
+```
+
+If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:
+
+```javascript
+var j = request.jar()
+var request = request.defaults({jar:j})
+request('http://www.google.com', function () {
+ request('http://images.google.com')
+})
+```
+OR
+
+```javascript
+var j = request.jar()
+var cookie = request.cookie('your_cookie_here')
+j.add(cookie)
+request({url: 'http://www.google.com', jar: j}, function () {
+ request('http://images.google.com')
+})
+```
View
190 ...hantom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/aws.js
@@ -0,0 +1,190 @@
+
+/*!
+ * knox - auth
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto')
+ , parse = require('url').parse;
+
+/**
+ * Valid keys.
+ */
+
+var keys = [
+ 'acl'
+ , 'location'
+ , 'logging'
+ , 'notification'
+ , 'partNumber'
+ , 'policy'
+ , 'requestPayment'
+ , 'torrent'
+ , 'uploadId'
+ , 'uploads'
+ , 'versionId'
+ , 'versioning'
+ , 'versions'
+ , 'website'
+];
+
+/**
+ * Return an "Authorization" header value with the given `options`
+ * in the form of "AWS <key>:<signature>"
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.authorization = function(options){
+ return 'AWS ' + options.key + ':' + exports.sign(options);
+};
+
+/**
+ * Simple HMAC-SHA1 Wrapper
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.hmacSha1 = function(options){
+ return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64');
+};
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(options){
+ options.message = exports.stringToSign(options);
+ return exports.hmacSha1(options);
+};
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * Specifically to be used with S3 presigned URLs
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.signQuery = function(options){
+ options.message = exports.queryStringToSign(options);
+ return exports.hmacSha1(options);
+};
+
+/**
+ * Return a string for sign() with the given `options`.
+ *
+ * Spec:
+ *
+ * <verb>\n
+ * <md5>\n
+ * <content-type>\n
+ * <date>\n
+ * [headers\n]
+ * <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.stringToSign = function(options){
+ var headers = options.amazonHeaders || '';
+ if (headers) headers += '\n';
+ return [
+ options.verb
+ , options.md5
+ , options.contentType
+ , options.date.toUTCString()
+ , headers + options.resource
+ ].join('\n');
+};
+
+/**
+ * Return a string for sign() with the given `options`, but is meant exclusively
+ * for S3 presigned URLs
+ *
+ * Spec:
+ *
+ * <date>\n
+ * <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+exports.queryStringToSign = function(options){
+ return 'GET\n\n\n' +
+ options.date + '\n' +
+ options.resource;
+};
+
+/**
+ * Perform the following:
+ *
+ * - ignore non-amazon headers
+ * - lowercase fields
+ * - sort lexicographically
+ * - trim whitespace between ":"
+ * - join with newline
+ *
+ * @param {Object} headers
+ * @return {String}
+ * @api private
+ */
+
+exports.canonicalizeHeaders = function(headers){
+ var buf = []
+ , fields = Object.keys(headers);
+ for (var i = 0, len = fields.length; i < len; ++i) {
+ var field = fields[i]
+ , val = headers[field]
+ , field = field.toLowerCase();
+ if (0 !== field.indexOf('x-amz')) continue;
+ buf.push(field + ':' + val);
+ }
+ return buf.sort().join('\n');
+};
+
+/**
+ * Perform the following:
+ *
+ * - ignore non sub-resources
+ * - sort lexicographically
+ *
+ * @param {String} resource
+ * @return {String}
+ * @api private
+ */
+
+exports.canonicalizeResource = function(resource){
+ var url = parse(resource, true)
+ , path = url.pathname
+ , buf = [];
+
+ Object.keys(url.query).forEach(function(key){
+ if (!~keys.indexOf(key)) return;
+ var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]);
+ buf.push(key + val);
+ });
+
+ return path + (buf.length
+ ? '?' + buf.sort().join('&')
+ : '');
+};
View
128 ...antom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/aws2.js
@@ -0,0 +1,128 @@
+var crypto = require('crypto')
+
+// The Authentication Header
+//
+// The Amazon S3 REST API uses the standard HTTPAuthorization header to pass authentication information. (The name of the standard header is unfortunate because it carries authentication information, not authorization).Under the Amazon S3 authentication scheme, the Authorization header has the following form.
+//
+// Authorization: AWS AWSAccessKeyId:Signature
+//
+// Developers are issued an AWS Access Key ID and AWS SecretAccess Key when they register. For request authentication, theAWSAccessKeyId element identifies the secret key that was used to compute the signature, and (indirectly) the developer making the request.
+//
+// The Signature element is the RFC 2104HMAC-SHA1 of selected elements from the request, and so theSignature part of the Authorization header will vary from request to request. If the request signature calculated by the system matches theSignature included with the request, then the requester will have demonstrated possession to the AWSSecret Access Key. The request will then be processed under the identity, and with the authority, of the developer to whom the key was issued.
+//
+// Following is pseudo-grammar that illustrates the construction of the Authorization request header (\nmeans the Unicode code point U+000A commonly called newline).
+
+function authorizationHeader (accessKey) {
+ // Authorization = "AWS" + " " + AWSAccessKeyId + ":" + Signature;
+
+ var authorization = 'AWS' + " " + accessKey + ":" + signature()
+
+ return authorization
+}
+
+//
+
+function signature (secret, verb, md5, contenttype, date, amzheaders, bucket, path) {
+ // Signature = Base64( HMAC-SHA1( UTF-8-Encoding-Of( YourSecretAccessKeyID, StringToSign ) ) );
+
+ function encodeSignature (stringToSign) {
+ return crypto.createHash('sha1').update(stringToSign).digest('base64')
+ }
+
+ //
+ // StringToSign = HTTP-Verb + "\n" +
+ // Content-MD5 + "\n" +
+ // Content-Type + "\n" +
+ // Date + "\n" +
+ // CanonicalizedAmzHeaders +
+ // CanonicalizedResource;
+
+ function compileStringToSign () {
+ var s =
+ verb + '\n'
+ (md5 || '') + '\n'
+ (contenttype || '') + '\n'
+ date.toUTCString() + '\n'
+ canonicalizeAmzHeaders(amzheaders) +
+ canonicalizeResource()
+ return s
+ }
+
+ //
+ // CanonicalizedResource = [ "/" + Bucket ] +
+ // <HTTP-Request-URI, from the protocol name up to the query string> +
+ // [ sub-resource, if present. For example "?acl", "?location", "?logging", or "?torrent"];
+
+ function canonicalizeResource () {
+ return '/' + bucket + path
+ }
+
+ //
+ // CanonicalizedAmzHeaders = <described below>
+ //
+ // HMAC-SHA1 is an algorithm defined by RFC 2104 (go to RFC 2104 - Keyed-Hashing for Message Authentication ). The algorithm takes as input two byte-strings: a key and a message. For Amazon S3 Request authentication, use your AWS Secret Access Key (YourSecretAccessKeyID) as the key, and the UTF-8 encoding of the StringToSign as the message. The output of HMAC-SHA1 is also a byte string, called the digest. The Signature request parameter is constructed by Base64 encoding this digest.
+ // Request Canonicalization for Signing
+ //
+ // Recall that when the system receives an authenticated request, it compares the computed request signature with the signature provided in the request in StringToSign. For that reason, you must compute the signature using the same method used by Amazon S3. We call the process of putting a request in an agreed-upon form for signing "canonicalization".
+
+}
+
+
+
+// Constructing the CanonicalizedResource Element
+//
+// CanonicalizedResource represents the Amazon S3 resource targeted by the request. Construct it for a REST request as follows:
+//
+// Launch Process
+//
+// 1
+//
+//
+// Start with the empty string ("").
+//
+// 2
+//
+//
+// If the request specifies a bucket using the HTTP Host header (virtual hosted-style), append the bucket name preceded by a "/" (e.g., "/bucketname"). For path-style requests and requests that don't address a bucket, do nothing. For more information on virtual hosted-style requests, see Virtual Hosting of Buckets.
+//
+// 3
+//
+//
+// Append the path part of the un-decoded HTTP Request-URI, up-to but not including the query string.
+//
+// 4
+//
+//
+// If the request addresses a sub-resource, like ?versioning, ?location, ?acl, ?torrent, ?lifecycle, or ?versionid append the sub-resource, its value if it has one, and the question mark. Note that in case of multiple sub-resources, sub-resources must be lexicographically sorted by sub-resource name and separated by '&'. e.g. ?acl&versionId=value.
+//
+// The list of sub-resources that must be included when constructing the CanonicalizedResource Element are: acl, lifecycle, location, logging, notification, partNumber, policy, requestPayment, torrent, uploadId, uploads, versionId, versioning, versions and website.
+//
+// If the request specifies query string parameters overriding the response header values (see Get Object), append the query string parameters, and its values. When signing you do not encode these values. However, when making the request, you must encode these parameter values. The query string parameters in a GET request include response-content-type, response-content-language, response-expires, response-cache-control, response-content-disposition, response-content-encoding.
+//
+// The delete query string parameter must be including when creating the CanonicalizedResource for a Multi-Object Delete request.
+//
+// Elements of the CanonicalizedResource that come from the HTTP Request-URI should be signed literally as they appear in the HTTP request, including URL-Encoding meta characters.
+//
+// The CanonicalizedResource might be different than the HTTP Request-URI. In particular, if your request uses the HTTP Host header to specify a bucket, the bucket does appear in the HTTP Request-URI. However, the CanonicalizedResource continues to include the bucket. Query string parameters might also appear in the Request-URI but are not included in CanonicalizedResource. For more information, see Virtual Hosting of Buckets.
+// Constructing the CanonicalizedAmzHeaders Element
+//
+// To construct the CanonicalizedAmzHeaders part of StringToSign, select all HTTP request headers that start with 'x-amz-' (using a case-insensitive comparison) and use the following process.
+//
+// CanonicalizedAmzHeaders Process
+// 1 Convert each HTTP header name to lower-case. For example, 'X-Amz-Date' becomes 'x-amz-date'.
+// 2 Sort the collection of headers lexicographically by header name.
+// 3 Combine header fields with the same name into one "header-name:comma-separated-value-list" pair as prescribed by RFC 2616, section 4.2, without any white-space between values. For example, the two metadata headers 'x-amz-meta-username: fred' and 'x-amz-meta-username: barney' would be combined into the single header 'x-amz-meta-username: fred,barney'.
+// 4 "Unfold" long headers that span multiple lines (as allowed by RFC 2616, section 4.2) by replacing the folding white-space (including new-line) by a single space.
+// 5 Trim any white-space around the colon in the header. For example, the header 'x-amz-meta-username: fred,barney' would become 'x-amz-meta-username:fred,barney'
+// 6 Finally, append a new-line (U+000A) to each canonicalized header in the resulting list. Construct the CanonicalizedResource element by concatenating all headers in this list into a single string.
+//
+// Positional versus Named HTTP Header StringToSign Elements
+//
+// The first few header elements of StringToSign (Content-Type, Date, and Content-MD5) are positional in nature. StringToSign does not include the names of these headers, only their values from the request. In contrast, the 'x-amz-' elements are named; Both the header names and the header values appear in StringToSign.
+//
+// If a positional header called for in the definition of StringToSign is not present in your request, (Content-Type or Content-MD5, for example, are optional for PUT requests, and meaningless for GET requests), substitute the empty string ("") in for that position.
+// Time Stamp Requirement
+//
+// A valid time stamp (using either the HTTP Date header or an x-amz-date alternative) is mandatory for authenticated requests. Furthermore, the client time-stamp included with an authenticated request must be within 15 minutes of the Amazon S3 system time when the request is received. If not, the request will fail with the RequestTimeTooSkewed error status code. The intention of these restrictions is to limit the possibility that intercepted requests could be replayed by an adversary. For stronger protection against eavesdropping, use the HTTPS transport for authenticated requests.
+//
+// Some HTTP client libraries do not expose the ability to set the Date header for a request. If you have trouble including the value of the 'Date' header in the canonicalized headers, you can set the time-stamp for the request using an 'x-amz-date' header instead. The value of the x-amz-date header must be in one of the RFC 2616 formats (http://www.ietf.org/rfc/rfc2616.txt). When an x-amz-date header is present in a request, the system will ignore any Date header when computing the request signature. Therefore, if you include the x-amz-date header, use the empty string for the Date when constructing the StringToSign. See the next section for an example.
View
103 ...om-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/forever.js
@@ -0,0 +1,103 @@
+module.exports = ForeverAgent
+ForeverAgent.SSL = ForeverAgentSSL
+
+var util = require('util')
+ , Agent = require('http').Agent
+ , net = require('net')
+ , tls = require('tls')
+ , AgentSSL = require('https').Agent
+
+function ForeverAgent(options) {
+ var self = this
+ self.options = options || {}
+ self.requests = {}
+ self.sockets = {}
+ self.freeSockets = {}
+ self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets
+ self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets
+ self.on('free', function(socket, host, port) {
+ var name = host + ':' + port
+ if (self.requests[name] && self.requests[name].length) {
+ self.requests[name].shift().onSocket(socket)
+ } else if (self.sockets[name].length < self.minSockets) {
+ if (!self.freeSockets[name]) self.freeSockets[name] = []
+ self.freeSockets[name].push(socket)
+
+ // if an error happens while we don't use the socket anyway, meh, throw the socket away
+ function onIdleError() {
+ socket.destroy()
+ }
+ socket._onIdleError = onIdleError
+ socket.on('error', onIdleError)
+ } else {
+ // If there are no pending requests just destroy the
+ // socket and it will get removed from the pool. This
+ // gets us out of timeout issues and allows us to
+ // default to Connection:keep-alive.
+ socket.destroy();
+ }
+ })
+
+}
+util.inherits(ForeverAgent, Agent)
+
+ForeverAgent.defaultMinSockets = 5
+
+
+ForeverAgent.prototype.createConnection = net.createConnection
+ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest
+ForeverAgent.prototype.addRequest = function(req, host, port) {
+ var name = host + ':' + port
+ if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) {
+ var idleSocket = this.freeSockets[name].pop()
+ idleSocket.removeListener('error', idleSocket._onIdleError)
+ delete idleSocket._onIdleError
+ req._reusedSocket = true
+ req.onSocket(idleSocket)
+ } else {
+ this.addRequestNoreuse(req, host, port)
+ }
+}
+
+ForeverAgent.prototype.removeSocket = function(s, name, host, port) {
+ if (this.sockets[name]) {
+ var index = this.sockets[name].indexOf(s);
+ if (index !== -1) {
+ this.sockets[name].splice(index, 1);
+ }
+ } else if (this.sockets[name] && this.sockets[name].length === 0) {
+ // don't leak
+ delete this.sockets[name];
+ delete this.requests[name];
+ }
+
+ if (this.freeSockets[name]) {
+ var index = this.freeSockets[name].indexOf(s)
+ if (index !== -1) {
+ this.freeSockets[name].splice(index, 1)
+ if (this.freeSockets[name].length === 0) {
+ delete this.freeSockets[name]
+ }
+ }
+ }
+
+ if (this.requests[name] && this.requests[name].length) {
+ // If we have pending requests and a socket gets closed a new one
+ // needs to be created to take over in the pool for the one that closed.
+ this.createSocket(name, host, port).emit('free');
+ }
+}
+
+function ForeverAgentSSL (options) {
+ ForeverAgent.call(this, options)
+}
+util.inherits(ForeverAgentSSL, ForeverAgent)
+
+ForeverAgentSSL.prototype.createConnection = createConnectionSSL
+ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest
+
+function createConnectionSSL (port, host, options) {
+ options.port = port
+ options.host = host
+ return tls.connect(options)
+}
View
974 ...antom-nodejs/node_modules/iron_worker/node_modules/iron_core/node_modules/request/main.js
@@ -0,0 +1,974 @@
+// Copyright 2010-2012 Mikeal Rogers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+var http = require('http')
+ , https = false
+ , tls = false
+ , url = require('url')
+ , util = require('util')
+ , stream = require('stream')
+ , qs = require('querystring')
+ , mimetypes = require('./mimetypes')
+ , oauth = require('./oauth')
+ , uuid = require('./uuid')
+ , ForeverAgent = require('./forever')
+ , Cookie = require('./vendor/cookie')
+ , CookieJar = require('./vendor/cookie/jar')
+ , cookieJar = new CookieJar
+ , tunnel = require('./tunnel')
+ , aws = require('./aws')
+ ;
+
+if (process.logging) {
+ var log = process.logging('request')
+}
+
+try {
+ https = require('https')
+} catch (e) {}
+
+try {
+ tls = require('tls')
+} catch (e) {}
+
+function toBase64 (str) {
+ return (new Buffer(str || "", "ascii")).toString("base64")
+}
+
+// Hacky fix for pre-0.4.4 https
+if (https && !https.Agent) {
+ https.Agent = function (options) {
+ http.Agent.call(this, options)
+ }
+ util.inherits(https.Agent, http.Agent)
+ https.Agent.prototype._getConnection = function (host, port, cb) {
+ var s = tls.connect(port, host, this.options, function () {
+ // do other checks here?
+ if (cb) cb()
+ })
+ return s
+ }
+}
+
+function isReadStream (rs) {
+ if (rs.readable && rs.path && rs.mode) {
+ return true
+ }
+}
+
+function copy (obj) {
+ var o = {}
+ Object.keys(obj).forEach(function (i) {
+ o[i] = obj[i]
+ })
+ return o
+}
+
+var isUrl = /^https?:/
+
+var globalPool = {}
+
+function Request (options) {
+ stream.Stream.call(this)
+ this.readable = true
+ this.writable = true
+
+ if (typeof options === 'string') {
+ options = {uri:options}
+ }
+
+ var reserved = Object.keys(Request.prototype)
+ for (var i in options) {
+ if (reserved.indexOf(i) === -1) {
+ this[i] = options[i]
+ } else {
+ if (typeof options[i] === 'function') {
+ delete options[i]
+ }
+ }
+ }
+ options = copy(options)
+
+ this.init(options)
+}
+util.inherits(Request, stream.Stream)
+Request.prototype.init = function (options) {
+ var self = this
+
+ if (!options) options = {}
+
+ if (!self.pool && self.pool !== false) self.pool = globalPool
+ self.dests = []
+ self.__isRequestRequest = true
+
+ // Protect against double callback
+ if (!self._callback && self.callback) {
+ self._callback = self.callback
+ self.callback = function () {
+ if (self._callbackCalled) return // Print a warning maybe?
+ self._callback.apply(self, arguments)
+ self._callbackCalled = true
+ }
+ self.on('error', self.callback.bind())
+ self.on('complete', self.callback.bind(self, null))
+ }
+
+ if (self.url) {
+ // People use this property instead all the time so why not just support it.
+ self.uri = self.url
+ delete self.url
+ }
+
+ if (!self.uri) {
+ throw new Error("options.uri is a required argument")
+ } else {
+ if (typeof self.uri == "string") self.uri = url.parse(self.uri)
+ }
+ if (self.proxy) {
+ if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
+
+ // do the HTTP CONNECT dance using koichik/node-tunnel
+ if (http.globalAgent && self.uri.protocol === "https:") {
+ self.tunnel = true
+ var tunnelFn = self.proxy.protocol === "http:"
+ ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
+
+ var tunnelOptions = { proxy: { host: self.proxy.hostname
+ , port: +self.proxy.port
+ , proxyAuth: self.proxy.auth }
+ , ca: this.ca }
+
+ self.agent = tunnelFn(tunnelOptions)
+ self.tunnel = true
+ }
+ }
+
+ if (!self.uri.host || !self.uri.pathname) {
+ // Invalid URI: it may generate lot of bad errors, like "TypeError: Cannot call method 'indexOf' of undefined" in CookieJar
+ // Detect and reject it as soon as possible
+ var faultyUri = url.format(self.uri)
+ var message = 'Invalid URI "' + faultyUri + '"'
+ if (Object.keys(options).length === 0) {
+ // No option ? This can be the sign of a redirect
+ // As this is a case where the user cannot do anything (he didn't call request directly with this URL)
+ // he should be warned that it can be caused by a redirection (can save some hair)
+ message += '. This can be caused by a crappy redirection.'
+ }
+ self.emit('error', new Error(message))
+ return // This error was fatal
+ }
+
+ self._redirectsFollowed = self._redirectsFollowed || 0
+ self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10
+ self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true
+ self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false;
+ if (self.followRedirect || self.followAllRedirects)
+ self.redirects = self.redirects || []
+
+ self.headers = self.headers ? copy(self.headers) : {}
+
+ self.setHost = false
+ if (!self.headers.host) {
+ self.headers.host = self.uri.hostname
+ if (self.uri.port) {
+ if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') &&
+ !(self.uri.port === 443 && self.uri.protocol === 'https:') )
+ self.headers.host += (':'+self.uri.port)
+ }
+ self.setHost = true
+ }
+
+ self.jar(self._jar || options.jar)
+
+ if (!self.uri.pathname) {self.uri.pathname = '/'}
+ if (!self.uri.port) {
+ if (self.uri.protocol == 'http:') {self.uri.port = 80}
+ else if (self.uri.protocol == 'https:') {self.uri.port = 443}
+ }
+
+ if (self.proxy && !self.tunnel) {
+ self.port = self.proxy.port
+ self.host = self.proxy.hostname
+ } else {
+ self.port = self.uri.port
+ self.host = self.uri.hostname
+ }
+
+ self.clientErrorHandler = function (error) {
+ if (self._aborted) return
+
+ if (self.setHost) delete self.headers.host
+ if (self.req._reusedSocket && error.code === 'ECONNRESET'
+ && self.agent.addRequestNoreuse) {
+ self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
+ self.start()
+ self.req.end()
+ return
+ }
+ if (self.timeout && self.timeoutTimer) {
+ clearTimeout(self.timeoutTimer)
+ self.timeoutTimer = null
+ }
+ self.emit('error', error)
+ }
+
+ if (options.form) {
+ self.form(options.form)
+ }
+
+ if (options.oauth) {
+ self.oauth(options.oauth)
+ }
+
+ if (options.aws) {
+ self.aws(options.aws)
+ }
+
+ if (self.uri.auth && !self.headers.authorization) {
+ self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
+ }
+ if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) {
+ self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
+ }
+
+ if (options.qs) self.qs(options.qs)
+
+ if (self.uri.path) {
+ self.path = self.uri.path
+ } else {
+ self.path = self.uri.pathname + (self.uri.search || "")
+ }
+
+ if (self.path.length === 0) self.path = '/'
+
+ if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
+
+ if (options.json) {
+ self.json(options.json)
+ } else if (options.multipart) {
+ self.boundary = uuid()
+ self.multipart(options.multipart)
+ }
+
+ if (self.body) {
+ var length = 0
+ if (!Buffer.isBuffer(self.body)) {
+ if (Array.isArray(self.body)) {
+ for (var i = 0; i < self.body.length; i++) {
+ length += self.body[i].length
+ }
+ } else {
+ self.body = new Buffer(self.body)
+ length = self.body.length
+ }
+ } else {
+ length = self.body.length
+ }
+ if (length) {
+ self.headers['content-length'] = length
+ } else {
+ throw new Error('Argument error, options.body.')
+ }
+ }
+
+ var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
+ , defaultModules = {'http:':http, 'https:':https}
+ , httpModules = self.httpModules || {}
+ ;
+ self.httpModule = httpModules[protocol] || defaultModules[protocol]
+
+ if (!self.httpModule) throw new Error("Invalid protocol")
+
+ if (options.ca) self.ca = options.ca
+
+ if (!self.agent) {
+ if (options.agentOptions) self.agentOptions = options.agentOptions
+
+ if (options.agentClass) {
+ self.agentClass = options.agentClass
+ } else if (options.forever) {
+ self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL
+ } else {
+ self.agentClass = self.httpModule.Agent
+ }
+ }
+
+ if (self.pool === false) {
+ self.agent = false
+ } else {
+ self.agent = self.agent || self.getAgent()
+ if (self.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.maxSockets
+ }
+ if (self.pool.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.pool.maxSockets
+ }
+ }
+
+ self.once('pipe', function (src) {
+ if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.")
+ self.src = src
+ if (isReadStream(src)) {
+ if (!self.headers['content-type'] && !self.headers['Content-Type'])
+ self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1))
+ } else {
+ if (src.headers) {
+ for (var i in src.headers) {
+ if (!self.headers[i]) {
+ self.headers[i] = src.headers[i]
+ }
+ }
+ }
+ if (src.method && !self.method) {
+ self.method = src.method
+ }
+ }
+
+ self.on('pipe', function () {
+ console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
+ })
+ })
+
+ process.nextTick(function () {
+ if (self._aborted) return
+
+ if (self.body) {
+ if (Array.isArray(self.body)) {
+ self.body.forEach(function (part) {
+ self.write(part)
+ })
+ } else {
+ self.write(self.body)
+ }
+ self.end()
+ } else if (self.requestBodyStream) {
+ console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
+ self.requestBodyStream.pipe(self)
+ } else if (!self.src) {
+ if (self.method !== 'GET' && typeof self.method !== 'undefined') {
+ self.headers['content-length'] = 0;
+ }
+ self.end();
+ }
+ self.ntick = true
+ })
+}
+
+Request.prototype.getAgent = function () {
+ var Agent = this.agentClass
+ var options = {}
+ if (this.agentOptions) {
+ for (var i in this.agentOptions) {
+ options[i] = this.agentOptions[i]
+ }
+ }
+ if (this.ca) options.ca = this.ca
+
+ var poolKey = ''
+
+ // different types of agents are in different pools
+ if (Agent !== this.httpModule.Agent) {
+ poolKey += Agent.name
+ }
+
+ if (!this.httpModule.globalAgent) {
+ // node 0.4.x
+ options.host = this.host
+ options.port = this.port
+ if (poolKey) poolKey += ':'
+ poolKey += this.host + ':' + this.port
+ }
+
+ if (options.ca) {
+ if (poolKey) poolKey += ':'
+ poolKey += options.ca
+ }
+
+ if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) {
+ // not doing anything special. Use the globalAgent
+ return this.httpModule.globalAgent
+ }
+
+ // already generated an agent for this setting
+ if (this.pool[poolKey]) return this.pool[poolKey]
+
+ return this.pool[poolKey] = new Agent(options)
+}
+
+Request.prototype.start = function () {
+ var self = this
+
+ if (self._aborted) return
+
+ self._started = true
+ self.method = self.method || 'GET'
+ self.href = self.uri.href
+ if (log) log('%method %href', self)
+
+ if (self.src && self.src.stat && self.src.stat.size) {
+ self.headers['content-length'] = self.src.stat.size
+ }
+ if (self._aws) {
+ self.aws(self._aws, true)
+ }
+
+ self.req = self.httpModule.request(self, function (response) {
+ if (self._aborted) return
+ if (self._paused) response.pause()
+
+ self.response = response
+ response.request = self
+ response.toJSON = toJSON
+
+ if (self.httpModule === https &&
+ self.strictSSL &&
+ !response.client.authorized) {
+ var sslErr = response.client.authorizationError
+ self.emit('error', new Error('SSL Error: '+ sslErr))
+ return
+ }
+
+ if (self.setHost) delete self.headers.host
+ if (self.timeout && self.timeoutTimer) {
+ clearTimeout(self.timeoutTimer)
+ self.timeoutTimer = null
+ }
+
+ var addCookie = function (cookie) {
+ if (self._jar) self._jar.add(new Cookie(cookie))
+ else cookieJar.add(new Cookie(cookie))
+ }
+
+ if (response.headers['set-cookie'] && (!self._disableCookies)) {
+ if (Array.isArray(response.headers['set-cookie'])) response.headers['set-cookie'].forEach(addCookie)
+ else addCookie(response.headers['set-cookie'])
+ }
+
+ if (response.statusCode >= 300 && response.statusCode < 400 &&
+ (self.followAllRedirects ||
+ (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) &&
+ response.headers.location) {
+ if (self._redirectsFollowed >= self.maxRedirects) {
+ self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop."))
+ return
+ }
+ self._redirectsFollowed += 1
+
+ if (!isUrl.test(response.headers.location)) {
+ response.headers.location = url.resolve(self.uri.href, response.headers.location)
+ }
+ self.uri = response.headers.location
+ self.redirects.push(
+ { statusCode : response.statusCode
+ , redirectUri: response.headers.location
+ }
+ )
+ if (self.followAllRedirects) self.method = 'GET'
+ // self.method = 'GET'; // Force all redirects to use GET || commented out fixes #215
+ delete self.req
+ delete self.agent
+ delete self._started
+ delete self.body
+ if (self.headers) {
+ delete self.headers.host
+ }
+ if (log) log('Redirect to %uri', self)
+ self.init()
+ return // Ignore the rest of the response
+ } else {
+ self._redirectsFollowed = self._redirectsFollowed || 0
+ // Be a good stream and emit end when the response is finished.
+ // Hack to emit end on close because of a core bug that never fires end
+ response.on('close', function () {
+ if (!self._ended) self.response.emit('end')
+ })
+
+ if (self.encoding) {
+ if (self.dests.length !== 0) {
+ console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")
+ } else {
+ response.setEncoding(self.encoding)
+ }
+ }
+
+ self.dests.forEach(function (dest) {
+ self.pipeDest(dest)
+ })
+
+ response.on("data", function (chunk) {
+ self._destdata = true
+ self.emit("data", chunk)
+ })
+ response.on("end", function (chunk) {
+ self._ended = true
+ self.emit("end", chunk)
+ })
+ response.on("close", function () {self.emit("close")})
+
+ self.emit('response', response)
+
+ if (self.callback) {
+ var buffer = []
+ var bodyLen = 0
+ self.on("data", function (chunk) {
+ buffer.push(chunk)
+ bodyLen += chunk.length
+ })
+ self.on("end", function () {
+ if (self._aborted) return
+
+ if (buffer.length && Buffer.isBuffer(buffer[0])) {
+ var body = new Buffer(bodyLen)
+ var i = 0
+ buffer.forEach(function (chunk) {
+ chunk.copy(body, i, 0, chunk.length)