Stuart P. Bentley <stuart@testtrack4.com>
Vaz Allen <vaz@tryptid.com>
elisee <elisee@sparklin.org>
+Evan You <yyx990803@gmail.com>
+Wil Moore III <wil.moore@wilmoore.com>
The `--no-bin-links` argument will prevent npm from creating symlinks for
any binaries the package might contain.
+The `--no-optional` argument will prevent optional dependencies from
+being installed.
+
The `--no-shrinkwrap` argument, which will ignore an available
shrinkwrap file and use the package.json instead.
## SYNOPSIS
- npm version [<newversion> | major | minor | patch | build]
+ npm version [<newversion> | major | minor | patch]
## DESCRIPTION
data back to the package.json file.
The `newversion` argument should be a valid semver string, *or* a valid
-second argument to semver.inc (one of "build", "patch", "minor", or
+second argument to semver.inc (one of "patch", "minor", or
"major"). In the second case, the existing version will be incremented
by 1 in the specified field.
## SYNOPSIS
npm repo <pkgname>
+ npm repo (with no args in a package dir)
## DESCRIPTION
This command tries to guess at the likely location of a package's
repository URL, and then tries to open it using the `--browser`
-config param.
+config param. If no package name is provided, it will search for
+a `package.json` in the current folder and try to use the property
+of the name field.
## CONFIGURATION
You should specify a license for your package so that people know how they are
permitted to use it, and any restrictions you're placing on it.
-The simplest way, assuming you're using a common license such as BSD or MIT, is
-to just specify the name of the license you're using, like this:
+The simplest way, assuming you're using a common license such as BSD-3-Clause
+or MIT, is to just specify the standard SPDX ID of the license you're using,
+like this:
- { "license" : "BSD" }
+ { "license" : "BSD-3-Clause" }
+
+You can check [the full list of SPDX license IDs](https://spdx.org/licenses/).
+Ideally you should pick one that is
+[OSI](http://opensource.org/licenses/alphabetical) approved.
If you have more complex licensing terms, or you want to provide more detail
in your package.json file, you can use the more verbose plural form, like this:
The value `npm init` should use by default for the package author's homepage.
+### init.license
+
+* Default: "BSD-2-Clause"
+* Type: String
+
+The value `npm init` should use by default for the package license.
+
### json
* Default: false
* <http://github.com/marcelklehr/nodist>
* <https://github.com/hakobera/nvmw>
+* <https://github.com/nanjingboy/nvmw>
## How can I use npm for development?
<ul><li><a href="cli/npm.html">npm(1)</a></li><li><a href="misc/npm-faq.html">npm-faq(7)</a></li><li><a href="cli/npm-help.html">npm-help(1)</a></li><li><a href="misc/npm-index.html">npm-index(7)</a></li></ul>
</div>
-<p id="footer"><a href="../doc/README.html">README</a> — npm@1.3.15</p>
+<p id="footer"><a href="../doc/README.html">README</a> — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function should not be used programmatically. Instead, just refer
to the <code>npm.bin</code> member.</p>
</div>
-<p id="footer">npm-bin — npm@1.3.15</p>
+<p id="footer">npm-bin — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">npm-bugs — npm@1.3.15</p>
+<p id="footer">npm-bugs — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-index.html">npm-index(7)</a></li></ul>
</div>
-<p id="footer">npm-commands — npm@1.3.15</p>
+<p id="footer">npm-commands — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">npm-config — npm@1.3.15</p>
+<p id="footer">npm-config — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/npm-publish.html">npm-publish(3)</a></li><li><a href="../api/npm-unpublish.html">npm-unpublish(3)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li></ul>
</div>
-<p id="footer">npm-deprecate — npm@1.3.15</p>
+<p id="footer">npm-deprecate — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">npm-docs — npm@1.3.15</p>
+<p id="footer">npm-docs — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Since this command opens an editor in a new process, be careful about where
and how this is used.</p>
</div>
-<p id="footer">npm-edit — npm@1.3.15</p>
+<p id="footer">npm-edit — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The first element in the 'args' parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.</p>
</div>
-<p id="footer">npm-explore — npm@1.3.15</p>
+<p id="footer">npm-explore — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The silent parameter is not neccessary not used, but it may in the future.</p>
</div>
-<p id="footer">npm-help-search — npm@1.3.15</p>
+<p id="footer">npm-help-search — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p><a href="../files/package.json.html">package.json(5)</a></p>
</div>
-<p id="footer">npm-init — npm@1.3.15</p>
+<p id="footer">npm-init — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when all packages have been
installed or when an error has been encountered.</p>
</div>
-<p id="footer">npm-install — npm@1.3.15</p>
+<p id="footer">npm-install — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Now, any changes to the redis package will be reflected in
the package in the current working directory</p>
</div>
-<p id="footer">npm-link — npm@1.3.15</p>
+<p id="footer">npm-link — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>For a list of all the available command-line configs, see <code>npm help config</code></p>
</div>
-<p id="footer">npm-load — npm@1.3.15</p>
+<p id="footer">npm-load — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
This means that if a submodule a same dependency as a parent module, then the
dependency will only be output once.</p>
</div>
-<p id="footer">npm-ls — npm@1.3.15</p>
+<p id="footer">npm-ls — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If the 'packages' parameter is left out, npm will check all packages.</p>
</div>
-<p id="footer">npm-outdated — npm@1.3.15</p>
+<p id="footer">npm-outdated — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/npm-publish.html">npm-publish(3)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li></ul>
</div>
-<p id="footer">npm-owner — npm@1.3.15</p>
+<p id="footer">npm-owner — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If no arguments are supplied, then npm packs the current package folder.</p>
</div>
-<p id="footer">npm-pack — npm@1.3.15</p>
+<p id="footer">npm-pack — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">npm-prefix — npm@1.3.15</p>
+<p id="footer">npm-prefix — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Extraneous packages are packages that are not listed on the parent
package's dependencies list.</p>
</div>
-<p id="footer">npm-prune — npm@1.3.15</p>
+<p id="footer">npm-prune — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li><li><a href="../api/npm-owner.html">npm-owner(3)</a></li></ul>
</div>
-<p id="footer">npm-publish — npm@1.3.15</p>
+<p id="footer">npm-publish — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>See <code>npm help build</code></p>
</div>
-<p id="footer">npm-rebuild — npm@1.3.15</p>
+<p id="footer">npm-rebuild — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/npm-start.html">npm-start(3)</a></li><li><a href="../api/npm-stop.html">npm-stop(3)</a></li></ul>
</div>
-<p id="footer">npm-restart — npm@1.3.15</p>
+<p id="footer">npm-restart — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically.</p>
</div>
-<p id="footer">npm-root — npm@1.3.15</p>
+<p id="footer">npm-root — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../api/npm-test.html">npm-test(3)</a></li><li><a href="../api/npm-start.html">npm-start(3)</a></li><li><a href="../api/npm-restart.html">npm-restart(3)</a></li><li><a href="../api/npm-stop.html">npm-stop(3)</a></li></ul>
</div>
-<p id="footer">npm-run-script — npm@1.3.15</p>
+<p id="footer">npm-run-script — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
and doesn't try to read your mind (it doesn't do any verb tense matching or the
like).</p>
</div>
-<p id="footer">npm-search — npm@1.3.15</p>
+<p id="footer">npm-search — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when the shrinkwrap has
been saved.</p>
</div>
-<p id="footer">npm-shrinkwrap — npm@1.3.15</p>
+<p id="footer">npm-shrinkwrap — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">npm-start — npm@1.3.15</p>
+<p id="footer">npm-start — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run stop on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">npm-stop — npm@1.3.15</p>
+<p id="footer">npm-stop — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li>npm help json</li><li>git help submodule</li></ul>
</div>
-<p id="footer">npm-submodule — npm@1.3.15</p>
+<p id="footer">npm-submodule — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
used. For more information about how to set this config, check
<code>man 3 npm-config</code> for programmatic usage or <code>man npm-config</code> for cli usage.</p>
</div>
-<p id="footer">npm-tag — npm@1.3.15</p>
+<p id="footer">npm-tag — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">npm-test — npm@1.3.15</p>
+<p id="footer">npm-test — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when all packages have been
uninstalled or when an error has been encountered.</p>
</div>
-<p id="footer">npm-uninstall — npm@1.3.15</p>
+<p id="footer">npm-uninstall — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If no version is specified, or if all versions are removed then
the root package entry is removed from the registry entirely.</p>
</div>
-<p id="footer">npm-unpublish — npm@1.3.15</p>
+<p id="footer">npm-unpublish — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.</p>
</div>
-<p id="footer">npm-update — npm@1.3.15</p>
+<p id="footer">npm-update — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
parameter. The difference, however, is this function will fail if it does
not have exactly one element. The only element should be a version number.</p>
</div>
-<p id="footer">npm-version — npm@1.3.15</p>
+<p id="footer">npm-version — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>corresponding to the list of fields selected.</p>
</div>
-<p id="footer">npm-view — npm@1.3.15</p>
+<p id="footer">npm-view — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">npm-whoami — npm@1.3.15</p>
+<p id="footer">npm-whoami — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.3.15</p>
+<p>1.3.17</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<pre><code>var cmd = npm.deref("unp") // cmd === "unpublish"</code></pre>
</div>
-<p id="footer">npm — npm@1.3.15</p>
+<p id="footer">npm — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">repo — npm@1.3.15</p>
+<p id="footer">repo — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-owner.html">npm-owner(1)</a></li><li><a href="../cli/npm-whoami.html">npm-whoami(1)</a></li></ul>
</div>
-<p id="footer">npm-adduser — npm@1.3.15</p>
+<p id="footer">npm-adduser — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-prefix.html">npm-prefix(1)</a></li><li><a href="../cli/npm-root.html">npm-root(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-bin — npm@1.3.15</p>
+<p id="footer">npm-bin — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-docs.html">npm-docs(1)</a></li><li><a href="../cli/npm-view.html">npm-view(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li></ul>
</div>
-<p id="footer">npm-bugs — npm@1.3.15</p>
+<p id="footer">npm-bugs — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-link.html">npm-link(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li></ul>
</div>
-<p id="footer">npm-build — npm@1.3.15</p>
+<p id="footer">npm-build — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
</div>
-<p id="footer">npm-bundle — npm@1.3.15</p>
+<p id="footer">npm-bundle — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-pack.html">npm-pack(1)</a></li></ul>
</div>
-<p id="footer">npm-cache — npm@1.3.15</p>
+<p id="footer">npm-cache — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">npm-completion — npm@1.3.15</p>
+<p id="footer">npm-completion — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">npm-config — npm@1.3.15</p>
+<p id="footer">npm-config — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-ls.html">npm-ls(1)</a></li><li><a href="../cli/npm-update.html">npm-update(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
</div>
-<p id="footer">npm-dedupe — npm@1.3.15</p>
+<p id="footer">npm-dedupe — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li></ul>
</div>
-<p id="footer">npm-deprecate — npm@1.3.15</p>
+<p id="footer">npm-deprecate — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-view.html">npm-view(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li></ul>
</div>
-<p id="footer">npm-docs — npm@1.3.15</p>
+<p id="footer">npm-docs — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-explore.html">npm-explore(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-edit — npm@1.3.15</p>
+<p id="footer">npm-edit — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-submodule.html">npm-submodule(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-edit.html">npm-edit(1)</a></li><li><a href="../cli/npm-rebuild.html">npm-rebuild(1)</a></li><li><a href="../cli/npm-build.html">npm-build(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
</div>
-<p id="footer">npm-explore — npm@1.3.15</p>
+<p id="footer">npm-explore — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm.html">npm(1)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm-help.html">npm-help(1)</a></li></ul>
</div>
-<p id="footer">npm-help-search — npm@1.3.15</p>
+<p id="footer">npm-help-search — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm.html">npm(1)</a></li><li><a href="../../doc/README.html">README</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-help-search.html">npm-help-search(1)</a></li><li><a href="../misc/npm-index.html">npm-index(7)</a></li></ul>
</div>
-<p id="footer">npm-help — npm@1.3.15</p>
+<p id="footer">npm-help — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="https://github.com/isaacs/init-package-json">https://github.com/isaacs/init-package-json</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-version.html">npm-version(1)</a></li></ul>
</div>
-<p id="footer">npm-init — npm@1.3.15</p>
+<p id="footer">npm-init — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The <code>--no-bin-links</code> argument will prevent npm from creating symlinks for
any binaries the package might contain.</p>
+<p>The <code>--no-optional</code> argument will prevent optional dependencies from
+being installed.</p>
+
<p>The <code>--no-shrinkwrap</code> argument, which will ignore an available
shrinkwrap file and use the package.json instead.</p>
<ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-update.html">npm-update(1)</a></li><li><a href="../cli/npm-link.html">npm-link(1)</a></li><li><a href="../cli/npm-rebuild.html">npm-rebuild(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-build.html">npm-build(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-tag.html">npm-tag(1)</a></li><li><a href="../cli/npm-rm.html">npm-rm(1)</a></li><li><a href="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></li></ul>
</div>
-<p id="footer">npm-install — npm@1.3.15</p>
+<p id="footer">npm-install — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-link — npm@1.3.15</p>
+<p id="footer">npm-link — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
-<pre><code>npm@1.3.15 /path/to/npm
+<pre><code>npm@1.3.17 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5</code></pre>
<ul><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-link.html">npm-link(1)</a></li><li><a href="../cli/npm-prune.html">npm-prune(1)</a></li><li><a href="../cli/npm-outdated.html">npm-outdated(1)</a></li><li><a href="../cli/npm-update.html">npm-update(1)</a></li></ul>
</div>
-<p id="footer">npm-ls — npm@1.3.15</p>
+<p id="footer">npm-ls — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-update.html">npm-update(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li></ul>
</div>
-<p id="footer">npm-outdated — npm@1.3.15</p>
+<p id="footer">npm-outdated — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li><li><a href="../misc/npm-disputes.html">npm-disputes(7)</a></li></ul>
</div>
-<p id="footer">npm-owner — npm@1.3.15</p>
+<p id="footer">npm-owner — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-cache.html">npm-cache(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-pack — npm@1.3.15</p>
+<p id="footer">npm-pack — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-root.html">npm-root(1)</a></li><li><a href="../cli/npm-bin.html">npm-bin(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-prefix — npm@1.3.15</p>
+<p id="footer">npm-prefix — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-rm.html">npm-rm(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-ls.html">npm-ls(1)</a></li></ul>
</div>
-<p id="footer">npm-prune — npm@1.3.15</p>
+<p id="footer">npm-prune — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li><li><a href="../cli/npm-owner.html">npm-owner(1)</a></li><li><a href="../cli/npm-deprecate.html">npm-deprecate(1)</a></li><li><a href="../cli/npm-tag.html">npm-tag(1)</a></li></ul>
</div>
-<p id="footer">npm-publish — npm@1.3.15</p>
+<p id="footer">npm-publish — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-build.html">npm-build(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
</div>
-<p id="footer">npm-rebuild — npm@1.3.15</p>
+<p id="footer">npm-rebuild — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-run-script.html">npm-run-script(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-test.html">npm-test(1)</a></li><li><a href="../cli/npm-start.html">npm-start(1)</a></li><li><a href="../cli/npm-stop.html">npm-stop(1)</a></li></ul>
</div>
-<p id="footer">npm-restart — npm@1.3.15</p>
+<p id="footer">npm-restart — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-prune.html">npm-prune(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-rm — npm@1.3.15</p>
+<p id="footer">npm-rm — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-prefix.html">npm-prefix(1)</a></li><li><a href="../cli/npm-bin.html">npm-bin(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-root — npm@1.3.15</p>
+<p id="footer">npm-root — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-test.html">npm-test(1)</a></li><li><a href="../cli/npm-start.html">npm-start(1)</a></li><li><a href="../cli/npm-restart.html">npm-restart(1)</a></li><li><a href="../cli/npm-stop.html">npm-stop(1)</a></li></ul>
</div>
-<p id="footer">npm-run-script — npm@1.3.15</p>
+<p id="footer">npm-run-script — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-view.html">npm-view(1)</a></li></ul>
</div>
-<p id="footer">npm-search — npm@1.3.15</p>
+<p id="footer">npm-search — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-ls.html">npm-ls(1)</a></li></ul>
</div>
-<p id="footer">npm-shrinkwrap — npm@1.3.15</p>
+<p id="footer">npm-shrinkwrap — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-view.html">npm-view(1)</a></li><li><a href="../cli/npm-whoami.html">npm-whoami(1)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li></ul>
</div>
-<p id="footer">npm-star — npm@1.3.15</p>
+<p id="footer">npm-star — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-star.html">npm-star(1)</a></li><li><a href="../cli/npm-view.html">npm-view(1)</a></li><li><a href="../cli/npm-whoami.html">npm-whoami(1)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li></ul>
</div>
-<p id="footer">npm-stars — npm@1.3.15</p>
+<p id="footer">npm-stars — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-run-script.html">npm-run-script(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-test.html">npm-test(1)</a></li><li><a href="../cli/npm-restart.html">npm-restart(1)</a></li><li><a href="../cli/npm-stop.html">npm-stop(1)</a></li></ul>
</div>
-<p id="footer">npm-start — npm@1.3.15</p>
+<p id="footer">npm-start — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-run-script.html">npm-run-script(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-test.html">npm-test(1)</a></li><li><a href="../cli/npm-start.html">npm-start(1)</a></li><li><a href="../cli/npm-restart.html">npm-restart(1)</a></li></ul>
</div>
-<p id="footer">npm-stop — npm@1.3.15</p>
+<p id="footer">npm-stop — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../files/package.json.html">package.json(5)</a></li><li>git help submodule</li></ul>
</div>
-<p id="footer">npm-submodule — npm@1.3.15</p>
+<p id="footer">npm-submodule — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-dedupe.html">npm-dedupe(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-tag — npm@1.3.15</p>
+<p id="footer">npm-tag — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-run-script.html">npm-run-script(1)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-start.html">npm-start(1)</a></li><li><a href="../cli/npm-restart.html">npm-restart(1)</a></li><li><a href="../cli/npm-stop.html">npm-stop(1)</a></li></ul>
</div>
-<p id="footer">npm-test — npm@1.3.15</p>
+<p id="footer">npm-test — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-prune.html">npm-prune(1)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li></ul>
</div>
-<p id="footer">npm-uninstall — npm@1.3.15</p>
+<p id="footer">npm-uninstall — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-deprecate.html">npm-deprecate(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li><li><a href="../cli/npm-owner.html">npm-owner(1)</a></li></ul>
</div>
-<p id="footer">npm-unpublish — npm@1.3.15</p>
+<p id="footer">npm-unpublish — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-outdated.html">npm-outdated(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-ls.html">npm-ls(1)</a></li></ul>
</div>
-<p id="footer">npm-update — npm@1.3.15</p>
+<p id="footer">npm-update — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="SYNOPSIS">SYNOPSIS</h2>
-<pre><code>npm version [<newversion> | major | minor | patch | build]</code></pre>
+<pre><code>npm version [<newversion> | major | minor | patch]</code></pre>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
data back to the package.json file.</p>
<p>The <code>newversion</code> argument should be a valid semver string, <em>or</em> a valid
-second argument to semver.inc (one of "build", "patch", "minor", or
+second argument to semver.inc (one of "patch", "minor", or
"major"). In the second case, the existing version will be incremented
by 1 in the specified field.</p>
<ul><li><a href="../cli/npm-init.html">npm-init(1)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../misc/semver.html">semver(7)</a></li></ul>
</div>
-<p id="footer">npm-version — npm@1.3.15</p>
+<p id="footer">npm-version — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-search.html">npm-search(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-docs.html">npm-docs(1)</a></li></ul>
</div>
-<p id="footer">npm-view — npm@1.3.15</p>
+<p id="footer">npm-view — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li></ul>
</div>
-<p id="footer">npm-whoami — npm@1.3.15</p>
+<p id="footer">npm-whoami — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.3.15</p>
+<p>1.3.17</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<ul><li><a href="../cli/npm-help.html">npm-help(1)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../../doc/README.html">README</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-index.html">npm-index(7)</a></li><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">npm — npm@1.3.15</p>
+<p id="footer">npm — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="SYNOPSIS">SYNOPSIS</h2>
-<pre><code>npm repo <pkgname></code></pre>
+<pre><code>npm repo <pkgname>
+npm repo (with no args in a package dir)</code></pre>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p>This command tries to guess at the likely location of a package's
repository URL, and then tries to open it using the <code>--browser</code>
-config param.</p>
+config param. If no package name is provided, it will search for
+a <code>package.json</code> in the current folder and try to use the property
+of the name field.</p>
<h2 id="CONFIGURATION">CONFIGURATION</h2>
<ul><li><a href="../cli/npm-docs.html">npm-docs(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li></ul>
</div>
-<p id="footer">repo — npm@1.3.15</p>
+<p id="footer">repo — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-pack.html">npm-pack(1)</a></li><li><a href="../cli/npm-cache.html">npm-cache(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li></ul>
</div>
-<p id="footer">npm-folders — npm@1.3.15</p>
+<p id="footer">npm-folders — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-pack.html">npm-pack(1)</a></li><li><a href="../cli/npm-cache.html">npm-cache(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li></ul>
</div>
-<p id="footer">npm-folders — npm@1.3.15</p>
+<p id="footer">npm-folders — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>You should specify a license for your package so that people know how they are
permitted to use it, and any restrictions you're placing on it.</p>
-<p>The simplest way, assuming you're using a common license such as BSD or MIT, is
-to just specify the name of the license you're using, like this:</p>
+<p>The simplest way, assuming you're using a common license such as BSD-3-Clause
+or MIT, is to just specify the standard SPDX ID of the license you're using,
+like this:</p>
-<pre><code>{ "license" : "BSD" }</code></pre>
+<pre><code>{ "license" : "BSD-3-Clause" }</code></pre>
+
+<p>You can check <a href="https://spdx.org/licenses/">the full list of SPDX license IDs</a>.
+Ideally you should pick one that is
+<a href="http://opensource.org/licenses/alphabetical">OSI</a> approved.</p>
<p>If you have more complex licensing terms, or you want to provide more detail
in your package.json file, you can use the more verbose plural form, like this:</p>
<ul><li><a href="../misc/semver.html">semver(7)</a></li><li><a href="../cli/npm-init.html">npm-init(1)</a></li><li><a href="../cli/npm-version.html">npm-version(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../cli/npm-help.html">npm-help(1)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-rm.html">npm-rm(1)</a></li></ul>
</div>
-<p id="footer">package.json — npm@1.3.15</p>
+<p id="footer">package.json — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">npmrc — npm@1.3.15</p>
+<p id="footer">npmrc — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>You should specify a license for your package so that people know how they are
permitted to use it, and any restrictions you're placing on it.</p>
-<p>The simplest way, assuming you're using a common license such as BSD or MIT, is
-to just specify the name of the license you're using, like this:</p>
+<p>The simplest way, assuming you're using a common license such as BSD-3-Clause
+or MIT, is to just specify the standard SPDX ID of the license you're using,
+like this:</p>
-<pre><code>{ "license" : "BSD" }</code></pre>
+<pre><code>{ "license" : "BSD-3-Clause" }</code></pre>
+
+<p>You can check <a href="https://spdx.org/licenses/">the full list of SPDX license IDs</a>.
+Ideally you should pick one that is
+<a href="http://opensource.org/licenses/alphabetical">OSI</a> approved.</p>
<p>If you have more complex licensing terms, or you want to provide more detail
in your package.json file, you can use the more verbose plural form, like this:</p>
<ul><li><a href="../misc/semver.html">semver(7)</a></li><li><a href="../cli/npm-init.html">npm-init(1)</a></li><li><a href="../cli/npm-version.html">npm-version(1)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../cli/npm-help.html">npm-help(1)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-rm.html">npm-rm(1)</a></li></ul>
</div>
-<p id="footer">package.json — npm@1.3.15</p>
+<p id="footer">package.json — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The semantic versioner for npm</p>
</div>
-<p id="footer">npm-index — npm@1.3.15</p>
+<p id="footer">npm-index — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">npm-coding-style — npm@1.3.15</p>
+<p id="footer">npm-coding-style — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The value <code>npm init</code> should use by default for the package author's homepage.</p>
+<h3 id="init-license">init.license</h3>
+
+<ul><li>Default: "BSD-2-Clause"</li><li>Type: String</li></ul>
+
+<p>The value <code>npm init</code> should use by default for the package license.</p>
+
<h3 id="json">json</h3>
<ul><li>Default: false</li><li>Type: Boolean</li></ul>
<ul><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li><li><a href="../cli/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">npm-config — npm@1.3.15</p>
+<p id="footer">npm-config — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../cli/npm.html">npm(1)</a></li><li><a href="../cli/npm-init.html">npm-init(1)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li><li><a href="../cli/npm-publish.html">npm-publish(1)</a></li><li><a href="../cli/npm-adduser.html">npm-adduser(1)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li></ul>
</div>
-<p id="footer">npm-developers — npm@1.3.15</p>
+<p id="footer">npm-developers — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li><li><a href="../cli/npm-owner.html">npm-owner(1)</a></li></ul>
</div>
-<p id="footer">npm-disputes — npm@1.3.15</p>
+<p id="footer">npm-disputes — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Windows:</p>
-<ul><li><a href="http://github.com/marcelklehr/nodist">http://github.com/marcelklehr/nodist</a></li><li><a href="https://github.com/hakobera/nvmw">https://github.com/hakobera/nvmw</a></li></ul>
+<ul><li><a href="http://github.com/marcelklehr/nodist">http://github.com/marcelklehr/nodist</a></li><li><a href="https://github.com/hakobera/nvmw">https://github.com/hakobera/nvmw</a></li><li><a href="https://github.com/nanjingboy/nvmw">https://github.com/nanjingboy/nvmw</a></li></ul>
<h2 id="How-can-I-use-npm-for-development">How can I use npm for development?</h2>
<ul><li><a href="../cli/npm.html">npm(1)</a></li><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npm-folders.html">npm-folders(5)</a></li></ul>
</div>
-<p id="footer">npm-faq — npm@1.3.15</p>
+<p id="footer">npm-faq — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The semantic versioner for npm</p>
</div>
-<p id="footer">npm-index — npm@1.3.15</p>
+<p id="footer">npm-index — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-disputes.html">npm-disputes(7)</a></li></ul>
</div>
-<p id="footer">npm-registry — npm@1.3.15</p>
+<p id="footer">npm-registry — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../cli/npm-run-script.html">npm-run-script(1)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li></ul>
</div>
-<p id="footer">npm-scripts — npm@1.3.15</p>
+<p id="footer">npm-scripts — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../../doc/README.html">README</a></li><li><a href="../cli/npm-rm.html">npm-rm(1)</a></li><li><a href="../cli/npm-prune.html">npm-prune(1)</a></li></ul>
</div>
-<p id="footer">removing-npm — npm@1.3.15</p>
+<p id="footer">removing-npm — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
range.</li><li>maxSatisfying(versions, range): Return the highest version in the list
that satisfies the range, or null if none of them do.</li></ul>
</div>
-<p id="footer">semver — npm@1.3.15</p>
+<p id="footer">semver — npm@1.3.17</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
color:#669;
font-size:18px;
}
-spall a, .small a {
+small a, .small a {
text-decoration:underline;
}
del {
if (gitEnv_) return gitEnv_
gitEnv_ = {}
for (var k in process.env) {
- if (!~['GIT_PROXY_COMMAND','GIT_SSH'].indexOf(k) && k.match(/^GIT/)) continue
+ if (!~['GIT_PROXY_COMMAND','GIT_SSH','GIT_SSL_NO_VERIFY'].indexOf(k) && k.match(/^GIT/)) continue
gitEnv_[k] = process.env[k]
}
return gitEnv_
if (typeof cb_ !== "function") cb_ = name, name = ""
// if it's a tar, and not in place,
// then unzip to .tmp, add the tmp folder, and clean up tmp
- if (p.indexOf(npm.tmp) === 0)
+ if (pathIsInside(p, npm.tmp))
return addTmpTarball(p, name, shasum, cb_)
- if (p.indexOf(npm.cache) === 0) {
+ if (pathIsInside(p, npm.cache)) {
if (path.basename(p) !== "package.tgz") return cb_(new Error(
"Not a valid cache tarball name: "+p))
return addPlacedTarball(p, name, shasum, cb_)
if (typeof cb !== "function") cb = name, name = ""
// if it's a folder, then read the package.json,
// tar it to the proper place, and add the cache tar
- if (p.indexOf(npm.cache) === 0) return cb(new Error(
+ if (pathIsInside(p, npm.cache)) return cb(new Error(
"Adding a cache directory to the cache will make the world implode."))
readJson(path.join(p, "package.json"), false, function (er, data) {
er = needName(er, data)
mkdir(path.dirname(tgz), function (er, made) {
if (er) return cb(er)
- var fancy = p.indexOf(npm.tmp) !== 0
- && p.indexOf(npm.cache) !== 0
+ var fancy = !pathIsInside(p, npm.tmp)
+ && !pathIsInside(p, npm.cache)
tar.pack(tgz, p, data, fancy, function (er) {
if (er) {
log.error( "addLocalDirectory", "Could not pack %j to %j"
: (data && !data.version) ? new Error("No version provided")
: null
}
+
+function pathIsInside (potentialChild, parent) {
+ return path.relative(parent, potentialChild).indexOf('..') === -1
+}
// a=/path/to/node_modules/foo/node_modules/bar
// b=/path/to/node_modules/elk/node_modules/bar
// ==/path/to/node_modules/bar
- a = a.split(/\/node_modules\//)
- b = b.split(/\/node_modules\//)
+ var nmReg = new RegExp("\\" + path.sep + "node_modules\\" + path.sep)
+ a = a.split(nmReg)
+ b = b.split(nmReg)
var name = a.pop()
b.pop()
// find the longest chain that both A and B share.
// then push the name back on it, and join by /node_modules/
var res = []
for (var i = 0, al = a.length, bl = b.length; i < al && i < bl && a[i] === b[i]; i++);
- return a.slice(0, i).concat(name).join("/node_modules/")
+ return a.slice(0, i).concat(name).join(path.sep + "node_modules" + path.sep)
}) : undefined
return [item[0], { item: item
// where is /path/to/node_modules/foo/node_modules/bar
// for package "bar", but we need it to be just
// /path/to/node_modules/foo
- where = where.split(/\/node_modules\//)
+ var nmReg = new RegExp("\\" + path.sep + "node_modules\\" + path.sep)
+ where = where.split(nmReg)
where.pop()
- where = where.join("/node_modules/")
+ where = where.join(path.sep + "node_modules" + path.sep)
remove.push.apply(remove, others)
return npm.commands.install(where, what, cb)
module.exports = docs
-docs.usage = "npm docs <pkgname>"
+docs.usage = "npm docs <pkgname>"
+docs.usage += "\n"
+docs.usage += "npm docs ."
docs.completion = function (opts, cb) {
if (opts.conf.argv.remain.length > 2) return cb()
var npm = require("./npm.js")
, registry = npm.registry
- , log = require("npmlog")
, opener = require("opener")
+ , path = require('path')
+ , log = require('npmlog')
+
+function url (json) {
+ return json.homepage ? json.homepage : "https://npmjs.org/package/" + json.name
+}
function docs (args, cb) {
- if (!args.length) return cb(docs.usage)
- var project = args[0]
- var npmName = project.split("@").shift()
- registry.get(project + "/latest", 3600, function (er, d) {
+ var project = args[0] || '.'
+ , package = path.resolve(process.cwd(), "package.json")
+
+ if (project === '.') {
+ try {
+ var json = require(package)
+ if (!json.name) throw new Error('package.json does not have a valid "name" property')
+ project = json.name
+ } catch (e) {
+ log.error(e.message)
+ return cb(docs.usage)
+ }
+
+ return opener(url(json), { command: npm.config.get("browser") }, cb)
+ }
+
+ registry.get(project + "/latest", 3600, function (er, json) {
+ var github = "https://github.com/" + project + "#readme"
+
if (er) {
if (project.split("/").length !== 2) return cb(er)
-
- var url = "https://github.com/" + project + "#readme"
- return opener(url, { command: npm.config.get("browser") }, cb)
+ return opener(github, { command: npm.config.get("browser") }, cb)
}
- var homepage = d.homepage
- , repo = d.repository || d.repositories
- , url = homepage ? homepage
- : "https://npmjs.org/package/" + d.name
- opener(url, { command: npm.config.get("browser") }, cb)
+ return opener(url(json), { command: npm.config.get("browser") }, cb)
})
}
}
function formatResults (args, results, cb) {
+ if (!results) return cb(null)
+
var cols = Math.min(process.stdout.columns || Infinity, 80) + 1
var out = results.map(function (res, i, results) {
// npm help foo bar baz: search topics
if (args.length > 1 && args[0]) {
- return npm.commands["help-search"](args, num, cb)
+ return npm.commands["help-search"](args, argnum, cb)
}
var section = npm.deref(args[0]) || args[0]
, mkdir = require("mkdirp")
, lifecycle = require("./utils/lifecycle.js")
, archy = require("archy")
+ , isGitUrl = require("./utils/is-git-url.js")
function install (args, cb_) {
var hasArguments = !!args.length
return cb(null, [])
}
+ // if the target is a git repository, we always want to fetch it
+ var isGit = false
+ , maybeGit = what.split("@").pop()
+
+ if (maybeGit)
+ isGit = isGitUrl(url.parse(maybeGit))
+
if (!er &&
data &&
!context.explicit &&
context.family[data.name] === data.version &&
- !npm.config.get("force")) {
+ !npm.config.get("force") &&
+ !isGit) {
log.info("already installed", data.name + "@" + data.version)
return cb(null, [])
}
, asyncMap = require("slide").asyncMap
, npm = require("./npm.js")
, url = require("url")
+ , isGitUrl = require("./utils/is-git-url.js")
+ , color = require("ansicolors")
+ , styles = require("ansistyles")
+ , table = require("text-table")
function outdated (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
var dir = path.resolve(npm.dir, "..")
- outdated_(args, dir, {}, function (er, list) {
+ outdated_(args, dir, {}, 0, function (er, list) {
if (er || silent) return cb(er, list)
- var outList = list.map(makePretty)
- console.log(outList.join("\n"))
+ if (npm.config.get("json")) {
+ console.log(makeJSON(list))
+ } else {
+ var outList = list.map(makePretty)
+ var outTable = [[ styles.underline("Package")
+ , styles.underline("Current")
+ , styles.underline("Wanted")
+ , styles.underline("Latest")
+ , styles.underline("Location")
+ ]].concat(outList)
+ var tableOpts = { align: ["l", "r", "r", "r", "l"]
+ , stringLength: function(s) { return ansiTrim(s).length }
+ }
+ console.log(table(outTable, tableOpts))
+ }
cb(null, list)
})
}
if (!npm.config.get("global")) {
dir = path.relative(process.cwd(), dir)
}
- return dep + " " + dir
- + " current=" + (has || "MISSING")
- + " wanted=" + want
- + " latest=" + latest
+ return [ has === want ? color.yellow(dep) : color.red(dep)
+ , (has || "MISSING")
+ , color.green(want)
+ , color.magenta(latest)
+ , color.brightBlack(dirToPrettyLocation(dir))
+ ]
+}
+
+function ansiTrim (str) {
+ var r = new RegExp("\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|" +
+ "\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)", "g");
+ return str.replace(r, "")
}
-function outdated_ (args, dir, parentHas, cb) {
+function dirToPrettyLocation (dir) {
+ return dir.replace(/^node_modules[/\\]/, "")
+ .replace(/[[/\\]node_modules[/\\]/g, " > ")
+}
+
+function makeJSON (list) {
+ var out = {}
+ list.forEach(function (p) {
+ var dir = path.resolve(p[0], "node_modules", p[1])
+ if (!npm.config.get("global")) {
+ dir = path.relative(process.cwd(), dir)
+ }
+ out[p[1]] = { current: p[2]
+ , wanted: p[3]
+ , latest: p[4]
+ , location: dir
+ }
+ })
+ return JSON.stringify(out, null, 2)
+}
+
+function outdated_ (args, dir, parentHas, depth, cb) {
// get the deps from package.json, or {<dir/node_modules/*>:"*"}
// asyncMap over deps:
// shouldHave = cache.add(dep, req).version
// else if dep in args or args is empty
// return [dir, dep, has, shouldHave]
+ if (depth > npm.config.get("depth")) {
+ return cb(null, [])
+ }
var deps = null
readJson(path.resolve(dir, "package.json"), function (er, d) {
if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er)
// if has[dep] !== shouldHave[dep], then cb with the data
// otherwise dive into the folder
asyncMap(Object.keys(deps), function (dep, cb) {
- shouldUpdate(args, dir, dep, has, deps[dep], cb)
+ shouldUpdate(args, dir, dep, has, deps[dep], depth, cb)
}, cb)
}
}
-function shouldUpdate (args, dir, dep, has, req, cb) {
+function shouldUpdate (args, dir, dep, has, req, depth, cb) {
// look up the most recent version.
// if that's what we already have, or if it's not on the args list,
// then dive into it. Otherwise, cb() with the data.
outdated_( args
, path.resolve(dir, "node_modules", dep)
, has
+ , depth + 1
, cb )
}
return skip()
}
+ if (isGitUrl(url.parse(req)))
+ return doIt("git", "git")
+
var registry = npm.registry
// search for the latest package
registry.get(dep + "/latest", function (er, l) {
, opener = require("opener")
, github = require('github-url-from-git')
, githubUserRepo = require("github-url-from-username-repo")
+ , path = require("path")
+ , readJson = require("read-package-json")
+ , fs = require("fs")
function repo (args, cb) {
- if (!args.length) return cb(repo.usage)
- var n = args[0].split("@").shift()
+ var n = args.length && args[0].split("@").shift() || '.'
+ fs.stat(n, function (er, s) {
+ if (er && er.code === "ENOENT") return callRegistry(n, cb)
+ else if (er) return cb(er)
+ if (!s.isDirectory()) return callRegistry(n, cb)
+ readJson(path.resolve(n, "package.json"), function (er, d) {
+ if (er) return cb(er)
+ getUrlAndOpen(d, cb)
+ })
+ })
+}
+
+function getUrlAndOpen (d, cb) {
+ var r = d.repository;
+ if (!r) return cb(new Error('no repository'));
+ // XXX remove this when npm@v1.3.10 from node 0.10 is deprecated
+ // from https://github.com/isaacs/npm-www/issues/418
+ if (githubUserRepo(r.url))
+ r.url = githubUserRepo(r.url)
+ var url = github(r.url)
+ if (!url)
+ return cb(new Error('no repository: could not get url'))
+ opener(url, { command: npm.config.get("browser") }, cb)
+}
+
+function callRegistry (n, cb) {
registry.get(n + "/latest", 3600, function (er, d) {
if (er) return cb(er)
- var r = d.repository;
- if (!r) return cb(new Error('no repository'));
- // XXX remove this when npm@v1.3.10 from node 0.10 is deprecated
- // from https://github.com/isaacs/npm-www/issues/418
- if (githubUserRepo(r.url))
- r.url = githubUserRepo(r.url)
-
- var url = github(r.url)
- if (!url)
- return cb(new Error('no repository: could not get url'))
- opener(url, { command: npm.config.get("browser") }, cb)
+ getUrlAndOpen(d, cb)
})
}
, dep = ww[1]
, want = ww[3]
, what = dep + "@" + want
- , req = ww[4]
+ , req = ww[5]
, url = require('url')
// use the initial installation method (repo, tar, git) for updating
default:
log.error("", er.stack || er.message || er)
- log.error("", ["If you need help, you may report this log at:"
+ log.error("", ["If you need help, you may report this *entire* log,"
+ ,"including the npm and node versions, at:"
," <http://github.com/isaacs/npm/issues>"
- ,"or email it to:"
- ," <npm-@googlegroups.com>"
].join("\n"))
printStack = false
break
cb_(er)
}
- var doGit = !er && s.isDirectory()
+ var tags = npm.config.get('git-tag-version')
+ var doGit = !er && s.isDirectory() && tags
if (!doGit) return write(data, cb)
else checkGit(data, cb)
})
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "November 2013" "" ""
+.TH "NPM" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ADDUSER" "1" "November 2013" "" ""
+.TH "NPM\-ADDUSER" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-adduser\fR \-\- Add a registry user account
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "1" "November 2013" "" ""
+.TH "NPM\-BIN" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "1" "November 2013" "" ""
+.TH "NPM\-BUGS" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUILD" "1" "November 2013" "" ""
+.TH "NPM\-BUILD" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-build\fR \-\- Build a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUNDLE" "1" "November 2013" "" ""
+.TH "NPM\-BUNDLE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-bundle\fR \-\- REMOVED
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CACHE" "1" "November 2013" "" ""
+.TH "NPM\-CACHE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-cache\fR \-\- Manipulates packages cache
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMPLETION" "1" "November 2013" "" ""
+.TH "NPM\-COMPLETION" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-completion\fR \-\- Tab Completion for npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "1" "November 2013" "" ""
+.TH "NPM\-CONFIG" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration files
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEDUPE" "1" "November 2013" "" ""
+.TH "NPM\-DEDUPE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-dedupe\fR \-\- Reduce duplication
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "1" "November 2013" "" ""
+.TH "NPM\-DEPRECATE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "1" "November 2013" "" ""
+.TH "NPM\-DOCS" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "1" "November 2013" "" ""
+.TH "NPM\-EDIT" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "1" "November 2013" "" ""
+.TH "NPM\-EXPLORE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "1" "November 2013" "" ""
+.TH "NPM\-HELP\-SEARCH" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search npm help documentation
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP" "1" "November 2013" "" ""
+.TH "NPM\-HELP" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-help\fR \-\- Get help on npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INIT" "1" "November 2013" "" ""
+.TH "NPM\-INIT" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-init\fR \-\- Interactively create a package\.json file
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "1" "November 2013" "" ""
+.TH "NPM\-INSTALL" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- Install a package
any binaries the package might contain\.
.
.P
+The \fB\-\-no\-optional\fR argument will prevent optional dependencies from
+being installed\.
+.
+.P
The \fB\-\-no\-shrinkwrap\fR argument, which will ignore an available
shrinkwrap file and use the package\.json instead\.
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "1" "November 2013" "" ""
+.TH "NPM\-LINK" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "1" "November 2013" "" ""
+.TH "NPM\-LS" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
.IP "" 4
.
.nf
-npm@1.3.15 /path/to/npm
+npm@1.3.17 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "1" "November 2013" "" ""
+.TH "NPM\-OUTDATED" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "1" "November 2013" "" ""
+.TH "NPM\-OWNER" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "1" "November 2013" "" ""
+.TH "NPM\-PACK" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "1" "November 2013" "" ""
+.TH "NPM\-PREFIX" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "1" "November 2013" "" ""
+.TH "NPM\-PRUNE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "1" "November 2013" "" ""
+.TH "NPM\-PUBLISH" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "1" "November 2013" "" ""
+.TH "NPM\-REBUILD" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "1" "November 2013" "" ""
+.TH "NPM\-RESTART" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "November 2013" "" ""
+.TH "NPM\-RM" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "1" "November 2013" "" ""
+.TH "NPM\-ROOT" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "1" "November 2013" "" ""
+.TH "NPM\-RUN\-SCRIPT" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "1" "November 2013" "" ""
+.TH "NPM\-SEARCH" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "1" "November 2013" "" ""
+.TH "NPM\-SHRINKWRAP" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- Lock down dependency versions
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STAR" "1" "November 2013" "" ""
+.TH "NPM\-STAR" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-star\fR \-\- Mark your favorite packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STARS" "1" "November 2013" "" ""
+.TH "NPM\-STARS" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-stars\fR \-\- View packages marked as favorites
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "1" "November 2013" "" ""
+.TH "NPM\-START" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "1" "November 2013" "" ""
+.TH "NPM\-STOP" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "1" "November 2013" "" ""
+.TH "NPM\-SUBMODULE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "1" "November 2013" "" ""
+.TH "NPM\-TAG" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "1" "November 2013" "" ""
+.TH "NPM\-TEST" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "November 2013" "" ""
+.TH "NPM\-RM" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "1" "November 2013" "" ""
+.TH "NPM\-UNPUBLISH" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "1" "November 2013" "" ""
+.TH "NPM\-UPDATE" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "1" "November 2013" "" ""
+.TH "NPM\-VERSION" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
.SH "SYNOPSIS"
.
.nf
-npm version [<newversion> | major | minor | patch | build]
+npm version [<newversion> | major | minor | patch]
.
.fi
.
.
.P
The \fBnewversion\fR argument should be a valid semver string, \fIor\fR a valid
-second argument to semver\.inc (one of "build", "patch", "minor", or
+second argument to semver\.inc (one of "patch", "minor", or
"major")\. In the second case, the existing version will be incremented
by 1 in the specified field\.
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "1" "November 2013" "" ""
+.TH "NPM\-VIEW" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "1" "November 2013" "" ""
+.TH "NPM\-WHOAMI" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "November 2013" "" ""
+.TH "NPM" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
.fi
.
.SH "VERSION"
-1.3.15
+1.3.17
.
.SH "DESCRIPTION"
npm is the package manager for the Node JavaScript platform\. It puts
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REPO" "1" "November 2013" "" ""
+.TH "NPM\-REPO" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-repo\fR \-\- Open package repository page in the browser
.
.nf
npm repo <pkgname>
+npm repo (with no args in a package dir)
.
.fi
.
.SH "DESCRIPTION"
This command tries to guess at the likely location of a package\'s
repository URL, and then tries to open it using the \fB\-\-browser\fR
-config param\.
+config param\. If no package name is provided, it will search for
+a \fBpackage\.json\fR in the current folder and try to use the property
+of the name field\.
.
.SH "CONFIGURATION"
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "3" "November 2013" "" ""
+.TH "NPM\-BIN" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "3" "November 2013" "" ""
+.TH "NPM\-BUGS" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMMANDS" "3" "November 2013" "" ""
+.TH "NPM\-COMMANDS" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-commands\fR \-\- npm commands
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "3" "November 2013" "" ""
+.TH "NPM\-CONFIG" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration files
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "3" "November 2013" "" ""
+.TH "NPM\-DEPRECATE" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "3" "November 2013" "" ""
+.TH "NPM\-DOCS" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "3" "November 2013" "" ""
+.TH "NPM\-EDIT" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "3" "November 2013" "" ""
+.TH "NPM\-EXPLORE" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "3" "November 2013" "" ""
+.TH "NPM\-HELP\-SEARCH" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search the help pages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "INIT" "3" "November 2013" "" ""
+.TH "INIT" "3" "December 2013" "" ""
.
.SH "NAME"
\fBinit\fR \-\- Interactively create a package\.json file
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "3" "November 2013" "" ""
+.TH "NPM\-INSTALL" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- install a package programmatically
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "3" "November 2013" "" ""
+.TH "NPM\-LINK" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LOAD" "3" "November 2013" "" ""
+.TH "NPM\-LOAD" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-load\fR \-\- Load config settings
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "3" "November 2013" "" ""
+.TH "NPM\-LS" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "3" "November 2013" "" ""
+.TH "NPM\-OUTDATED" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "3" "November 2013" "" ""
+.TH "NPM\-OWNER" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "3" "November 2013" "" ""
+.TH "NPM\-PACK" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "3" "November 2013" "" ""
+.TH "NPM\-PREFIX" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "3" "November 2013" "" ""
+.TH "NPM\-PRUNE" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "3" "November 2013" "" ""
+.TH "NPM\-PUBLISH" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "3" "November 2013" "" ""
+.TH "NPM\-REBUILD" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "3" "November 2013" "" ""
+.TH "NPM\-RESTART" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "3" "November 2013" "" ""
+.TH "NPM\-ROOT" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "3" "November 2013" "" ""
+.TH "NPM\-RUN\-SCRIPT" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "3" "November 2013" "" ""
+.TH "NPM\-SEARCH" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "3" "November 2013" "" ""
+.TH "NPM\-SHRINKWRAP" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- programmatically generate package shrinkwrap file
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "3" "November 2013" "" ""
+.TH "NPM\-START" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "3" "November 2013" "" ""
+.TH "NPM\-STOP" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "3" "November 2013" "" ""
+.TH "NPM\-SUBMODULE" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "3" "November 2013" "" ""
+.TH "NPM\-TAG" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "3" "November 2013" "" ""
+.TH "NPM\-TEST" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNINSTALL" "3" "November 2013" "" ""
+.TH "NPM\-UNINSTALL" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-uninstall\fR \-\- uninstall a package programmatically
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "3" "November 2013" "" ""
+.TH "NPM\-UNPUBLISH" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "3" "November 2013" "" ""
+.TH "NPM\-UPDATE" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "3" "November 2013" "" ""
+.TH "NPM\-VERSION" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "3" "November 2013" "" ""
+.TH "NPM\-VIEW" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "3" "November 2013" "" ""
+.TH "NPM\-WHOAMI" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "3" "November 2013" "" ""
+.TH "NPM" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
.fi
.
.SH "VERSION"
-1.3.15
+1.3.17
.
.SH "DESCRIPTION"
This is the API documentation for npm\.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REPO" "3" "November 2013" "" ""
+.TH "NPM\-REPO" "3" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-repo\fR \-\- Open package repository page in the browser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "5" "November 2013" "" ""
+.TH "NPM\-FOLDERS" "5" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "5" "November 2013" "" ""
+.TH "NPM\-FOLDERS" "5" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "PACKAGE\.JSON" "5" "November 2013" "" ""
+.TH "PACKAGE\.JSON" "5" "December 2013" "" ""
.
.SH "NAME"
\fBpackage.json\fR \-\- Specifics of npm\'s package\.json handling
permitted to use it, and any restrictions you\'re placing on it\.
.
.P
-The simplest way, assuming you\'re using a common license such as BSD or MIT, is
-to just specify the name of the license you\'re using, like this:
+The simplest way, assuming you\'re using a common license such as BSD\-3\-Clause
+or MIT, is to just specify the standard SPDX ID of the license you\'re using,
+like this:
.
.IP "" 4
.
.nf
-{ "license" : "BSD" }
+{ "license" : "BSD\-3\-Clause" }
.
.fi
.
.IP "" 0
.
.P
+You can check the full list of SPDX license IDs \fIhttps://spdx\.org/licenses/\fR\|\.
+Ideally you should pick one that is OSI \fIhttp://opensource\.org/licenses/alphabetical\fR approved\.
+.
+.P
If you have more complex licensing terms, or you want to provide more detail
in your package\.json file, you can use the more verbose plural form, like this:
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPMRC" "5" "November 2013" "" ""
+.TH "NPMRC" "5" "December 2013" "" ""
.
.SH "NAME"
\fBnpmrc\fR \-\- The npm config files
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "PACKAGE\.JSON" "5" "November 2013" "" ""
+.TH "PACKAGE\.JSON" "5" "December 2013" "" ""
.
.SH "NAME"
\fBpackage.json\fR \-\- Specifics of npm\'s package\.json handling
permitted to use it, and any restrictions you\'re placing on it\.
.
.P
-The simplest way, assuming you\'re using a common license such as BSD or MIT, is
-to just specify the name of the license you\'re using, like this:
+The simplest way, assuming you\'re using a common license such as BSD\-3\-Clause
+or MIT, is to just specify the standard SPDX ID of the license you\'re using,
+like this:
.
.IP "" 4
.
.nf
-{ "license" : "BSD" }
+{ "license" : "BSD\-3\-Clause" }
.
.fi
.
.IP "" 0
.
.P
+You can check the full list of SPDX license IDs \fIhttps://spdx\.org/licenses/\fR\|\.
+Ideally you should pick one that is OSI \fIhttp://opensource\.org/licenses/alphabetical\fR approved\.
+.
+.P
If you have more complex licensing terms, or you want to provide more detail
in your package\.json file, you can use the more verbose plural form, like this:
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CODING\-STYLE" "7" "November 2013" "" ""
+.TH "NPM\-CODING\-STYLE" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-coding-style\fR \-\- npm\'s "funny" coding style
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "7" "November 2013" "" ""
+.TH "NPM\-CONFIG" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- More than you probably want to know about npm configuration
.P
The value \fBnpm init\fR should use by default for the package author\'s homepage\.
.
+.SS "init\.license"
+.
+.IP "\(bu" 4
+Default: "BSD\-2\-Clause"
+.
+.IP "\(bu" 4
+Type: String
+.
+.IP "" 0
+.
+.P
+The value \fBnpm init\fR should use by default for the package license\.
+.
.SS "json"
.
.IP "\(bu" 4
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEVELOPERS" "7" "November 2013" "" ""
+.TH "NPM\-DEVELOPERS" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-developers\fR \-\- Developer Guide
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DISPUTES" "7" "November 2013" "" ""
+.TH "NPM\-DISPUTES" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-disputes\fR \-\- Handling Module Name Disputes
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FAQ" "7" "November 2013" "" ""
+.TH "NPM\-FAQ" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-faq\fR \-\- Frequently Asked Questions
.IP "\(bu" 4
\fIhttps://github\.com/hakobera/nvmw\fR
.
+.IP "\(bu" 4
+\fIhttps://github\.com/nanjingboy/nvmw\fR
+.
.IP "" 0
.
.SH "How can I use npm for development?"
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INDEX" "7" "November 2013" "" ""
+.TH "NPM\-INDEX" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-index\fR \-\- Index of all npm documentation
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REGISTRY" "7" "November 2013" "" ""
+.TH "NPM\-REGISTRY" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-registry\fR \-\- The JavaScript Package Registry
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SCRIPTS" "7" "November 2013" "" ""
+.TH "NPM\-SCRIPTS" "7" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-scripts\fR \-\- How npm handles the "scripts" field
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REMOVAL" "1" "November 2013" "" ""
+.TH "NPM\-REMOVAL" "1" "December 2013" "" ""
.
.SH "NAME"
\fBnpm-removal\fR \-\- Cleaning the Slate
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "SEMVER" "7" "November 2013" "" ""
+.TH "SEMVER" "7" "December 2013" "" ""
.
.SH "NAME"
\fBsemver\fR \-\- The semantic versioner for npm
--- /dev/null
+Copyright 2013 Thorsten Lorenz.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# ansicolors [![build status](https://secure.travis-ci.org/thlorenz/ansicolors.png)](http://next.travis-ci.org/thlorenz/ansicolors)
+
+Functions that surround a string with ansicolor codes so it prints in color.
+
+In case you need styles, like `bold`, have a look at [ansistyles](https://github.com/thlorenz/ansistyles).
+
+## Installation
+
+ npm install ansicolors
+
+## Usage
+
+```js
+var colors = require('ansicolors');
+
+// foreground colors
+var redHerring = colors.red('herring');
+var blueMoon = colors.blue('moon');
+var brighBlueMoon = colors.brightBlue('moon');
+
+console.log(redHerring); // this will print 'herring' in red
+console.log(blueMoon); // this 'moon' in blue
+console.log(brightBlueMoon); // I think you got the idea
+
+// background colors
+console.log(colors.bgYellow('printed on yellow background'));
+console.log(colors.bgBrightBlue('printed on bright blue background'));
+
+// mixing background and foreground colors
+// below two lines have same result (order in which bg and fg are combined doesn't matter)
+console.log(colors.bgYellow(colors.blue('printed on yellow background in blue')));
+console.log(colors.blue(colors.bgYellow('printed on yellow background in blue')));
+```
+
+## Advanced API
+
+**ansicolors** allows you to access opening and closing escape sequences separately.
+
+```js
+var colors = require('ansicolors');
+
+function inspect(obj, depth) {
+ return require('util').inspect(obj, false, depth || 5, true);
+}
+
+console.log('open blue', inspect(colors.open.blue));
+console.log('close bgBlack', inspect(colors.close.bgBlack));
+
+// => open blue '\u001b[34m'
+// close bgBlack '\u001b[49m'
+```
+
+## Tests
+
+Look at the [tests](https://github.com/thlorenz/ansicolors/blob/master/test/ansicolors.js) to see more examples and/or run them via:
+
+ npm explore ansicolors && npm test
+
+## Alternatives
+
+**ansicolors** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool,
+I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).
--- /dev/null
+// ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm
+'use strict';
+
+var colorNums = {
+ white : 37
+ , black : 30
+ , blue : 34
+ , cyan : 36
+ , green : 32
+ , magenta : 35
+ , red : 31
+ , yellow : 33
+ , brightBlack : 90
+ , brightRed : 91
+ , brightGreen : 92
+ , brightYellow : 93
+ , brightBlue : 94
+ , brightMagenta : 95
+ , brightCyan : 96
+ , brightWhite : 97
+ }
+ , backgroundColorNums = {
+ bgBlack : 40
+ , bgRed : 41
+ , bgGreen : 42
+ , bgYellow : 43
+ , bgBlue : 44
+ , bgMagenta : 45
+ , bgCyan : 46
+ , bgWhite : 47
+ , bgBrightBlack : 100
+ , bgBrightRed : 101
+ , bgBrightGreen : 102
+ , bgBrightYellow : 103
+ , bgBrightBlue : 104
+ , bgBrightMagenta : 105
+ , bgBrightCyan : 106
+ , bgBrightWhite : 107
+ }
+ , open = {}
+ , close = {}
+ , colors = {}
+ ;
+
+Object.keys(colorNums).forEach(function (k) {
+ var o = open[k] = '\u001b[' + colorNums[k] + 'm';
+ var c = close[k] = '\u001b[39m';
+
+ colors[k] = function (s) {
+ return o + s + c;
+ };
+});
+
+Object.keys(backgroundColorNums).forEach(function (k) {
+ var o = open[k] = '\u001b[' + backgroundColorNums[k] + 'm';
+ var c = close[k] = '\u001b[49m';
+
+ colors[k] = function (s) {
+ return o + s + c;
+ };
+});
+
+module.exports = colors;
+colors.open = open;
+colors.close = close;
--- /dev/null
+{
+ "name": "ansicolors",
+ "version": "0.3.2",
+ "description": "Functions that surround a string with ansicolor codes so it prints in color.",
+ "main": "ansicolors.js",
+ "scripts": {
+ "test": "node test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/thlorenz/ansicolors.git"
+ },
+ "keywords": [
+ "ansi",
+ "colors",
+ "highlight",
+ "string"
+ ],
+ "author": {
+ "name": "Thorsten Lorenz",
+ "email": "thlorenz@gmx.de",
+ "url": "thlorenz.com"
+ },
+ "license": "MIT",
+ "readmeFilename": "README.md",
+ "gitHead": "858847ca28e8b360d9b70eee0592700fa2ab087d",
+ "readme": "# ansicolors [![build status](https://secure.travis-ci.org/thlorenz/ansicolors.png)](http://next.travis-ci.org/thlorenz/ansicolors)\n\nFunctions that surround a string with ansicolor codes so it prints in color.\n\nIn case you need styles, like `bold`, have a look at [ansistyles](https://github.com/thlorenz/ansistyles).\n\n## Installation\n\n npm install ansicolors\n\n## Usage\n\n```js\nvar colors = require('ansicolors');\n\n// foreground colors\nvar redHerring = colors.red('herring');\nvar blueMoon = colors.blue('moon');\nvar brighBlueMoon = colors.brightBlue('moon');\n\nconsole.log(redHerring); // this will print 'herring' in red\nconsole.log(blueMoon); // this 'moon' in blue\nconsole.log(brightBlueMoon); // I think you got the idea\n\n// background colors\nconsole.log(colors.bgYellow('printed on yellow background'));\nconsole.log(colors.bgBrightBlue('printed on bright blue background'));\n\n// mixing background and foreground colors\n// below two lines have same result (order in which bg and fg are combined doesn't matter)\nconsole.log(colors.bgYellow(colors.blue('printed on yellow background in blue')));\nconsole.log(colors.blue(colors.bgYellow('printed on yellow background in blue')));\n```\n\n## Advanced API\n\n**ansicolors** allows you to access opening and closing escape sequences separately.\n\n```js\nvar colors = require('ansicolors');\n\nfunction inspect(obj, depth) {\n return require('util').inspect(obj, false, depth || 5, true);\n}\n\nconsole.log('open blue', inspect(colors.open.blue));\nconsole.log('close bgBlack', inspect(colors.close.bgBlack));\n\n// => open blue '\\u001b[34m'\n// close bgBlack '\\u001b[49m'\n```\n\n## Tests\n\nLook at the [tests](https://github.com/thlorenz/ansicolors/blob/master/test/ansicolors.js) to see more examples and/or run them via: \n\n npm explore ansicolors && npm test\n\n## Alternatives\n\n**ansicolors** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, \nI'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).\n",
+ "bugs": {
+ "url": "https://github.com/thlorenz/ansicolors/issues"
+ },
+ "homepage": "https://github.com/thlorenz/ansicolors",
+ "_id": "ansicolors@0.3.2",
+ "_from": "ansicolors@latest"
+}
--- /dev/null
+'use strict';
+
+var assert = require('assert')
+ , colors = require('..')
+ , open = colors.open
+ , close = colors.close
+
+console.log('Foreground colors ..');
+
+assert.equal(colors.white('printed in white'), '\u001b[37mprinted in white\u001b[39m');
+
+assert.equal(colors.black('printed in black'), '\u001b[30mprinted in black\u001b[39m');
+assert.equal(colors.brightBlack('printed in bright black'), '\u001b[90mprinted in bright black\u001b[39m');
+
+assert.equal(colors.green('printed in green'), '\u001b[32mprinted in green\u001b[39m');
+assert.equal(colors.brightGreen('printed in bright green'), '\u001b[92mprinted in bright green\u001b[39m');
+
+assert.equal(colors.red('printed in red'), '\u001b[31mprinted in red\u001b[39m');
+assert.equal(colors.brightRed('printed in bright red'), '\u001b[91mprinted in bright red\u001b[39m');
+
+console.log('OK');
+
+console.log('Background colors ..');
+
+assert.equal(
+ colors.bgBlack('printed with black background')
+ , '\u001b[40mprinted with black background\u001b[49m'
+);
+
+assert.equal(
+ colors.bgYellow('printed with yellow background')
+ , '\u001b[43mprinted with yellow background\u001b[49m'
+);
+assert.equal(
+ colors.bgBrightYellow('printed with bright yellow background')
+ , '\u001b[103mprinted with bright yellow background\u001b[49m'
+);
+
+assert.equal(
+ colors.bgWhite('printed with white background')
+ , '\u001b[47mprinted with white background\u001b[49m'
+);
+
+console.log('OK');
+
+console.log('Mixing background and foreground colors ..');
+
+assert.equal(
+ colors.blue(colors.bgYellow('printed in blue with yellow background'))
+ , '\u001b[34m\u001b[43mprinted in blue with yellow background\u001b[49m\u001b[39m'
+);
+assert.equal(
+ colors.bgYellow(colors.blue('printed in blue with yellow background again'))
+ , '\u001b[43m\u001b[34mprinted in blue with yellow background again\u001b[39m\u001b[49m'
+);
+
+console.log('OK');
+
+console.log('Open ...');
+
+assert.equal(open.black, '\u001b[30m');
+assert.equal(open.bgYellow, '\u001b[43m');
+
+console.log('OK');
+
+console.log('Close ...');
+
+assert.equal(close.black, '\u001b[39m');
+assert.equal(close.bgYellow, '\u001b[49m');
+
+console.log('OK');
--- /dev/null
+Copyright 2013 Thorsten Lorenz.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles)
+
+Functions that surround a string with ansistyle codes so it prints in style.
+
+In case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).
+
+## Installation
+
+ npm install ansistyles
+
+## Usage
+
+```js
+var styles = require('ansistyles');
+
+console.log(styles.bright('hello world')); // prints hello world in 'bright' white
+console.log(styles.underline('hello world')); // prints hello world underlined
+console.log(styles.inverse('hello world')); // prints hello world black on white
+```
+
+## Combining with ansicolors
+
+Get the ansicolors module:
+
+ npm install ansicolors
+
+```js
+var styles = require('ansistyles')
+ , colors = require('ansicolors');
+
+ console.log(
+ // prints hello world underlined in blue on a green background
+ colors.bgGreen(colors.blue(styles.underline('hello world')))
+ );
+```
+
+## Tests
+
+Look at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via:
+
+ npm explore ansistyles && npm test
+
+## More Styles
+
+As you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available,
+but didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.
+
+I included them for completeness, but didn't show them in the examples because they seem to have no effect.
+
+### reset
+
+A style reset function is also included, please note however that this is not nestable.
+
+Therefore the below only underlines `hell` only, but not `world`.
+
+```js
+console.log(styles.underline('hell' + styles.reset('o') + ' world'));
+```
+
+It is essentially the same as:
+
+```js
+console.log(styles.underline('hell') + styles.reset('') + 'o world');
+```
+
+
+
+## Alternatives
+
+**ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool,
+I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).
--- /dev/null
+'use strict';
+
+/*
+ * Info: http://www.termsys.demon.co.uk/vtansi.htm#colors
+ * Following caveats
+ * bright - brightens the color (bold-blue is same as brigthtBlue)
+ * dim - nothing on Mac or Linux
+ * italic - nothing on Mac or Linux
+ * underline - underlines string
+ * blink - nothing on Mac or linux
+ * inverse - background becomes foreground and vice versa
+ *
+ * In summary, the only styles that work are:
+ * - bright, underline and inverse
+ * - the others are only included for completeness
+ */
+
+var styleNums = {
+ reset : [0, 22]
+ , bright : [1, 22]
+ , dim : [2, 22]
+ , italic : [3, 23]
+ , underline : [4, 24]
+ , blink : [5, 25]
+ , inverse : [7, 27]
+ }
+ , styles = {}
+ ;
+
+Object.keys(styleNums).forEach(function (k) {
+ styles[k] = function (s) {
+ var open = styleNums[k][0]
+ , close = styleNums[k][1];
+ return '\u001b[' + open + 'm' + s + '\u001b[' + close + 'm';
+ };
+});
+
+module.exports = styles;
--- /dev/null
+{
+ "name": "ansistyles",
+ "version": "0.1.3",
+ "description": "Functions that surround a string with ansistyle codes so it prints in style.",
+ "main": "ansistyles.js",
+ "scripts": {
+ "test": "node test/ansistyles.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/thlorenz/ansistyles.git"
+ },
+ "keywords": [
+ "ansi",
+ "style",
+ "terminal",
+ "console"
+ ],
+ "author": {
+ "name": "Thorsten Lorenz",
+ "email": "thlorenz@gmx.de",
+ "url": "thlorenz.com"
+ },
+ "license": "MIT",
+ "readmeFilename": "README.md",
+ "gitHead": "27bf1bc65231bcc7fd109bf13b13601b51f8cd04",
+ "readme": "# ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles)\n\nFunctions that surround a string with ansistyle codes so it prints in style.\n\nIn case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).\n\n## Installation\n\n npm install ansistyles\n\n## Usage\n\n```js\nvar styles = require('ansistyles');\n\nconsole.log(styles.bright('hello world')); // prints hello world in 'bright' white\nconsole.log(styles.underline('hello world')); // prints hello world underlined\nconsole.log(styles.inverse('hello world')); // prints hello world black on white\n```\n\n## Combining with ansicolors\n\nGet the ansicolors module:\n\n npm install ansicolors\n\n```js\nvar styles = require('ansistyles')\n , colors = require('ansicolors');\n\n console.log(\n // prints hello world underlined in blue on a green background\n colors.bgGreen(colors.blue(styles.underline('hello world'))) \n );\n```\n\n## Tests\n\nLook at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via: \n\n npm explore ansistyles && npm test\n\n## More Styles\n\nAs you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available,\nbut didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.\n\nI included them for completeness, but didn't show them in the examples because they seem to have no effect.\n\n### reset\n\nA style reset function is also included, please note however that this is not nestable.\n\nTherefore the below only underlines `hell` only, but not `world`.\n\n```js\nconsole.log(styles.underline('hell' + styles.reset('o') + ' world'));\n```\n\nIt is essentially the same as:\n\n```js\nconsole.log(styles.underline('hell') + styles.reset('') + 'o world');\n```\n\n\n\n## Alternatives\n\n**ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, \nI'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).\n",
+ "bugs": {
+ "url": "https://github.com/thlorenz/ansistyles/issues"
+ },
+ "homepage": "https://github.com/thlorenz/ansistyles",
+ "_id": "ansistyles@0.1.3",
+ "dist": {
+ "shasum": "b14f315fe763a2b3a88df9d3261a517e666c4615"
+ },
+ "_from": "ansistyles@0.1.3",
+ "_resolved": "https://registry.npmjs.org/ansistyles/-/ansistyles-0.1.3.tgz"
+}
--- /dev/null
+'use strict';
+/*jshint asi: true */
+var assert = require('assert')
+ , styles = require('../')
+
+function inspect(obj, depth) {
+ console.log(require('util').inspect(obj, false, depth || 5, true));
+}
+
+assert.equal(styles.reset('reset'), '\u001b[0mreset\u001b[22m', 'reset')
+assert.equal(styles.underline('underlined'), '\u001b[4munderlined\u001b[24m', 'underline')
+assert.equal(styles.bright('bright'), '\u001b[1mbright\u001b[22m', 'bright')
+assert.equal(styles.inverse('inversed'), '\u001b[7minversed\u001b[27m', 'inverse')
+
+console.log('OK');
, follow: this.follow
, filter: this.filter
, sort: this.props.sort
+ , hardlinks: this.props.hardlinks
}
}
var me = this
, props = me.props
, stat = props.follow ? "stat" : "lstat"
-
// console.error("Reader._stat", me._path, currentStat)
if (currentStat) process.nextTick(statCb.bind(null, null, currentStat))
else fs[stat](me._path, statCb)
me.size = props.size
var type = getType(props)
+ var handleHardlinks = props.hardlinks !== false
+
// special little thing for handling hardlinks.
- if (type !== "Directory" && props.nlink && props.nlink > 1) {
+ if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) {
var k = props.dev + ":" + props.ino
// console.error("Reader has nlink", me._path, k)
if (hardLinks[k] === me._path || !hardLinks[k]) hardLinks[k] = me._path
},
"name": "fstream",
"description": "Advanced file system stream things",
- "version": "0.1.24",
+ "version": "0.1.25",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream.git"
"bugs": {
"url": "https://github.com/isaacs/fstream/issues"
},
- "_id": "fstream@0.1.24",
- "_from": "fstream@latest"
+ "homepage": "https://github.com/isaacs/fstream",
+ "_id": "fstream@0.1.25",
+ "dist": {
+ "shasum": "deef2db7c7898357c2b37202212a9e5b36abc732"
+ },
+ "_from": "fstream@0.1.25",
+ "_resolved": "https://registry.npmjs.org/fstream/-/fstream-0.1.25.tgz"
}
: prompt('author')
}
-exports.license = prompt('license', 'BSD-2-Clause')
+exports.license = prompt('license', package.license ||
+ config.get('init.license') ||
+ 'BSD-2-Clause')
{
"name": "init-package-json",
- "version": "0.0.13",
+ "version": "0.0.14",
"main": "init-package-json.js",
"scripts": {
"test": "tap test/*.js"
"url": "https://github.com/isaacs/init-package-json/issues"
},
"homepage": "https://github.com/isaacs/init-package-json",
- "_id": "init-package-json@0.0.13",
+ "_id": "init-package-json@0.0.14",
"_from": "init-package-json@latest"
}
# Authors, sorted by whether or not they are me
Isaac Z. Schlueter <i@izs.me>
+Brian Cottingham <spiffytech@gmail.com>
Carlos Brito Lage <carlos@carloslage.net>
-Marko Mikulicic <marko.mikulicic@isti.cnr.it>
-Trent Mick <trentm@gmail.com>
+Jesse Dailey <jesse.dailey@gmail.com>
Kevin O'Hara <kevinohara80@gmail.com>
Marco Rogers <marco.rogers@gmail.com>
-Jesse Dailey <jesse.dailey@gmail.com>
+Mark Cavage <mcavage@gmail.com>
+Marko Mikulicic <marko.mikulicic@isti.cnr.it>
+Nathan Rajlich <nathan@tootallnate.net>
+Satheesh Natesan <snateshan@myspace-inc.com>
+Trent Mick <trentm@gmail.com>
+ashleybrener <ashley@starlogik.com>
+n4kz <n4kz@n4kz.com>
+++ /dev/null
-var LRU = require('lru-cache');
-
-var max = +process.argv[2] || 10240;
-var more = 102400;
-
-var cache = LRU({
- max: max, maxAge: 86400e3
-});
-
-// fill cache
-for (var i = 0; i < max; ++i) {
- cache.set(i, {});
-}
-
-var start = process.hrtime();
-
-// adding more items
-for ( ; i < max+more; ++i) {
- cache.set(i, {});
-}
-
-var end = process.hrtime(start);
-var msecs = end[0] * 1E3 + end[1] / 1E6;
-
-console.log('adding %d items took %d ms', more, msecs.toPrecision(5));
function naiveLength () { return 1 }
function LRUCache (options) {
- if (!(this instanceof LRUCache)) {
+ if (!(this instanceof LRUCache))
return new LRUCache(options)
- }
-
- var max
- if (typeof options === 'number') {
- max = options
- options = { max: max }
- }
-
- if (!options) options = {}
-
- max = options.max
-
- var lengthCalculator = options.length || naiveLength
-
- if (typeof lengthCalculator !== "function") {
- lengthCalculator = naiveLength
- }
- if (!max || !(typeof max === "number") || max <= 0 ) {
- // a little bit silly. maybe this should throw?
- max = Infinity
- }
-
- var allowStale = options.stale || false
+ if (typeof options === 'number')
+ options = { max: options }
- var maxAge = options.maxAge || null
+ if (!options)
+ options = {}
- var dispose = options.dispose
+ this._max = options.max
+ // Kind of weird to have a default max of Infinity, but oh well.
+ if (!this._max || !(typeof this._max === "number") || this._max <= 0 )
+ this._max = Infinity
- var cache = Object.create(null) // hash of items by key
- , lruList = Object.create(null) // list of items in order of use recency
- , mru = 0 // most recently used
- , lru = 0 // least recently used
- , length = 0 // number of items in the list
- , itemCount = 0
+ this._lengthCalculator = options.length || naiveLength
+ if (typeof this._lengthCalculator !== "function")
+ this._lengthCalculator = naiveLength
+ this._allowStale = options.stale || false
+ this._maxAge = options.maxAge || null
+ this._dispose = options.dispose
+ this.reset()
+}
- // resize the cache when the max changes.
- Object.defineProperty(this, "max",
- { set : function (mL) {
- if (!mL || !(typeof mL === "number") || mL <= 0 ) mL = Infinity
- max = mL
- // if it gets above double max, trim right away.
- // otherwise, do it whenever it's convenient.
- if (length > max) trim()
- }
- , get : function () { return max }
- , enumerable : true
- })
-
- // resize the cache when the lengthCalculator changes.
- Object.defineProperty(this, "lengthCalculator",
- { set : function (lC) {
- if (typeof lC !== "function") {
- lengthCalculator = naiveLength
- length = itemCount
- for (var key in cache) {
- cache[key].length = 1
- }
- } else {
- lengthCalculator = lC
- length = 0
- for (var key in cache) {
- cache[key].length = lengthCalculator(cache[key].value)
- length += cache[key].length
- }
+// resize the cache when the max changes.
+Object.defineProperty(LRUCache.prototype, "max",
+ { set : function (mL) {
+ if (!mL || !(typeof mL === "number") || mL <= 0 ) mL = Infinity
+ this._max = mL
+ if (this._length > this._max) trim(this)
+ }
+ , get : function () { return this._max }
+ , enumerable : true
+ })
+
+// resize the cache when the lengthCalculator changes.
+Object.defineProperty(LRUCache.prototype, "lengthCalculator",
+ { set : function (lC) {
+ if (typeof lC !== "function") {
+ this._lengthCalculator = naiveLength
+ this._length = this._itemCount
+ for (var key in this._cache) {
+ this._cache[key].length = 1
+ }
+ } else {
+ this._lengthCalculator = lC
+ this._length = 0
+ for (var key in this._cache) {
+ this._cache[key].length = this._lengthCalculator(this._cache[key].value)
+ this._length += this._cache[key].length
}
-
- if (length > max) trim()
- }
- , get : function () { return lengthCalculator }
- , enumerable : true
- })
-
- Object.defineProperty(this, "length",
- { get : function () { return length }
- , enumerable : true
- })
-
-
- Object.defineProperty(this, "itemCount",
- { get : function () { return itemCount }
- , enumerable : true
- })
-
- this.forEach = function (fn, thisp) {
- thisp = thisp || this
- var i = 0;
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- i++
- var hit = lruList[k]
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- del(hit)
- if (!allowStale) hit = undefined
- }
- if (hit) {
- fn.call(thisp, hit.value, hit.key, this)
}
- }
- }
- this.keys = function () {
- var keys = new Array(itemCount)
- var i = 0
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- var hit = lruList[k]
- keys[i++] = hit.key
+ if (this._length > this._max) trim(this)
}
- return keys
- }
-
- this.values = function () {
- var values = new Array(itemCount)
- var i = 0
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- var hit = lruList[k]
- values[i++] = hit.value
+ , get : function () { return this._lengthCalculator }
+ , enumerable : true
+ })
+
+Object.defineProperty(LRUCache.prototype, "length",
+ { get : function () { return this._length }
+ , enumerable : true
+ })
+
+
+Object.defineProperty(LRUCache.prototype, "itemCount",
+ { get : function () { return this._itemCount }
+ , enumerable : true
+ })
+
+LRUCache.prototype.forEach = function (fn, thisp) {
+ thisp = thisp || this
+ var i = 0;
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ i++
+ var hit = this._lruList[k]
+ if (this._maxAge && (Date.now() - hit.now > this._maxAge)) {
+ del(this, hit)
+ if (!this._allowStale) hit = undefined
}
- return values
- }
-
- this.reset = function () {
- if (dispose) {
- for (var k in cache) {
- dispose(k, cache[k].value)
- }
+ if (hit) {
+ fn.call(thisp, hit.value, hit.key, this)
}
- cache = {}
- lruList = {}
- lru = 0
- mru = 0
- length = 0
- itemCount = 0
}
+}
- // Provided for debugging/dev purposes only. No promises whatsoever that
- // this API stays stable.
- this.dump = function () {
- return cache
+LRUCache.prototype.keys = function () {
+ var keys = new Array(this._itemCount)
+ var i = 0
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ var hit = this._lruList[k]
+ keys[i++] = hit.key
}
+ return keys
+}
- this.dumpLru = function () {
- return lruList
+LRUCache.prototype.values = function () {
+ var values = new Array(this._itemCount)
+ var i = 0
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ var hit = this._lruList[k]
+ values[i++] = hit.value
}
+ return values
+}
- this.set = function (key, value) {
- if (hOP(cache, key)) {
- // dispose of the old one before overwriting
- if (dispose) dispose(key, cache[key].value)
- if (maxAge) cache[key].now = Date.now()
- cache[key].value = value
- this.get(key)
- return true
+LRUCache.prototype.reset = function () {
+ if (this._dispose && this._cache) {
+ for (var k in this._cache) {
+ this._dispose(k, this._cache[k].value)
}
+ }
- var len = lengthCalculator(value)
- var age = maxAge ? Date.now() : 0
- var hit = new Entry(key, value, mru++, len, age)
+ this._cache = Object.create(null) // hash of items by key
+ this._lruList = Object.create(null) // list of items in order of use recency
+ this._mru = 0 // most recently used
+ this._lru = 0 // least recently used
+ this._length = 0 // number of items in the list
+ this._itemCount = 0
+}
- // oversized objects fall out of cache automatically.
- if (hit.length > max) {
- if (dispose) dispose(key, value)
- return false
- }
+// Provided for debugging/dev purposes only. No promises whatsoever that
+// this API stays stable.
+LRUCache.prototype.dump = function () {
+ return this._cache
+}
- length += hit.length
- lruList[hit.lu] = cache[key] = hit
- itemCount ++
+LRUCache.prototype.dumpLru = function () {
+ return this._lruList
+}
- if (length > max) trim()
+LRUCache.prototype.set = function (key, value) {
+ if (hOP(this._cache, key)) {
+ // dispose of the old one before overwriting
+ if (this._dispose) this._dispose(key, this._cache[key].value)
+ if (this._maxAge) this._cache[key].now = Date.now()
+ this._cache[key].value = value
+ this.get(key)
return true
}
- this.has = function (key) {
- if (!hOP(cache, key)) return false
- var hit = cache[key]
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- return false
- }
- return true
- }
+ var len = this._lengthCalculator(value)
+ var age = this._maxAge ? Date.now() : 0
+ var hit = new Entry(key, value, this._mru++, len, age)
- this.get = function (key) {
- return get(key, true)
+ // oversized objects fall out of cache automatically.
+ if (hit.length > this._max) {
+ if (this._dispose) this._dispose(key, value)
+ return false
}
- this.peek = function (key) {
- return get(key, false)
- }
+ this._length += hit.length
+ this._lruList[hit.lu] = this._cache[key] = hit
+ this._itemCount ++
- function get (key, doUse) {
- var hit = cache[key]
- if (hit) {
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- del(hit)
- if (!allowStale) hit = undefined
- } else {
- if (doUse) use(hit)
- }
- if (hit) hit = hit.value
- }
- return hit
- }
+ if (this._length > this._max) trim(this)
+ return true
+}
- function use (hit) {
- shiftLU(hit)
- hit.lu = mru ++
- lruList[hit.lu] = hit
+LRUCache.prototype.has = function (key) {
+ if (!hOP(this._cache, key)) return false
+ var hit = this._cache[key]
+ if (this._maxAge && (Date.now() - hit.now > this._maxAge)) {
+ return false
}
+ return true
+}
- this.del = function (key) {
- del(cache[key])
- }
+LRUCache.prototype.get = function (key) {
+ return get(this, key, true)
+}
- function trim () {
- while (lru < mru && length > max)
- del(lruList[lru])
- }
+LRUCache.prototype.peek = function (key) {
+ return get(this, key, false)
+}
- function shiftLU(hit) {
- delete lruList[ hit.lu ]
- while (lru < mru && !lruList[lru]) lru ++
- }
+LRUCache.prototype.pop = function () {
+ var hit = this._lruList[this._lru]
+ del(this, hit)
+ return hit || null
+}
- function del(hit) {
- if (hit) {
- if (dispose) dispose(hit.key, hit.value)
- length -= hit.length
- itemCount --
- delete cache[ hit.key ]
- shiftLU(hit)
+LRUCache.prototype.del = function (key) {
+ del(this, this._cache[key])
+}
+
+function get (self, key, doUse) {
+ var hit = self._cache[key]
+ if (hit) {
+ if (self._maxAge && (Date.now() - hit.now > self._maxAge)) {
+ del(self, hit)
+ if (!self._allowStale) hit = undefined
+ } else {
+ if (doUse) use(self, hit)
}
+ if (hit) hit = hit.value
+ }
+ return hit
+}
+
+function use (self, hit) {
+ shiftLU(self, hit)
+ hit.lu = self._mru ++
+ self._lruList[hit.lu] = hit
+}
+
+function trim (self) {
+ while (self._lru < self._mru && self._length > self._max)
+ del(self, self._lruList[self._lru])
+}
+
+function shiftLU (self, hit) {
+ delete self._lruList[ hit.lu ]
+ while (self._lru < self._mru && !self._lruList[self._lru]) self._lru ++
+}
+
+function del (self, hit) {
+ if (hit) {
+ if (self._dispose) self._dispose(hit.key, hit.value)
+ self._length -= hit.length
+ self._itemCount --
+ delete self._cache[ hit.key ]
+ shiftLU(self, hit)
}
}
// classy, since V8 prefers predictable objects.
-function Entry (key, value, mru, len, age) {
+function Entry (key, value, lu, length, now) {
this.key = key
this.value = value
- this.lu = mru
- this.length = len
- this.now = age
+ this.lu = lu
+ this.length = length
+ this.now = now
}
})()
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
- "version": "2.3.1",
+ "version": "2.5.0",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
"type": "MIT",
"url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE"
},
- "contributors": [
- {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me"
- },
- {
- "name": "Carlos Brito Lage",
- "email": "carlos@carloslage.net"
- },
- {
- "name": "Marko Mikulicic",
- "email": "marko.mikulicic@isti.cnr.it"
- },
- {
- "name": "Trent Mick",
- "email": "trentm@gmail.com"
- },
- {
- "name": "Kevin O'Hara",
- "email": "kevinohara80@gmail.com"
- },
- {
- "name": "Marco Rogers",
- "email": "marco.rogers@gmail.com"
- },
- {
- "name": "Jesse Dailey",
- "email": "jesse.dailey@gmail.com"
- }
- ],
"readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/node-lru-cache/issues"
},
- "_id": "lru-cache@2.3.1",
- "dist": {
- "shasum": "b3adf6b3d856e954e2c390e6cef22081245a53d6"
- },
- "_from": "lru-cache@2.3.1",
- "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.3.1.tgz"
+ "homepage": "https://github.com/isaacs/node-lru-cache",
+ "_id": "lru-cache@2.5.0",
+ "_from": "lru-cache@latest"
}
t.equal(cache.get("a"), undefined)
t.end()
})
+
+test("pop the least used item", function (t) {
+ var cache = new LRU(3)
+ , last
+
+ cache.set("a", "A")
+ cache.set("b", "B")
+ cache.set("c", "C")
+
+ t.equal(cache.length, 3)
+ t.equal(cache.max, 3)
+
+ // Ensure we pop a, c, b
+ cache.get("b", "B")
+
+ last = cache.pop()
+ t.equal(last.key, "a")
+ t.equal(last.value, "A")
+ t.equal(cache.length, 2)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last.key, "c")
+ t.equal(last.value, "C")
+ t.equal(cache.length, 1)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last.key, "b")
+ t.equal(last.value, "B")
+ t.equal(cache.length, 0)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last, null)
+ t.equal(cache.length, 0)
+ t.equal(cache.max, 3)
+
+ t.end()
+})
"Cannot insert data into the registry without auth"))
}
- if (auth && !token) {
+ if (auth && !token && authRequired) {
remote.auth = new Buffer(auth, "base64").toString("utf8")
}
* {String | Array | null}
-A certificate authority string, or an array of CA strings. Only
+A certificate authority string (PEM encoded), or an array of CA strings. Only
relevant for HTTPS couches, of course.
Leave as `null` to use the default ca settings built into node.
+### couch.cert
+
+* {String | null}
+
+A client certificate (PEM encoded) used to support secure access to servers that require client certificate. Only
+relevant for HTTPS couches, of course.
+
+Leave as `null` when not supporting client certificates.
+
+### couch.key
+
+* {String | null}
+
+A private key string (PEM encoded) used to validate a client certificate. Only
+relevant for HTTPS couches, of course.
+
+Leave as `null` when not supporting client certificates.
+
### couch.strictSSL
* {Boolean | null}
else if (tok === 'basic')
tok = BASIC
+ // ensure that couch url ends with a slash
+ couch.pathname = couch.pathname.replace(/\/?$/, '/');
+
this.token = tok
this.couch = url.format(couch)
this.proxy = null
// couches, of course.
this.ca = null
+ // replace these with client certificate and private key if required by
+ // the server. Only relevant for HTTPS couches. These are passed to
+ // the request and then on to https and tls as-is.
+ this.cert = null
+ this.key = null
+
// set to boolean true or false to specify the strictSSL behavior.
// if left as null, then it'll use whatever node defaults to, which
// is false <=0.8.x, and true >=0.9.x
if (!body) cb = d, d = null
var h = {}
- , u = url.resolve(this.couch, p)
+ , u = url.resolve(this.couch, p.replace(/^\//, ''))
, req = { uri: u, headers: h, json: true, body: d, method: meth }
if (this.token === BASIC) {
if (this.ca)
req.ca = this.ca
+
+ if (this.cert)
+ req.cert = this.cert
+ if (this.key)
+ req.key = this.key
if (typeof this.strictSSL === 'boolean')
req.strictSSL = req.rejectUnauthorized = this.strictSSL
}
var h = { cookie: 'AuthSession=' + this.token.AuthSession }
- , u = url.resolve(this.couch, '/_session')
+ , u = url.resolve(this.couch, '_session')
, req = { uri: u, headers: h, json: true }
request.del(req, function (er, res, data) {
},
"name": "couch-login",
"description": "A module for doing logged-in requests to a couchdb server",
- "version": "0.1.18",
+ "version": "0.1.19",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/couch-login.git"
"devDependencies": {
"tap": "~0.2.4"
},
- "readme": "# couch-login\n\nThis module lets you log into couchdb to get a session token, then make\nrequests using that session. It is basically just a thin wrapper around\n[@mikeal's request module](https://github.com/mikeal/request).\n\nThis is handy if you want a user to take actions in a couchdb database\non behalf of a user, without having to store their couchdb username and\npassword anywhere. (You do need to store the AuthSession token\nsomewhere, though.)\n\n## Usage\n\n```javascript\nvar CouchLogin = require('couch-login')\n\n// Nothing about this module is http-server specific of course.\n// You could also use it to do authenticated requests against\n// a couchdb using sessions and storing the token somewhere else.\n\nhttp.createServer(function (req, res) {\n var couch = new CouchLogin('http://my-couch.iriscouch.com:5984/')\n\n // .. look up the token in the user's session or whatever ..\n // Look at couch.decorate(req, res) for more on doing that\n // automatically, below.\n\n if (sessionToken) {\n // this user already logged in.\n couch.token = sessionToken\n\n // now we can do things on their behalf, like:\n // 1. View their session info.\n // like doing request.get({ uri: couch + '/_session', ... })\n // but with the cookie and whatnot\n\n couch.get('/_session', function (er, resp, data) {\n // er = some kind of communication error.\n // resp = response object from the couchdb request.\n // data = parsed JSON response body.\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // now we have the session info, we know who this user is.\n // hitting couchdb for this on every request is kinda costly,\n // so maybe you should store the username wherever you're storing\n // the sessionToken. RedSess is a good util for this, if you're\n // into redis. And if you're not into redis, you're crazy,\n // because it is awesome.\n\n // now let's get the user record.\n // note that this will 404 for anyone other than the user,\n // unless they're a server admin.\n couch.get('/_users/org.couchdb.user:' + data.userCtx.name, etc)\n\n // PUTs and DELETEs will also use their session, of course, so\n // your validate_doc_update's will see their info in userCtx\n })\n\n } else {\n // don't have a sessionToken.\n // get a username and password from the post body or something.\n // maybe redirect to a /login page or something to ask for that.\n var login = { name: name, password: password }\n couch.login(login, function (er, resp, data) {\n // again, er is an error, resp is the response obj, data is the json\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // the data is something like\n // {\"ok\":true,\"name\":\"testuser\",\"roles\":[]}\n // and couch.token is the token you'll need to save somewhere.\n\n // at this point, you can start making authenticated requests to\n // couchdb, or save data in their session, or do whatever it is\n // that you need to do.\n\n res.statusCode = 200\n res.write(\"Who's got two thumbs and just logged you into couch?\\n\")\n setTimeout(function () {\n res.end(\"THIS GUY!\")\n }, 500)\n })\n }\n})\n```\n\n## Class: CouchLogin\n### new CouchLogin(couchdbUrl, token)\n\nCreate a new CouchLogin object bound to the couchdb url.\n\nIn addition to these, the `get`, `post`, `put`, and `del` methods all\nproxy to the associated method on [request](https://github.com/mikeal/request).\n\nHowever, as you'll note in the example above, only the pathname portion\nof the url is required. Urls will be appended to the couchdb url passed\ninto the constructor.\n\nIf you have to talk to more than one couchdb, then you'll need more than\none CouchLogin object, for somewhat obvious reasons.\n\nAll callbacks get called with the following arguments, which are exactly\nidentical to the arguments passed to a `request` callback.\n\n* `er` {Error | null} Set if a communication error happens.\n* `resp` {HTTP Response} The response from the request to couchdb\n* `data` {Object} The parsed JSON data from couch\n\nIf the token is the string \"anonymous\", then it will not attempt to log\nin before making requests. If the token is not \"anonymous\", then it\nmust be an object with the appropriate fields.\n\n### couch.token\n\n* {Object}\n\nAn object representing the couchdb session token. (Basically just a\ncookie and a timeout.)\n\nIf the token has already timed out, then setting it will have no effect.\n\n### couch.tokenSet\n\nIf set, this method is called whenever the token is saved.\n\nFor example, you could assign a function to this method to save the\ntoken into a redis session, a cookie, or in some other database.\n\nTakes a callback which should be called when the token is saved.\n\n### couch.tokenGet\n\nIf set, this method is called to look up the token on demand.\n\nThe inverse of couch.tokenSet. Takes a callback which is called with\nthe `cb(er || null, token)`.\n\n### couch.tokenDel\n\nIf set, this method is called to delete the token when it should be\ndiscarded.\n\nRelated to tokenGet and tokenSet. Takes a callback which should be\ncalled when the token is deleted.\n\n### couch.ca\n\n* {String | Array | null}\n\nA certificate authority string, or an array of CA strings. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` to use the default ca settings built into node.\n\n### couch.strictSSL\n\n* {Boolean | null}\n\nWhether or not to be strict about SSL connections. If left as null,\nthen use the default setting in node, which is true in node versions\n0.9.x and above, and false prior to 0.8.x.\n\nOnly relevant for HTTPS couches, of course.\n\n### couch.anonymous()\n\nReturn a new CouchLogin object that points at the same couchdb server,\nbut doesn't try to log in before making requests.\n\nThis is handy for situations where the user is not logged in at the\nmoment, but a request needs to be made anyway, and does not require\nauthorization.\n\n### couch.login(auth, callback)\n\n* `auth` {Object} The login details\n * `name` {String}\n * `password` {String}\n* `callback` {Function}\n\nWhen the callback is called, the `couch.token` will already have been\nset (assuming it worked!), so subsequent requests will be done as that\nuser.\n\n### couch.get(path, callback)\n\nGET the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.del(path, callback)\n\nDELETE the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.post(path, data, callback)\n\nPOST the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.put(path, data, callback)\n\nPUT the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.changePass(newAuth, callback)\n\nMust already be logged in. Updates the `_users` document with new salt\nand hash, and re-logs in with the new credentials. Callback is called\nwith the same arguments as login, or the first step of the process that\nfailed.\n\n### couch.signup(userData, callback)\n\nCreate a new user account. The userData must contain at least a `name`\nand `password` field. Any additional data will be copied to the user\nrecord. The `_id`, `name`, `roles`, `type`, `password_sha`, `salt`, and\n`date` fields are generated.\n\nAlso signs in as the newly created user, on successful account creation.\n\n### couch.deleteAccount(name, callback)\n\nDeletes a user account. If not logged in as the user, or a server\nadmin, then the request will fail.\n\nNote that this immediately invalidates any session tokens for the\ndeleted user account. If you are deleting the user's record, then you\nought to follow this with `couch.logout(callback)` so that it won't try\nto re-use the invalid session.\n\n### couch.logout(callback)\n\nDelete the session out of couchdb. This makes the token permanently\ninvalid, and deletes it.\n\n### couch.decorate(req, res)\n\nSet up `req.couch` and `res.couch` as references to this couch login\ninstance.\n\nAdditionall, if `req.session` or `res.session` is set, then it'll call\n`session.get('couch_token', cb)` as the tokenGet method,\n`session.set('couch_token', token, cb)` as the tokenSet method, and\n`session.del('couch_token', cb)` as the tokenDel method.\n\nThis works really nice with\n[RedSess](https://github.com/isaacs/redsess).\n",
+ "readme": "# couch-login\n\nThis module lets you log into couchdb to get a session token, then make\nrequests using that session. It is basically just a thin wrapper around\n[@mikeal's request module](https://github.com/mikeal/request).\n\nThis is handy if you want a user to take actions in a couchdb database\non behalf of a user, without having to store their couchdb username and\npassword anywhere. (You do need to store the AuthSession token\nsomewhere, though.)\n\n## Usage\n\n```javascript\nvar CouchLogin = require('couch-login')\n\n// Nothing about this module is http-server specific of course.\n// You could also use it to do authenticated requests against\n// a couchdb using sessions and storing the token somewhere else.\n\nhttp.createServer(function (req, res) {\n var couch = new CouchLogin('http://my-couch.iriscouch.com:5984/')\n\n // .. look up the token in the user's session or whatever ..\n // Look at couch.decorate(req, res) for more on doing that\n // automatically, below.\n\n if (sessionToken) {\n // this user already logged in.\n couch.token = sessionToken\n\n // now we can do things on their behalf, like:\n // 1. View their session info.\n // like doing request.get({ uri: couch + '/_session', ... })\n // but with the cookie and whatnot\n\n couch.get('/_session', function (er, resp, data) {\n // er = some kind of communication error.\n // resp = response object from the couchdb request.\n // data = parsed JSON response body.\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // now we have the session info, we know who this user is.\n // hitting couchdb for this on every request is kinda costly,\n // so maybe you should store the username wherever you're storing\n // the sessionToken. RedSess is a good util for this, if you're\n // into redis. And if you're not into redis, you're crazy,\n // because it is awesome.\n\n // now let's get the user record.\n // note that this will 404 for anyone other than the user,\n // unless they're a server admin.\n couch.get('/_users/org.couchdb.user:' + data.userCtx.name, etc)\n\n // PUTs and DELETEs will also use their session, of course, so\n // your validate_doc_update's will see their info in userCtx\n })\n\n } else {\n // don't have a sessionToken.\n // get a username and password from the post body or something.\n // maybe redirect to a /login page or something to ask for that.\n var login = { name: name, password: password }\n couch.login(login, function (er, resp, data) {\n // again, er is an error, resp is the response obj, data is the json\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // the data is something like\n // {\"ok\":true,\"name\":\"testuser\",\"roles\":[]}\n // and couch.token is the token you'll need to save somewhere.\n\n // at this point, you can start making authenticated requests to\n // couchdb, or save data in their session, or do whatever it is\n // that you need to do.\n\n res.statusCode = 200\n res.write(\"Who's got two thumbs and just logged you into couch?\\n\")\n setTimeout(function () {\n res.end(\"THIS GUY!\")\n }, 500)\n })\n }\n})\n```\n\n## Class: CouchLogin\n### new CouchLogin(couchdbUrl, token)\n\nCreate a new CouchLogin object bound to the couchdb url.\n\nIn addition to these, the `get`, `post`, `put`, and `del` methods all\nproxy to the associated method on [request](https://github.com/mikeal/request).\n\nHowever, as you'll note in the example above, only the pathname portion\nof the url is required. Urls will be appended to the couchdb url passed\ninto the constructor.\n\nIf you have to talk to more than one couchdb, then you'll need more than\none CouchLogin object, for somewhat obvious reasons.\n\nAll callbacks get called with the following arguments, which are exactly\nidentical to the arguments passed to a `request` callback.\n\n* `er` {Error | null} Set if a communication error happens.\n* `resp` {HTTP Response} The response from the request to couchdb\n* `data` {Object} The parsed JSON data from couch\n\nIf the token is the string \"anonymous\", then it will not attempt to log\nin before making requests. If the token is not \"anonymous\", then it\nmust be an object with the appropriate fields.\n\n### couch.token\n\n* {Object}\n\nAn object representing the couchdb session token. (Basically just a\ncookie and a timeout.)\n\nIf the token has already timed out, then setting it will have no effect.\n\n### couch.tokenSet\n\nIf set, this method is called whenever the token is saved.\n\nFor example, you could assign a function to this method to save the\ntoken into a redis session, a cookie, or in some other database.\n\nTakes a callback which should be called when the token is saved.\n\n### couch.tokenGet\n\nIf set, this method is called to look up the token on demand.\n\nThe inverse of couch.tokenSet. Takes a callback which is called with\nthe `cb(er || null, token)`.\n\n### couch.tokenDel\n\nIf set, this method is called to delete the token when it should be\ndiscarded.\n\nRelated to tokenGet and tokenSet. Takes a callback which should be\ncalled when the token is deleted.\n\n### couch.ca\n\n* {String | Array | null}\n\nA certificate authority string (PEM encoded), or an array of CA strings. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` to use the default ca settings built into node.\n\n### couch.cert\n\n* {String | null}\n\nA client certificate (PEM encoded) used to support secure access to servers that require client certificate. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` when not supporting client certificates.\n\n### couch.key\n\n* {String | null}\n\nA private key string (PEM encoded) used to validate a client certificate. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` when not supporting client certificates.\n\n### couch.strictSSL\n\n* {Boolean | null}\n\nWhether or not to be strict about SSL connections. If left as null,\nthen use the default setting in node, which is true in node versions\n0.9.x and above, and false prior to 0.8.x.\n\nOnly relevant for HTTPS couches, of course.\n\n### couch.anonymous()\n\nReturn a new CouchLogin object that points at the same couchdb server,\nbut doesn't try to log in before making requests.\n\nThis is handy for situations where the user is not logged in at the\nmoment, but a request needs to be made anyway, and does not require\nauthorization.\n\n### couch.login(auth, callback)\n\n* `auth` {Object} The login details\n * `name` {String}\n * `password` {String}\n* `callback` {Function}\n\nWhen the callback is called, the `couch.token` will already have been\nset (assuming it worked!), so subsequent requests will be done as that\nuser.\n\n### couch.get(path, callback)\n\nGET the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.del(path, callback)\n\nDELETE the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.post(path, data, callback)\n\nPOST the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.put(path, data, callback)\n\nPUT the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.changePass(newAuth, callback)\n\nMust already be logged in. Updates the `_users` document with new salt\nand hash, and re-logs in with the new credentials. Callback is called\nwith the same arguments as login, or the first step of the process that\nfailed.\n\n### couch.signup(userData, callback)\n\nCreate a new user account. The userData must contain at least a `name`\nand `password` field. Any additional data will be copied to the user\nrecord. The `_id`, `name`, `roles`, `type`, `password_sha`, `salt`, and\n`date` fields are generated.\n\nAlso signs in as the newly created user, on successful account creation.\n\n### couch.deleteAccount(name, callback)\n\nDeletes a user account. If not logged in as the user, or a server\nadmin, then the request will fail.\n\nNote that this immediately invalidates any session tokens for the\ndeleted user account. If you are deleting the user's record, then you\nought to follow this with `couch.logout(callback)` so that it won't try\nto re-use the invalid session.\n\n### couch.logout(callback)\n\nDelete the session out of couchdb. This makes the token permanently\ninvalid, and deletes it.\n\n### couch.decorate(req, res)\n\nSet up `req.couch` and `res.couch` as references to this couch login\ninstance.\n\nAdditionall, if `req.session` or `res.session` is set, then it'll call\n`session.get('couch_token', cb)` as the tokenGet method,\n`session.set('couch_token', token, cb)` as the tokenSet method, and\n`session.del('couch_token', cb)` as the tokenDel method.\n\nThis works really nice with\n[RedSess](https://github.com/isaacs/redsess).\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/couch-login/issues"
},
"homepage": "https://github.com/isaacs/couch-login",
- "_id": "couch-login@0.1.18",
- "_from": "couch-login@~0.1.18"
+ "_id": "couch-login@0.1.19",
+ "dist": {
+ "shasum": "5c472f64670dfb43fc381d290629b223edb64afa"
+ },
+ "_from": "couch-login@~0.1.18",
+ "_resolved": "https://registry.npmjs.org/couch-login/-/couch-login-0.1.19.tgz"
}
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "0.2.29",
+ "version": "0.2.30",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@0.2.29",
+ "_id": "npm-registry-client@0.2.30",
"_from": "npm-registry-client@latest"
}
, "fetch-retry-maxtimeout": 60000
, git: "git"
+ , "git-tag-version": true
, global : false
, globalconfig : path.resolve(globalPrefix, "etc", "npmrc")
, "fetch-retry-mintimeout": Number
, "fetch-retry-maxtimeout": Number
, git: String
+ , "git-tag-version": Boolean
, global : Boolean
, globalconfig : path
, globalignorefile: path
"homepage": "https://github.com/isaacs/proto-list",
"_id": "proto-list@1.2.2",
"dist": {
- "shasum": "d84669527f7117d176615dc4bdb54054160f3af1"
+ "shasum": "48b88798261ec2c4a785720cdfec6200d57d3326"
},
"_from": "proto-list@~1.2.1",
"_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.2.tgz"
},
"_id": "config-chain@1.1.8",
"dist": {
- "shasum": "0943d0b7227213a20d4eaff4434f4a1c0a052cad"
+ "shasum": "a3b9ae699dedb3a7837615001f3cf646ca37c77a"
},
"_from": "config-chain@~1.1.8",
"_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.8.tgz"
{
"name": "npmconf",
- "version": "0.1.6",
+ "version": "0.1.7",
"description": "The config thing npm uses",
"main": "npmconf.js",
"directories": {
"url": "https://github.com/isaacs/npmconf/issues"
},
"homepage": "https://github.com/isaacs/npmconf",
- "_id": "npmconf@0.1.6",
+ "_id": "npmconf@0.1.7",
"dist": {
- "shasum": "b5d981cc732e6ca0875caeae2cac08018ebb0343"
+ "shasum": "f0be6f90c672046b562175b6d99c2d152bd9f17c"
},
- "_from": "npmconf@0.1.6",
- "_resolved": "https://registry.npmjs.org/npmconf/-/npmconf-0.1.6.tgz"
+ "_from": "npmconf@0.1.7",
+ "_resolved": "https://registry.npmjs.org/npmconf/-/npmconf-0.1.7.tgz"
}
var biData = { 'builtin-config': true }
-var cli = { foo: 'bar', heading: 'foo' }
+var cli = { foo: 'bar', heading: 'foo', 'git-tag-version': false }
var expectList =
[ cli,
t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
t.equal(conf.root, npmconf.defs.defaults)
t.equal(conf.get('heading'), 'foo')
+ t.equal(conf.get('git-tag-version'), false)
t.end()
})
})
{
"name": "read-installed",
"description": "Read all the installed packages in a folder, and return a tree structure with all the data.",
- "version": "0.2.4",
+ "version": "0.2.5",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/read-installed"
"dependencies": {
"semver": "2",
"slide": "~1.1.3",
- "read-package-json": "1",
- "graceful-fs": "~2"
+ "read-package-json": "1"
},
"optionalDependencies": {
"graceful-fs": "~2"
},
- "author": {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me/"
- },
- "license": "ISC",
- "readme": "# read-installed\n\nRead all the installed packages in a folder, and return a tree\nstructure with all the data.\n\nnpm uses this.\n\n## Usage\n\n```javascript\nvar readInstalled = require(\"read-installed\")\n// depth is optional, defaults to Infinity\nreadInstalled(folder, depth, logFunction, function (er, data) {\n ...\n})\n```\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/isaacs/read-installed/issues"
- },
- "_id": "read-installed@0.2.4",
- "_from": "read-installed@~0.2.2"
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "license": "ISC"
}
return readJson(jsonFile, function (er, depData) {
// already out of our depth, ignore errors
if (er || !depData || !depData.version) return cb(null, obj)
- obj.dependencies[pkg] = depData.version
+ if (depth === maxDepth) {
+ // edge case, ignore dependencies
+ depData.dependencies = {}
+ depData.peerDependencies = {}
+ obj.dependencies[pkg] = depData
+ } else {
+ obj.dependencies[pkg] = depData.version
+ }
cb(null, obj)
})
}
--- /dev/null
+language: node_js
+node_js:
+ - 0.8
+ - 0.10
+
+env:
+ - OPTIONALS=Y
+ - OPTIONALS=N
+
+install:
+ - if [[ "$OPTIONALS" == "Y" ]]; then npm install; fi
+ - if [[ "$OPTIONALS" == "N" ]]; then npm install --no-optional; fi
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.
+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 the headers don’t already provide one).
```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.
+Request can also `pipe` to itself. When doing so, `content-type` and `content-length` are 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.
+Now let’s get fancy.
```javascript
http.createServer(function (req, 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:
+You can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do:
```javascript
http.createServer(function (req, resp) {
})
```
-And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)
+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)
}
})
```
+
You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
## Forms
`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.
-Url encoded forms are simple
+URL-encoded forms are simple.
```javascript
request.post('http://service.com/upload', {form:{key:'value'}})
request.post('http://service.com/upload').form({key:'value'})
```
-For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.
+For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don’t need to worry about piping the form object or setting the headers, `request` will handle that for you.
```javascript
var r = request.post('http://service.com/upload')
If passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.
-`sendImmediately` defaults to true, which will cause a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a 401 response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).
+`sendImmediately` defaults to `true`, which causes a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a `401` response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).
-Digest authentication is supported, but it only works with `sendImmediately` set to `false` (otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail).
+Digest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail.
## OAuth Signing
})
```
+### Custom HTTP Headers
+
+HTTP Headers, such as `User-Agent`, can be set in the `options` object.
+In the example below, we call the github API to find out the number
+of stars and forks for the request repository. This requires a
+custom `User-Agent` header as well as https.
+
+```
+var request = require('request');
+var options = {
+ url: 'https://api.github.com/repos/mikeal/request',
+ headers: {
+ 'User-Agent': 'request'
+ }
+};
+
+function callback(error, response, body) {
+ if (!error && response.statusCode == 200) {
+ var info = JSON.parse(body);
+ console.log(info.stargazers_count + " Stars");
+ console.log(info.forks_count + " Forks");
+ }
+}
+
+request(options, callback);
+```
### 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.
+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 PATCH, POST and PUT requests. Must be buffer or string.
-* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.
+* `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 (default: `"GET"`)
+* `headers` - http headers (default: `{}`)
+* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`.
+* `form` - when passed an object, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no options, a `FormData` instance is returned (and is piped to request).
* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.
-* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.
+* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
* `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.
+* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`)
+* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)
+* `maxRedirects` - the maximum number of redirects to follow (default: `10`)
+* `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`.
+* `pool` - A hash object containing the agents for these requests. If omitted, the 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.
+* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)
+* `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.
* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
-* `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 `true` if you want cookies to be remembered for future use, or define your custom cookie jar (see examples section)
-* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)
+* `strictSSL` - If `true`, requires 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` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
+* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services)
* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
* `localAddress` - Local interface to bind for network connections.
-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 is an http.ClientResponse object. The third is the response body String or Buffer.
+The callback argument gets 3 arguments:
+
+1. An `error` when applicable (usually from the `http.Client` option, not the `http.ClientRequest` object)
+2. An `http.ClientResponse` object
+3. The third is the `response` body (`String` or `Buffer`)
## Convenience methods
### request.put
-Same as request() but defaults to `method: "PUT"`.
+Same as `request()`, but defaults to `method: "PUT"`.
```javascript
request.put(url)
### request.patch
-Same as request() but defaults to `method: "PATCH"`.
+Same as `request()`, but defaults to `method: "PATCH"`.
```javascript
request.patch(url)
### request.post
-Same as request() but defaults to `method: "POST"`.
+Same as `request()`, but defaults to `method: "POST"`.
```javascript
request.post(url)
### request.del
-Same as request() but defaults to `method: "DELETE"`.
+Same as `request()`, but defaults to `method: "DELETE"`.
```javascript
request.del(url)
### request.get
-Alias to normal request method for uniformity.
+Same as `request()` (for uniformity).
```javascript
request.get(url)
}
)
```
-Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies set jar to true (either in defaults or in the options sent).
+
+Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`).
```javascript
var request = request.defaults({jar: true})
})
```
-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:
+To use a custom cookie jar (instead `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`)
```javascript
var j = request.jar()
// See the License for the specific language governing permissions and
// limitations under the License.
-var Cookie = require('cookie-jar')
- , CookieJar = Cookie.Jar
- , cookieJar = new CookieJar
+var optional = require('./lib/optional')
+ , Cookie = optional('tough-cookie')
+ , CookieJar = Cookie && Cookie.CookieJar
+ , cookieJar = CookieJar && new CookieJar
, copy = require('./lib/copy')
, Request = require('./request')
return de
}
+function requester(params) {
+ if(typeof params.options._requester === 'function') {
+ return params.options._requester
+ } else {
+ return request
+ }
+}
+
request.forever = function (agentOptions, optionsArg) {
var options = {}
if (optionsArg) {
request.post = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'POST'
- return request(params.uri || null, params.options, params.callback)
+ return requester(params)(params.uri || null, params.options, params.callback)
}
request.put = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'PUT'
- return request(params.uri || null, params.options, params.callback)
+ return requester(params)(params.uri || null, params.options, params.callback)
}
request.patch = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'PATCH'
- return request(params.uri || null, params.options, params.callback)
+ return requester(params)(params.uri || null, params.options, params.callback)
}
request.head = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.multipart) {
throw new Error("HTTP HEAD requests MUST NOT include a request body.")
}
- return request(params.uri || null, params.options, params.callback)
+
+ return requester(params)(params.uri || null, params.options, params.callback)
}
request.del = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'DELETE'
- if(typeof params.options._requester === 'function') {
- request = params.options._requester
- }
- return request(params.uri || null, params.options, params.callback)
+ return requester(params)(params.uri || null, params.options, params.callback)
}
request.jar = function () {
return new CookieJar
+var util = require('util')
+
module.exports =
function debug () {
if (/\brequest\b/.test(process.env.NODE_DEBUG))
console.error('REQUEST %s', util.format.apply(util, arguments))
-}
\ No newline at end of file
+}
--- /dev/null
+module.exports = function(module) {
+ try {
+ return require(module);
+ } catch (e) {}
+};
+++ /dev/null
-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
\ No newline at end of file
[ options.verb
, options.md5
, options.contentType
- , options.date.toUTCString()
+ , options.date ? options.date.toUTCString() : ''
, headers + options.resource
]
return r.join('\n')
"email": "mikeal.rogers@gmail.com",
"url": "http://www.futurealoof.com"
},
- "name": "aws-sign",
+ "name": "aws-sign2",
"description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
- "version": "0.3.0",
+ "version": "0.5.0",
"repository": {
"url": "https://github.com/mikeal/aws-sign"
},
"url": "https://github.com/mikeal/aws-sign/issues"
},
"homepage": "https://github.com/mikeal/aws-sign",
- "_id": "aws-sign@0.3.0",
- "_from": "aws-sign@~0.3.0"
+ "_id": "aws-sign2@0.5.0",
+ "dist": {
+ "shasum": "1385e609eb089432897b2fb794c40373c78d501f"
+ },
+ "_from": "aws-sign2@~0.5.0",
+ "_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz"
}
+++ /dev/null
-cookie-jar
-==========
-
-Cookie Jar. Originally pulled from LearnBoost/tobi, maintained as vendor in request, now a standalone module.
+++ /dev/null
-/*!
- * Tobi - Cookie
- * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var url = require('url');
-
-/**
- * Initialize a new `Cookie` with the given cookie `str` and `req`.
- *
- * @param {String} str
- * @param {IncomingRequest} req
- * @api private
- */
-
-var Cookie = exports = module.exports = function Cookie(str, req) {
- this.str = str;
-
- // Map the key/val pairs
- str.split(/ *; */).reduce(function(obj, pair){
- var p = pair.indexOf('=');
- var key = p > 0 ? pair.substring(0, p).trim() : pair.trim();
- var lowerCasedKey = key.toLowerCase();
- var value = p > 0 ? pair.substring(p + 1).trim() : true;
-
- if (!obj.name) {
- // First key is the name
- obj.name = key;
- obj.value = value;
- }
- else if (lowerCasedKey === 'httponly') {
- obj.httpOnly = value;
- }
- else {
- obj[lowerCasedKey] = value;
- }
- return obj;
- }, this);
-
- // Expires
- this.expires = this.expires
- ? new Date(this.expires)
- : Infinity;
-
- // Default or trim path
- this.path = this.path
- ? this.path.trim(): req
- ? url.parse(req.url).pathname: '/';
-};
-
-/**
- * Return the original cookie string.
- *
- * @return {String}
- * @api public
- */
-
-Cookie.prototype.toString = function(){
- return this.str;
-};
-
-module.exports.Jar = require('./jar')
\ No newline at end of file
+++ /dev/null
-/*!
-* Tobi - CookieJar
-* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
-* MIT Licensed
-*/
-
-/**
-* Module dependencies.
-*/
-
-var url = require('url');
-
-/**
-* Initialize a new `CookieJar`.
-*
-* @api private
-*/
-
-var CookieJar = exports = module.exports = function CookieJar() {
- this.cookies = [];
-};
-
-/**
-* Add the given `cookie` to the jar.
-*
-* @param {Cookie} cookie
-* @api private
-*/
-
-CookieJar.prototype.add = function(cookie){
- this.cookies = this.cookies.filter(function(c){
- // Avoid duplication (same path, same name)
- return !(c.name == cookie.name && c.path == cookie.path);
- });
- this.cookies.push(cookie);
-};
-
-/**
-* Get cookies for the given `req`.
-*
-* @param {IncomingRequest} req
-* @return {Array}
-* @api private
-*/
-
-CookieJar.prototype.get = function(req){
- var path = url.parse(req.url).pathname
- , now = new Date
- , specificity = {};
- return this.cookies.filter(function(cookie){
- if (0 == path.indexOf(cookie.path) && now < cookie.expires
- && cookie.path.length > (specificity[cookie.name] || 0))
- return specificity[cookie.name] = cookie.path.length;
- });
-};
-
-/**
-* Return Cookie string for the given `req`.
-*
-* @param {IncomingRequest} req
-* @return {String}
-* @api private
-*/
-
-CookieJar.prototype.cookieString = function(req){
- var cookies = this.get(req);
- if (cookies.length) {
- return cookies.map(function(cookie){
- return cookie.name + '=' + cookie.value;
- }).join('; ');
- }
-};
+++ /dev/null
-{
- "author": {
- "name": "Mikeal Rogers",
- "email": "mikeal.rogers@gmail.com",
- "url": "http://www.futurealoof.com"
- },
- "name": "cookie-jar",
- "description": "Cookie Jar. Originally pulled form tobi, maintained as vendor in request, now a standalone module.",
- "version": "0.3.0",
- "repository": {
- "url": "https://github.com/mikeal/cookie-jar"
- },
- "main": "index.js",
- "scripts": {
- "test": "node tests/run.js"
- },
- "dependencies": {},
- "devDependencies": {},
- "optionalDependencies": {},
- "engines": {
- "node": "*"
- },
- "readme": "cookie-jar\n==========\n\nCookie Jar. Originally pulled from LearnBoost/tobi, maintained as vendor in request, now a standalone module.\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/mikeal/cookie-jar/issues"
- },
- "homepage": "https://github.com/mikeal/cookie-jar",
- "_id": "cookie-jar@0.3.0",
- "_from": "cookie-jar@~0.3.0"
-}
+++ /dev/null
-var spawn = require('child_process').spawn
- , exitCode = 0
- , timeout = 10000
- , fs = require('fs')
- ;
-
-fs.readdir(__dirname, function (e, files) {
- if (e) throw e
-
- var tests = files.filter(function (f) {return f.slice(0, 'test-'.length) === 'test-'})
-
- var next = function () {
- if (tests.length === 0) process.exit(exitCode);
-
- var file = tests.shift()
- console.log(file)
- var proc = spawn('node', [ 'tests/' + file ])
-
- var killed = false
- var t = setTimeout(function () {
- proc.kill()
- exitCode += 1
- console.error(file + ' timeout')
- killed = true
- }, timeout)
-
- proc.stdout.pipe(process.stdout)
- proc.stderr.pipe(process.stderr)
- proc.on('exit', function (code) {
- if (code && !killed) console.error(file + ' failed')
- exitCode += code || 0
- clearTimeout(t)
- next()
- })
- }
- next()
-
-})
-
-
+++ /dev/null
-var Cookie = require('../index')
- , assert = require('assert');
-
-var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT';
-var cookie = new Cookie(str);
-
-// test .toString()
-assert.equal(cookie.toString(), str);
-
-// test .path
-assert.equal(cookie.path, '/');
-
-// test .httpOnly
-assert.equal(cookie.httpOnly, true);
-
-// test .name
-assert.equal(cookie.name, 'Sid');
-
-// test .value
-assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="');
-
-// test .expires
-assert.equal(cookie.expires instanceof Date, true);
-
-// test .path default
-var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' });
-assert.equal(cookie.path, '/bar');
-
-console.log('All tests passed');
+++ /dev/null
-var Cookie = require('../index')
- , Jar = Cookie.Jar
- , assert = require('assert');
-
-function expires(ms) {
- return new Date(Date.now() + ms).toUTCString();
-}
-
-// test .get() expiration
-(function() {
- var jar = new Jar;
- var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000));
- jar.add(cookie);
- setTimeout(function(){
- var cookies = jar.get({ url: 'http://foo.com/foo' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], cookie);
- setTimeout(function(){
- var cookies = jar.get({ url: 'http://foo.com/foo' });
- assert.equal(cookies.length, 0);
- }, 1000);
- }, 5);
-})();
-
-// test .get() path support
-(function() {
- var jar = new Jar;
- var a = new Cookie('sid=1234; path=/');
- var b = new Cookie('sid=1111; path=/foo/bar');
- var c = new Cookie('sid=2222; path=/');
- jar.add(a);
- jar.add(b);
- jar.add(c);
-
- // should remove the duplicates
- assert.equal(jar.cookies.length, 2);
-
- // same name, same path, latter prevails
- var cookies = jar.get({ url: 'http://foo.com/' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], c);
-
- // same name, diff path, path specifity prevails, latter prevails
- var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], b);
-
- var jar = new Jar;
- var a = new Cookie('sid=1111; path=/foo/bar');
- var b = new Cookie('sid=1234; path=/');
- jar.add(a);
- jar.add(b);
-
- var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], a);
-
- var cookies = jar.get({ url: 'http://foo.com/' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], b);
-
- var jar = new Jar;
- var a = new Cookie('sid=1111; path=/foo/bar');
- var b = new Cookie('sid=3333; path=/foo/bar');
- var c = new Cookie('pid=3333; path=/foo/bar');
- var d = new Cookie('sid=2222; path=/foo/');
- var e = new Cookie('sid=1234; path=/');
- jar.add(a);
- jar.add(b);
- jar.add(c);
- jar.add(d);
- jar.add(e);
-
- var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
- assert.equal(cookies.length, 2);
- assert.equal(cookies[0], b);
- assert.equal(cookies[1], c);
-
- var cookies = jar.get({ url: 'http://foo.com/foo/' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], d);
-
- var cookies = jar.get({ url: 'http://foo.com/' });
- assert.equal(cookies.length, 1);
- assert.equal(cookies[0], e);
-})();
-
-setTimeout(function() {
- console.log('All tests passed');
-}, 1200);
},
"homepage": "https://github.com/mikeal/forever-agent",
"_id": "forever-agent@0.5.0",
- "_from": "forever-agent@~0.5.0"
+ "dist": {
+ "shasum": "ad4cf81ff45de88f2bfacf2592b212a87207d346"
+ },
+ "_from": "forever-agent@~0.5.0",
+ "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.0.tgz"
}
"url": "https://github.com/felixge/node-delayed-stream/issues"
},
"_id": "delayed-stream@0.0.5",
- "_from": "delayed-stream@0.0.5"
+ "dist": {
+ "shasum": "052618e1471edc6f9affd1d89c0b0503c716f5a4"
+ },
+ "_from": "delayed-stream@0.0.5",
+ "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz"
}
"url": "https://github.com/felixge/node-combined-stream/issues"
},
"_id": "combined-stream@0.0.4",
- "_from": "combined-stream@~0.0.4"
+ "dist": {
+ "shasum": "818920f2e68d41ae5fac5f154dfbed98b675d34f"
+ },
+ "_from": "combined-stream@~0.0.4",
+ "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.4.tgz"
}
},
"homepage": "https://github.com/felixge/node-form-data",
"_id": "form-data@0.1.2",
- "_from": "form-data@~0.1.0"
+ "dist": {
+ "shasum": "d02737d14dca53f214486c7da5d42c2aaabf0999"
+ },
+ "_from": "form-data@~0.1.0",
+ "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.2.tgz"
}
},
"homepage": "https://github.com/spumko/boom",
"_id": "boom@0.4.2",
- "_from": "boom@0.4.x"
+ "dist": {
+ "shasum": "f0f4575f078f5fe7a3587dd9f999b6fedd482f4c"
+ },
+ "_from": "boom@0.4.x",
+ "_resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz"
}
},
"homepage": "https://github.com/hueniverse/cryptiles",
"_id": "cryptiles@0.2.2",
- "_from": "cryptiles@0.2.x"
+ "dist": {
+ "shasum": "f063b421b587cb91b0738de6db92e02b9fc30923"
+ },
+ "_from": "cryptiles@0.2.x",
+ "_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz"
}
},
"homepage": "https://github.com/spumko/hoek",
"_id": "hoek@0.9.1",
- "_from": "hoek@0.9.x"
+ "dist": {
+ "shasum": "396f2118033eabc93ae5c2cd6ca75f0a89c03592"
+ },
+ "_from": "hoek@0.9.x",
+ "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
}
},
"homepage": "https://github.com/hueniverse/sntp",
"_id": "sntp@0.2.4",
- "_from": "sntp@0.2.x"
+ "dist": {
+ "shasum": "80612680552b9c47a4ba312d125f366be68ad8f7"
+ },
+ "_from": "sntp@0.2.x",
+ "_resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz"
}
},
"homepage": "https://github.com/hueniverse/hawk",
"_id": "hawk@1.0.0",
- "_from": "hawk@~1.0.0"
+ "dist": {
+ "shasum": "9de06d5c482e1ef66c4873baf34db19863b1a662"
+ },
+ "_from": "hawk@~1.0.0",
+ "_resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz"
}
},
"homepage": "https://github.com/mcavage/node-asn1",
"_id": "asn1@0.1.11",
- "_from": "asn1@0.1.11"
+ "dist": {
+ "shasum": "115275c87b008d39f95650515e8aa3b95b536106"
+ },
+ "_from": "asn1@0.1.11",
+ "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz"
}
"readme": "# node-assert-plus\n\nThis library is a super small wrapper over node's assert module that has two\nthings: (1) the ability to disable assertions with the environment variable\nNODE_NDEBUG, and (2) some API wrappers for argument testing. Like\n`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks\nlike this:\n\n var assert = require('assert-plus');\n\n function fooAccount(options, callback) {\n\t assert.object(options, 'options');\n\t\tassert.number(options.id, 'options.id);\n\t\tassert.bool(options.isManager, 'options.isManager');\n\t\tassert.string(options.name, 'options.name');\n\t\tassert.arrayOfString(options.email, 'options.email');\n\t\tassert.func(callback, 'callback');\n\n // Do stuff\n\t\tcallback(null, {});\n }\n\n# API\n\nAll methods that *aren't* part of node's core assert API are simply assumed to\ntake an argument, and then a string 'name' that's not a message; `AssertionError`\nwill be thrown if the assertion fails with a message like:\n\n AssertionError: foo (string) is required\n\tat test (/home/mark/work/foo/foo.js:3:9)\n\tat Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)\n\tat Module._compile (module.js:446:26)\n\tat Object..js (module.js:464:10)\n\tat Module.load (module.js:353:31)\n\tat Function._load (module.js:311:12)\n\tat Array.0 (module.js:484:10)\n\tat EventEmitter._tickCallback (node.js:190:38)\n\nfrom:\n\n function test(foo) {\n\t assert.string(foo, 'foo');\n }\n\nThere you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:\n\n function test(foo) {\n\t assert.arrayOfString(foo, 'foo');\n }\n\nYou can assert IFF an argument is not `undefined` (i.e., an optional arg):\n\n assert.optionalString(foo, 'foo');\n\nLastly, you can opt-out of assertion checking altogether by setting the\nenvironment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have\nlots of assertions, and don't want to pay `typeof ()` taxes to v8 in\nproduction.\n\nThe complete list of APIs is:\n\n* assert.bool\n* assert.buffer\n* assert.func\n* assert.number\n* assert.object\n* assert.string\n* assert.arrayOfBool\n* assert.arrayOfFunc\n* assert.arrayOfNumber\n* assert.arrayOfObject\n* assert.arrayOfString\n* assert.optionalBool\n* assert.optionalBuffer\n* assert.optionalFunc\n* assert.optionalNumber\n* assert.optionalObject\n* assert.optionalString\n* assert.optionalArrayOfBool\n* assert.optionalArrayOfFunc\n* assert.optionalArrayOfNumber\n* assert.optionalArrayOfObject\n* assert.optionalArrayOfString\n* assert.AssertionError\n* assert.fail\n* assert.ok\n* assert.equal\n* assert.notEqual\n* assert.deepEqual\n* assert.notDeepEqual\n* assert.strictEqual\n* assert.notStrictEqual\n* assert.throws\n* assert.doesNotThrow\n* assert.ifError\n\n# Installation\n\n npm install assert-plus\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2012 Mark Cavage\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-assert-plus/issues>.\n",
"readmeFilename": "README.md",
"_id": "assert-plus@0.1.2",
- "_from": "assert-plus@0.1.2"
+ "dist": {
+ "shasum": "d4ec5ba2df390500ec8a9867e7e29a742901041c"
+ },
+ "_from": "assert-plus@0.1.2",
+ "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz"
}
"readme": "Node-CType is a way to read and write binary data in structured and easy to use\nformat. Its name comes from the C header file.\n\nTo get started, simply clone the repository or use npm to install it. Once it is\nthere, simply require it.\n\ngit clone git://github.com/rmustacc/node-ctype\nnpm install ctype\nvar mod_ctype = require('ctype')\n\n\nThere are two APIs that you can use, depending on what abstraction you'd like.\nThe low level API let's you read and write individual integers and floats from\nbuffers. The higher level API let's you read and write structures of these. To\nillustrate this, let's looks look at how we would read and write a binary\nencoded x,y point.\n\nIn C we would define this structure as follows:\n\ntypedef struct point {\n\tuint16_t\tp_x;\n\tuint16_t\tp_y;\n} point_t;\n\nTo read a binary encoded point from a Buffer, we first need to create a CType\nparser (where we specify the endian and other options) and add the typedef.\n\nvar parser = new mod_ctype.Parser({ endian: 'big' });\nparser.typedef('point_t', [\n\t{ x: { type: 'uint16_t' } },\n\t{ y: { type: 'uint16_t' } }\n]);\n\nFrom here, given a buffer buf and an offset into it, we can read a point.\n\nvar out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);\nconsole.log(out);\n{ point: { x: 23, y: 42 } }\n\nAnother way to get the same information would be to use the low level methods.\nNote that these require you to manually deal with the offset. Here's how we'd\nget the same values of x and y from the buffer.\n\nvar x = mod_ctype.ruint16(buf, 'big', 0);\nvar y = mod_ctype.ruint16(buf, 'big', 2);\nconsole.log(x + ', ' + y);\n23, 42\n\nThe true power of this API comes from the ability to define and nest typedefs,\njust as you would in C. By default, the following types are defined by default.\nNote that they return a Number, unless indicated otherwise.\n\n * int8_t\n * int16_t\n * int32_t\n * int64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * uint8_t\n * uint16_t\n * uint32_t\n * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * float\n * double\n * char (either returns a buffer with that character or a uint8_t)\n * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)\n\n\nctf2json integration:\n\nNode-CType supports consuming the output of ctf2json. Once you read in a JSON file,\nall you have to do to add all the definitions it contains is:\n\nvar data, parser;\ndata = JSON.parse(parsedJSONData);\nparser = mod_ctype.parseCTF(data, { endian: 'big' });\n\nFor more documentation, see the file README.old. Full documentation is in the\nprocess of being rewritten as a series of manual pages which will be available\nin the repository and online for viewing.\n\nTo read the ctio manual page simple run, from the root of the workspace:\n\nman -Mman -s 3ctype ctio\n",
"readmeFilename": "README",
"_id": "ctype@0.5.2",
- "_from": "ctype@0.5.2"
+ "dist": {
+ "shasum": "47401bce9fafcc4de1e2db98fc3fd6f3b854045d"
+ },
+ "_from": "ctype@0.5.2",
+ "_resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz"
}
},
"homepage": "https://github.com/isaacs/json-stringify-safe",
"_id": "json-stringify-safe@5.0.0",
- "_from": "json-stringify-safe@~5.0.0"
+ "dist": {
+ "shasum": "4c1f228b5050837eba9d21f50c2e6e320624566e"
+ },
+ "_from": "json-stringify-safe@~5.0.0",
+ "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz"
}
},
"homepage": "https://github.com/broofa/node-mime",
"_id": "mime@1.2.11",
- "_from": "mime@~1.2.9"
+ "dist": {
+ "shasum": "70f951e3276bf9804c66f4ed27321773d71b999c"
+ },
+ "_from": "mime@~1.2.9",
+ "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
}
},
"homepage": "https://github.com/broofa/node-uuid",
"_id": "node-uuid@1.4.1",
- "_from": "node-uuid@~1.4.0"
+ "dist": {
+ "shasum": "fc22efd9718e4b371d21ddb90bb3840994e5988a"
+ },
+ "_from": "node-uuid@~1.4.0",
+ "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz"
}
},
"homepage": "https://github.com/mikeal/oauth-sign",
"_id": "oauth-sign@0.3.0",
- "_from": "oauth-sign@~0.3.0"
+ "dist": {
+ "shasum": "9afc35fe8d6d035c8373a615fc3a124a6402c9e9"
+ },
+ "_from": "oauth-sign@~0.3.0",
+ "_resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz"
}
var objectKeys = Object.keys || function(obj) {
var ret = [];
- for (var key in obj) ret.push(key);
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ ret.push(key);
+ }
+ }
return ret;
};
};
/**
- * Create a nullary object if possible
- */
-
-function createObject() {
- return Object.create
- ? Object.create(null)
- : {};
-}
-
-/**
* Cache non-integer test regexp.
*/
var isint = /^[0-9]+$/;
function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = createObject();
- var t = createObject();
+ if (parent[key].length == 0) return parent[key] = {}
+ var t = {};
for (var i in parent[key]) {
if (hasOwnProperty.call(parent[key], i)) {
t[i] = parent[key][i];
function parse(parts, parent, key, val) {
var part = parts.shift();
+
+ // illegal
+ if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
+
// end
if (!part) {
if (isArray(parent[key])) {
// optimize
} else {
if (!isint.test(key) && isArray(parent.base)) {
- var t = createObject();
+ var t = {};
for (var k in parent.base) t[k] = parent.base[k];
parent.base = t;
}
}
/**
- * Restore Object.prototype.
- * see pull-request #58
- */
-
-function restoreProto(obj) {
- if (!Object.create) return obj;
- if (isArray(obj)) return obj;
- if (obj && 'object' != typeof obj) return obj;
-
- for (var key in obj) {
- if (hasOwnProperty.call(obj, key)) {
- obj[key] = restoreProto(obj[key]);
- }
- }
-
- obj.__proto__ = Object.prototype;
- return obj;
-}
-
-/**
* Parse the given obj.
*/
if ('' == key) return ret;
return merge(ret, decode(key), decode(val));
- }, { base: createObject() }).base;
+ }, { base: {} }).base;
- return restoreProto(compact(ret));
+ return compact(ret);
}
/**
function set(obj, key, val) {
var v = obj[key];
+ if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
if (undefined === v) {
obj[key] = val;
} else if (isArray(v)) {
{
"name": "qs",
"description": "querystring parser",
- "version": "0.6.5",
+ "version": "0.6.6",
"keywords": [
"query string",
"parser",
"url": "https://github.com/visionmedia/node-querystring/issues"
},
"homepage": "https://github.com/visionmedia/node-querystring",
- "_id": "qs@0.6.5",
- "_from": "qs@~0.6.0"
+ "_id": "qs@0.6.6",
+ "dist": {
+ "shasum": "d088aac10df771c4602df0812f6ef1e93693f414"
+ },
+ "_from": "qs@~0.6.0",
+ "_resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz"
}
--- /dev/null
+{
+ // Settings
+ "passfail" : false, // Stop on first error.
+ "maxerr" : 100, // Maximum error before stopping.
+
+
+ // Predefined globals whom JSHint will ignore.
+ "browser" : false, // Standard browser globals e.g. `window`, `document`.
+ "node" : true,
+ "rhino" : false,
+ "couch" : false,
+ "wsh" : false, // Windows Scripting Host.
+
+ "jquery" : false,
+ "prototypejs" : false,
+ "mootools" : false,
+ "dojo" : false,
+
+ "predef" : [ // Custom globals.
+ "escape", "unescape" // aren't picked up by node flag above :/
+ ],
+
+
+ // Development.
+ "debug" : false, // Allow debugger statements e.g. browser breakpoints.
+ "devel" : false, // Allow developments statements e.g. `console.log();`.
+
+
+ // EcmaScript 5.
+ "es5" : true, // Allow EcmaScript 5 syntax.
+ "esnext" : true, // Allow ES "next" syntax, specifically 'const' (V8 has this)
+ "strict" : false, // Require `use strict` pragma in every file.
+ "globalstrict" : false, // Allow global "use strict" (also enables 'strict').
+
+
+ // The Good Parts.
+ "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
+ "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
+ "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
+ "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
+ "curly" : false, // Require {} for every new block or scope.
+ "eqeqeq" : false, // Require triple equals i.e. `===`.
+ "eqnull" : true, // Tolerate use of `== null`.
+ "evil" : false, // Tolerate use of `eval`.
+ "expr" : true, // Tolerate `ExpressionStatement` as Programs.
+ "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
+ "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
+ "latedef" : false, // Prohibit variable use before definition.
+ "loopfunc" : false, // Allow functions to be defined within loops.
+ "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
+ "regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
+ "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
+ "scripturl" : true, // Tolerate script-targeted URLs.
+ "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
+ "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
+ "undef" : true, // Require all non-global variables be declared before they are used.
+
+
+ // Personal styling prefrences.
+ "lastsemic" : true, // Prohibit missing semicolon for the last statement in a one-line block
+ "newcap" : false, // Require capitalization of all constructor functions e.g. `new F()`.
+ "noempty" : true, // Prohipit use of empty blocks.
+ "nonew" : true, // Prohibit use of constructors for side-effects.
+ "nomen" : false, // Prohibit use of initial or trailing underbars in names.
+ "onevar" : false, // Allow only one `var` statement per function.
+ "onecase" : false, // Allow switches with one case statement
+ "plusplus" : false, // Prohibit use of `++` & `--`.
+ "proto" : false, // Allow use of __proto__
+ "sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
+ "trailing" : true, // Prohibit trailing whitespaces.
+ "white" : false // Check against strict whitespace and indentation rules.
+}
--- /dev/null
+node_modules/
+.*.sw[nmop]
+npm-debug.log
--- /dev/null
+Copyright GoInstant, Inc. and other contributors. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+The following exceptions apply:
+
+===
+
+`pubSufTest()` of generate-pubsuffix.js is in the public domain.
+
+ // Any copyright is dedicated to the Public Domain.
+ // http://creativecommons.org/publicdomain/zero/1.0/
+
+===
+
+`public-suffix.txt` was obtained from
+<https://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1>
+via <http://publicsuffix.org>.
+
+That file contains the usual Mozilla triple-license, for which this project uses it
+under the terms of the MPL 1.1:
+
+ // ***** BEGIN LICENSE BLOCK *****
+ // Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ //
+ // The contents of this file are subject to the Mozilla Public License Version
+ // 1.1 (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.mozilla.org/MPL/
+ //
+ // Software distributed under the License is distributed on an "AS IS" basis,
+ // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ // for the specific language governing rights and limitations under the
+ // License.
+ //
+ // The Original Code is the Public Suffix List.
+ //
+ // The Initial Developer of the Original Code is
+ // Jo Hermans <jo.hermans@gmail.com>.
+ // Portions created by the Initial Developer are Copyright (C) 2007
+ // the Initial Developer. All Rights Reserved.
+ //
+ // Contributor(s):
+ // Ruben Arakelyan <ruben@rubenarakelyan.com>
+ // Gervase Markham <gerv@gerv.net>
+ // Pamela Greene <pamg.bugs@gmail.com>
+ // David Triendl <david@triendl.name>
+ // Jothan Frakes <jothan@gmail.com>
+ // The kind representatives of many TLD registries
+ //
+ // Alternatively, the contents of this file may be used under the terms of
+ // either the GNU General Public License Version 2 or later (the "GPL"), or
+ // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ // in which case the provisions of the GPL or the LGPL are applicable instead
+ // of those above. If you wish to allow use of your version of this file only
+ // under the terms of either the GPL or the LGPL, and not to allow others to
+ // use your version of this file under the terms of the MPL, indicate your
+ // decision by deleting the provisions above and replace them with the notice
+ // and other provisions required by the GPL or the LGPL. If you do not delete
+ // the provisions above, a recipient may use your version of this file under
+ // the terms of any one of the MPL, the GPL or the LGPL.
+ //
+ // ***** END LICENSE BLOCK *****
--- /dev/null
+[RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js
+
+![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)
+
+# Synopsis
+
+``` javascript
+var cookies = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'
+var Cookie = cookies.Cookie;
+var cookie = Cookie.parse(header);
+cookie.value = 'somethingdifferent';
+header = cookie.toString();
+
+var cookiejar = new cookies.CookieJar();
+cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);
+// ...
+cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {
+ res.headers['cookie'] = cookies.join('; ');
+});
+```
+
+# Installation
+
+It's _so_ easy!
+
+`npm install tough-cookie`
+
+Requires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.
+
+Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.
+
+# API
+
+cookies
+=======
+
+Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound".
+
+parseDate(string[,strict])
+-----------------
+
+Parse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. If strict is set to true then leading/trailing non-seperator characters around the time part will cause the parsing to fail (e.g. "Thu, 01 Jan 1970 00:00:010 GMT" has an extra trailing zero but Chrome, an assumedly RFC-compliant browser, treats this as valid).
+
+formatDate(date)
+----------------
+
+Format a Date into a RFC1123 string (the RFC6265-recommended format).
+
+canonicalDomain(str)
+--------------------
+
+Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).
+
+domainMatch(str,domStr[,canonicalize=true])
+-------------------------------------------
+
+Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".
+
+The `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not.
+
+defaultPath(path)
+-----------------
+
+Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC.
+
+The `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.
+
+pathMatch(reqPath,cookiePath)
+-----------------------------
+
+Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean.
+
+This is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.
+
+parse(header[,strict=false])
+----------------------------
+
+alias for `Cookie.parse(header[,strict])`
+
+fromJSON(string)
+----------------
+
+alias for `Cookie.fromJSON(string)`
+
+getPublicSuffix(hostname)
+-------------------------
+
+Returns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.
+
+For example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.
+
+For further information, see http://publicsuffix.org/. This module derives its list from that site.
+
+cookieCompare(a,b)
+------------------
+
+For use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). Longest `.path`s go first, then sorted oldest to youngest.
+
+``` javascript
+var cookies = [ /* unsorted array of Cookie objects */ ];
+cookies = cookies.sort(cookieCompare);
+```
+
+permuteDomain(domain)
+---------------------
+
+Generates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.
+
+
+permutePath(path)
+-----------------
+
+Generates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.
+
+Cookie
+======
+
+Cookie.parse(header[,strict=false])
+-----------------------------------
+
+Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. If in strict mode, returns `undefined` if the cookie doesn't follow the guidelines in section 4 of RFC6265. Generally speaking, strict mode can be used to validate your own generated Set-Cookie headers, but acting as a client you want to be lenient and leave strict mode off.
+
+Here's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:
+
+``` javascript
+if (res.headers['set-cookie'] instanceof Array)
+ cookies = res.headers['set-cookie'].map(Cookie.parse);
+else
+ cookies = [Cookie.parse(res.headers['set-cookie'])];
+```
+
+Cookie.fromJSON(string)
+-----------------------
+
+Convert a JSON string to a `Cookie` object. Does a `JSON.parse()` and converts the `.created`, `.lastAccessed` and `.expires` properties into `Date` objects.
+
+Properties
+==========
+
+ * _key_ - string - the name or key of the cookie (default "")
+ * _value_ - string - the value of the cookie (default "")
+ * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()`
+ * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`
+ * _domain_ - string - the `Domain=` attribute of the cookie
+ * _path_ - string - the `Path=` of the cookie
+ * _secure_ - boolean - the `Secure` cookie flag
+ * _httpOnly_ - boolean - the `HttpOnly` cookie flag
+ * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)
+
+After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:
+
+ * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)
+ * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.
+ * _created_ - `Date` - when this cookie was added to the jar
+ * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.
+
+Construction([{options}])
+------------
+
+Receives an options object that can contain any Cookie properties, uses the default for unspecified properties.
+
+.toString()
+-----------
+
+encode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.
+
+.cookieString()
+---------------
+
+encode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').
+
+.setExpires(String)
+-------------------
+
+sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `"Infinity"` (a string) is set.
+
+.setMaxAge(number)
+-------------------
+
+sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it JSON serializes correctly.
+
+.expiryTime([now=Date.now()])
+-----------------------------
+
+.expiryDate([now=Date.now()])
+-----------------------------
+
+expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.
+
+Max-Age takes precedence over Expires (as per the RFC). The `.created` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute.
+
+If Expires (`.expires`) is set, that's returned.
+
+Otherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for "Tue, 19 Jan 2038 03:14:07 GMT" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).
+
+.TTL([now=Date.now()])
+---------
+
+compute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.
+
+The "number" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.
+
+.canonicalizedDoman()
+---------------------
+
+.cdomain()
+----------
+
+return the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.
+
+.validate()
+-----------
+
+Status: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.
+
+validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:
+
+``` javascript
+if (cookie.validate() === true) {
+ // it's tasty
+} else {
+ // yuck!
+}
+```
+
+CookieJar
+=========
+
+Construction([store = new MemoryCookieStore()][, rejectPublicSuffixes])
+------------
+
+Simply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.
+
+
+Attributes
+----------
+
+ * _rejectPublicSuffixes_ - boolean - reject cookies with domains like "com" and "co.uk" (default: `true`)
+
+Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.
+
+.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))
+-------------------------------------------------------------------
+
+Attempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.created`, `.lastAccessed` and `.hostOnly` properties.
+
+The `options` object can be omitted and can have the following properties:
+
+ * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
+ * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
+ * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
+ * _strict_ - boolean - default `false` - perform extra checks
+ * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. CookieStore errors aren't ignored by this option.
+
+As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).
+
+.storeCookie(cookie, [{options},] cb(err,cookie))
+-------------------------------------------------
+
+__REMOVED__ removed in lieu of the CookieStore API below
+
+.getCookies(currentUrl, [{options},] cb(err,cookies))
+-----------------------------------------------------
+
+Retrieve the list of cookies that can be sent in a Cookie header for the current url.
+
+If an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.
+
+The `options` object can be omitted and can have the following properties:
+
+ * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
+ * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
+ * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
+ * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).
+ * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the CookieStore `fetchCookies` function (the default MemoryCookieStore supports it).
+
+The `.lastAccessed` property of the returned cookies will have been updated.
+
+.getCookieString(...)
+---------------------
+
+Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.
+
+.getSetCookieStrings(...)
+-------------------------
+
+Accepts the same options as `.getCookies()` but passes an array of strings suitable for Set-Cookie headers (rather than an array of `Cookie`s) to the callback. Simply maps the cookie array via `.toString()`.
+
+# CookieStore API
+
+The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.
+
+All `domain` parameters will have been normalized before calling.
+
+The Cookie store must have all of the following methods.
+
+store.findCookie(domain, path, key, cb(err,cookie))
+---------------------------------------------------
+
+Retrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.
+
+Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).
+
+store.findCookies(domain, path, cb(err,cookies))
+------------------------------------------------
+
+Locates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.
+
+If no cookies are found, the callback MUST be passed an empty array.
+
+The resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.
+
+As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).
+
+store.putCookie(cookie, cb(err))
+--------------------------------
+
+Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.
+
+The `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.
+
+Pass an error if the cookie cannot be stored.
+
+store.updateCookie(oldCookie, newCookie, cb(err))
+-------------------------------------------------
+
+Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.
+
+The `.lastAccessed` property will always be different between the two objects and `.created` will always be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are sorted (or selected for deletion).
+
+Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.
+
+The `newCookie` and `oldCookie` objects MUST NOT be modified.
+
+Pass an error if the newCookie cannot be stored.
+
+store.removeCookie(domain, path, key, cb(err))
+----------------------------------------------
+
+Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).
+
+The implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.
+
+store.removeCookies(domain, path, cb(err))
+------------------------------------------
+
+Removes matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.
+
+Pass an error ONLY if removing any existing cookies failed.
+
+# TODO
+
+ * _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`
+ * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891
+ * better tests for `validate()`?
+
+# Copyright and License
+
+(tl;dr: MIT with some MPL/1.1)
+
+Copyright GoInstant, Inc. and other contributors. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Portions may be licensed under different licenses (in particular public-suffix.txt is MPL/1.1); please read the LICENSE file for full details.
--- /dev/null
+/*
+ * Copyright GoInstant, Inc. and other contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+var fs = require('fs');
+var assert = require('assert');
+var punycode = require('punycode');
+
+fs.readFile('./public-suffix.txt', 'utf8', function(err,string) {
+ if (err) throw err;
+ var lines = string.split("\n");
+ process.nextTick(function() {
+ processList(lines);
+ });
+});
+
+var index = {};
+
+var COMMENT = new RegExp('//.+');
+function processList(lines) {
+ while (lines.length) {
+ var line = lines.shift();
+ line = line.replace(COMMENT,'').trim();
+ if (!line) continue;
+ addToIndex(index,line);
+ }
+
+ pubSufTest();
+
+ var w = fs.createWriteStream('./lib/pubsuffix.js',{
+ flags: 'w',
+ encoding: 'utf8',
+ mode: 0644,
+ });
+ w.on('end', process.exit);
+ w.write("/****************************************************\n");
+ w.write(" * AUTOMATICALLY GENERATED by generate-pubsuffix.js *\n");
+ w.write(" * DO NOT EDIT! *\n");
+ w.write(" ****************************************************/\n\n");
+
+ w.write("module.exports.getPublicSuffix = ");
+ w.write(getPublicSuffix.toString());
+ w.write(";\n\n");
+
+ w.write("// The following generated structure is used under the MPL version 1.1\n");
+ w.write("// See public-suffix.txt for more information\n\n");
+ w.write("var index = module.exports.index = Object.freeze(\n");
+ w.write(JSON.stringify(index));
+ w.write(");\n\n");
+ w.write("// END of automatically generated file\n");
+
+ w.end();
+}
+
+function addToIndex(index,line) {
+ var prefix = '';
+ if (line.replace(/^(!|\*\.)/)) {
+ prefix = RegExp.$1;
+ line = line.slice(prefix.length);
+ }
+ line = prefix + punycode.toASCII(line);
+
+ if (line.substr(0,1) == '!')
+ index[line.substr(1)] = false;
+ else
+ index[line] = true;
+}
+
+// include the licence in the function since it gets written to pubsuffix.js
+function getPublicSuffix(domain) {
+ /*
+ * Copyright GoInstant, Inc. and other contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+ if (!domain) return null;
+ if (domain.match(/^\./)) return null;
+
+ domain = domain.toLowerCase();
+ var parts = domain.split('.').reverse();
+
+ var suffix = '';
+ var suffixLen = 0;
+ for (var i=0; i<parts.length; i++) {
+ var part = parts[i];
+ var starstr = '*'+suffix;
+ var partstr = part+suffix;
+
+ if (index[starstr]) { // star rule matches
+ suffixLen = i+1;
+ if (index[partstr] === false) { // exception rule matches (NB: false, not undefined)
+ suffixLen--;
+ }
+ } else if (index[partstr]) { // exact match, not exception
+ suffixLen = i+1;
+ }
+
+ suffix = '.'+part+suffix;
+ }
+
+ if (index['*'+suffix]) { // *.domain exists (e.g. *.kyoto.jp for domain='kyoto.jp');
+ return null;
+ }
+
+ if (suffixLen && parts.length > suffixLen) {
+ return parts.slice(0,suffixLen+1).reverse().join('.');
+ }
+
+ return null;
+}
+
+function checkPublicSuffix(give,get) {
+ var got = getPublicSuffix(give);
+ assert.equal(got, get, give+' should be '+(get==null?'NULL':get)+' but got '+got);
+}
+
+// pubSufTest() was converted to JavaScript from http://publicsuffix.org/list/test.txt
+function pubSufTest() {
+ // For this function-scope and this function-scope ONLY:
+ // Any copyright is dedicated to the Public Domain.
+ // http://creativecommons.org/publicdomain/zero/1.0/
+
+ // NULL input.
+ checkPublicSuffix(null, null);
+ // Mixed case.
+ checkPublicSuffix('COM', null);
+ checkPublicSuffix('example.COM', 'example.com');
+ checkPublicSuffix('WwW.example.COM', 'example.com');
+ // Leading dot.
+ checkPublicSuffix('.com', null);
+ checkPublicSuffix('.example', null);
+ checkPublicSuffix('.example.com', null);
+ checkPublicSuffix('.example.example', null);
+ // Unlisted TLD.
+ checkPublicSuffix('example', null);
+ checkPublicSuffix('example.example', null);
+ checkPublicSuffix('b.example.example', null);
+ checkPublicSuffix('a.b.example.example', null);
+ // Listed, but non-Internet, TLD.
+ checkPublicSuffix('local', null);
+ checkPublicSuffix('example.local', null);
+ checkPublicSuffix('b.example.local', null);
+ checkPublicSuffix('a.b.example.local', null);
+ // TLD with only 1 rule.
+ checkPublicSuffix('biz', null);
+ checkPublicSuffix('domain.biz', 'domain.biz');
+ checkPublicSuffix('b.domain.biz', 'domain.biz');
+ checkPublicSuffix('a.b.domain.biz', 'domain.biz');
+ // TLD with some 2-level rules.
+ checkPublicSuffix('com', null);
+ checkPublicSuffix('example.com', 'example.com');
+ checkPublicSuffix('b.example.com', 'example.com');
+ checkPublicSuffix('a.b.example.com', 'example.com');
+ checkPublicSuffix('uk.com', null);
+ checkPublicSuffix('example.uk.com', 'example.uk.com');
+ checkPublicSuffix('b.example.uk.com', 'example.uk.com');
+ checkPublicSuffix('a.b.example.uk.com', 'example.uk.com');
+ checkPublicSuffix('test.ac', 'test.ac');
+ // TLD with only 1 (wildcard) rule.
+ checkPublicSuffix('cy', null);
+ checkPublicSuffix('c.cy', null);
+ checkPublicSuffix('b.c.cy', 'b.c.cy');
+ checkPublicSuffix('a.b.c.cy', 'b.c.cy');
+ // More complex TLD.
+ checkPublicSuffix('jp', null);
+ checkPublicSuffix('test.jp', 'test.jp');
+ checkPublicSuffix('www.test.jp', 'test.jp');
+ checkPublicSuffix('ac.jp', null);
+ checkPublicSuffix('test.ac.jp', 'test.ac.jp');
+ checkPublicSuffix('www.test.ac.jp', 'test.ac.jp');
+ checkPublicSuffix('kyoto.jp', null);
+ checkPublicSuffix('c.kyoto.jp', null);
+ checkPublicSuffix('b.c.kyoto.jp', 'b.c.kyoto.jp');
+ checkPublicSuffix('a.b.c.kyoto.jp', 'b.c.kyoto.jp');
+ checkPublicSuffix('pref.kyoto.jp', 'pref.kyoto.jp'); // Exception rule.
+ checkPublicSuffix('www.pref.kyoto.jp', 'pref.kyoto.jp'); // Exception rule.
+ checkPublicSuffix('city.kyoto.jp', 'city.kyoto.jp'); // Exception rule.
+ checkPublicSuffix('www.city.kyoto.jp', 'city.kyoto.jp'); // Exception rule.
+ // TLD with a wildcard rule and exceptions.
+ checkPublicSuffix('om', null);
+ checkPublicSuffix('test.om', null);
+ checkPublicSuffix('b.test.om', 'b.test.om');
+ checkPublicSuffix('a.b.test.om', 'b.test.om');
+ checkPublicSuffix('songfest.om', 'songfest.om');
+ checkPublicSuffix('www.songfest.om', 'songfest.om');
+ // US K12.
+ checkPublicSuffix('us', null);
+ checkPublicSuffix('test.us', 'test.us');
+ checkPublicSuffix('www.test.us', 'test.us');
+ checkPublicSuffix('ak.us', null);
+ checkPublicSuffix('test.ak.us', 'test.ak.us');
+ checkPublicSuffix('www.test.ak.us', 'test.ak.us');
+ checkPublicSuffix('k12.ak.us', null);
+ checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us');
+ checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us');
+
+
+}
--- /dev/null
+/*
+ * Copyright GoInstant, Inc. and other contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/*jshint regexp:false */
+var net = require('net');
+var urlParse = require('url').parse;
+var pubsuffix = require('./pubsuffix');
+
+var punycode;
+try {
+ punycode = require('punycode');
+} catch(e) {
+ console.warn("cookie: can't load punycode; won't use punycode for domain normalization");
+}
+
+var DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/;
+
+// From RFC2616 S2.2:
+var TOKEN = /[\x21\x23-\x26\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]/;
+
+// From RFC6265 S4.1.1
+// note that it excludes \x3B ";"
+var COOKIE_OCTET = /[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/;
+var COOKIE_OCTETS = /^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/;
+
+// The name/key cannot be empty but the value can (S5.2):
+var COOKIE_PAIR_STRICT = new RegExp('^('+TOKEN.source+'+)=("?)('+COOKIE_OCTET.source+'*)\\2');
+var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2/;
+
+// RFC6265 S4.1.1 defines extension-av as 'any CHAR except CTLs or ";"'
+// Note ';' is \x3B
+var NON_CTL_SEMICOLON = /[\x20-\x3A\x3C-\x7E]+/;
+var EXTENSION_AV = NON_CTL_SEMICOLON;
+var PATH_VALUE = NON_CTL_SEMICOLON;
+
+// Used for checking whether or not there is a trailing semi-colon
+var TRAILING_SEMICOLON = /;+$/;
+
+/* RFC6265 S5.1.1.5:
+ * [fail if] the day-of-month-value is less than 1 or greater than 31
+ */
+var DAY_OF_MONTH = /^(0?[1-9]|[12][0-9]|3[01])$/;
+
+/* RFC6265 S5.1.1.5:
+ * [fail if]
+ * * the hour-value is greater than 23,
+ * * the minute-value is greater than 59, or
+ * * the second-value is greater than 59.
+ */
+var TIME = /(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])/;
+var STRICT_TIME = /^(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/;
+
+var MONTH = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$/i;
+var MONTH_TO_NUM = {
+ jan:0, feb:1, mar:2, apr:3, may:4, jun:5, jul:6, aug:7, sep:8, oct:9, nov:10, dec:11
+};
+var NUM_TO_MONTH = [
+ 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'
+];
+var NUM_TO_DAY = [
+ 'Sun','Mon','Tue','Wed','Thu','Fri','Sat'
+];
+
+var YEAR = /^([1-9][0-9]{1,3})$/; // 2 to 4 digits (will check range when parsing)
+
+var MAX_TIME = 2147483647000; // 31-bit max
+var MAX_DATE = new Date(CookieJar.MAX_TIME); // 31-bit max
+var MIN_TIME = 0; // 31-bit min
+var MIN_DATE = new Date(CookieJar.MIN_TIME); // 31-bit min
+
+
+// RFC6265 S5.1.1 date parser:
+function parseDate(str,strict) {
+ if (!str) return;
+ var found_time, found_dom, found_month, found_year;
+
+ /* RFC6265 S5.1.1:
+ * 2. Process each date-token sequentially in the order the date-tokens
+ * appear in the cookie-date
+ */
+ var tokens = str.split(DATE_DELIM);
+ if (!tokens) return;
+
+ var date = new Date();
+ date.setMilliseconds(0);
+
+ for (var i=0; i<tokens.length; i++) {
+ var token = tokens[i].trim();
+ if (!token.length) continue;
+
+ var result;
+
+ /* 2.1. If the found-time flag is not set and the token matches the time
+ * production, set the found-time flag and set the hour- value,
+ * minute-value, and second-value to the numbers denoted by the digits in
+ * the date-token, respectively. Skip the remaining sub-steps and continue
+ * to the next date-token.
+ */
+ if (!found_time) {
+ result = (strict ? STRICT_TIME : TIME).exec(token);
+ if (result) {
+ found_time = true;
+ date.setUTCHours(result[1]);
+ date.setUTCMinutes(result[2]);
+ date.setUTCSeconds(result[3]);
+ continue;
+ }
+ }
+
+ /* 2.2. If the found-day-of-month flag is not set and the date-token matches
+ * the day-of-month production, set the found-day-of- month flag and set
+ * the day-of-month-value to the number denoted by the date-token. Skip
+ * the remaining sub-steps and continue to the next date-token.
+ */
+ if (!found_dom) {
+ result = DAY_OF_MONTH.exec(token);
+ if (result) {
+ found_dom = true;
+ date.setUTCDate(result[1]);
+ continue;
+ }
+ }
+
+ /* 2.3. If the found-month flag is not set and the date-token matches the
+ * month production, set the found-month flag and set the month-value to
+ * the month denoted by the date-token. Skip the remaining sub-steps and
+ * continue to the next date-token.
+ */
+ if (!found_month) {
+ result = MONTH.exec(token);
+ if (result) {
+ found_month = true;
+ date.setUTCMonth(MONTH_TO_NUM[result[1].toLowerCase()]);
+ continue;
+ }
+ }
+
+ /* 2.4. If the found-year flag is not set and the date-token matches the year
+ * production, set the found-year flag and set the year-value to the number
+ * denoted by the date-token. Skip the remaining sub-steps and continue to
+ * the next date-token.
+ */
+ if (!found_year) {
+ result = YEAR.exec(token);
+ if (result) {
+ var year = result[0];
+ /* From S5.1.1:
+ * 3. If the year-value is greater than or equal to 70 and less
+ * than or equal to 99, increment the year-value by 1900.
+ * 4. If the year-value is greater than or equal to 0 and less
+ * than or equal to 69, increment the year-value by 2000.
+ */
+ if (70 <= year && year <= 99)
+ year += 1900;
+ else if (0 <= year && year <= 69)
+ year += 2000;
+
+ if (year < 1601)
+ return; // 5. ... the year-value is less than 1601
+
+ found_year = true;
+ date.setUTCFullYear(year);
+ continue;
+ }
+ }
+ }
+
+ if (!(found_time && found_dom && found_month && found_year)) {
+ return; // 5. ... at least one of the found-day-of-month, found-month, found-
+ // year, or found-time flags is not set,
+ }
+
+ return date;
+}
+
+function formatDate(date) {
+ var d = date.getUTCDate(); d = d >= 10 ? d : '0'+d;
+ var h = date.getUTCHours(); h = h >= 10 ? h : '0'+h;
+ var m = date.getUTCMinutes(); m = m >= 10 ? m : '0'+m;
+ var s = date.getUTCSeconds(); s = s >= 10 ? s : '0'+s;
+ return NUM_TO_DAY[date.getUTCDay()] + ', ' +
+ d+' '+ NUM_TO_MONTH[date.getUTCMonth()] +' '+ date.getUTCFullYear() +' '+
+ h+':'+m+':'+s+' GMT';
+}
+
+// S5.1.2 Canonicalized Host Names
+function canonicalDomain(str) {
+ if (str == null) return null;
+ str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading .
+
+ // convert to IDN if any non-ASCII characters
+ if (punycode && /[^\u0001-\u007f]/.test(str))
+ str = punycode.toASCII(str);
+
+ return str.toLowerCase();
+}
+
+// S5.1.3 Domain Matching
+function domainMatch(str, domStr, canonicalize) {
+ if (str == null || domStr == null) return null;
+ if (canonicalize !== false) {
+ str = canonicalDomain(str);
+ domStr = canonicalDomain(domStr);
+ }
+
+ /*
+ * "The domain string and the string are identical. (Note that both the
+ * domain string and the string will have been canonicalized to lower case at
+ * this point)"
+ */
+ if (str == domStr) return true;
+
+ /* "All of the following [three] conditions hold:" (order adjusted from the RFC) */
+
+ /* "* The string is a host name (i.e., not an IP address)." */
+ if (net.isIP(str)) return false;
+
+ /* "* The domain string is a suffix of the string" */
+ var idx = str.indexOf(domStr);
+ if (idx <= 0) return false; // it's a non-match (-1) or prefix (0)
+
+ // e.g "a.b.c".indexOf("b.c") === 2
+ // 5 === 3+2
+ if (str.length !== domStr.length + idx) // it's not a suffix
+ return false;
+
+ /* "* The last character of the string that is not included in the domain
+ * string is a %x2E (".") character." */
+ if (str.substr(idx-1,1) !== '.') return false;
+ return true;
+}
+
+
+// RFC6265 S5.1.4 Paths and Path-Match
+
+/*
+ * "The user agent MUST use an algorithm equivalent to the following algorithm
+ * to compute the default-path of a cookie:"
+ *
+ * Assumption: the path (and not query part or absolute uri) is passed in.
+ */
+function defaultPath(path) {
+ // "2. If the uri-path is empty or if the first character of the uri-path is not
+ // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
+ if (!path || path.substr(0,1) !== "/") return "/";
+
+ // "3. If the uri-path contains no more than one %x2F ("/") character, output
+ // %x2F ("/") and skip the remaining step."
+ if (path === "/") return path;
+
+ var rightSlash = path.lastIndexOf("/");
+ if (rightSlash === 0) return "/";
+
+ // "4. Output the characters of the uri-path from the first character up to,
+ // but not including, the right-most %x2F ("/")."
+ return path.slice(0, rightSlash);
+}
+
+/*
+ * "A request-path path-matches a given cookie-path if at least one of the
+ * following conditions holds:"
+ */
+function pathMatch(reqPath,cookiePath) {
+ // "o The cookie-path and the request-path are identical."
+ if (cookiePath === reqPath)
+ return true;
+
+ var idx = reqPath.indexOf(cookiePath);
+ if (idx === 0) {
+ // "o The cookie-path is a prefix of the request-path, and the last
+ // character of the cookie-path is %x2F ("/")."
+ if (cookiePath.substr(-1) === "/")
+ return true;
+
+ // " o The cookie-path is a prefix of the request-path, and the first
+ // character of the request-path that is not included in the cookie- path
+ // is a %x2F ("/") character."
+ if (reqPath.substr(cookiePath.length,1) === "/")
+ return true;
+ }
+
+ return false;
+}
+
+function parse(str, strict) {
+ str = str.trim();
+
+ // S4.1.1 Trailing semi-colons are not part of the specification.
+ // If we are not in strict mode we remove the trailing semi-colons.
+ var semiColonCheck = TRAILING_SEMICOLON.exec(str);
+ if (semiColonCheck) {
+ if (strict) return;
+ str = str.slice(0, semiColonCheck.index);
+ }
+
+ // We use a regex to parse the "name-value-pair" part of S5.2
+ var firstSemi = str.indexOf(';'); // S5.2 step 1
+ var pairRx = strict ? COOKIE_PAIR_STRICT : COOKIE_PAIR;
+ var result = pairRx.exec(firstSemi === -1 ? str : str.substr(0,firstSemi));
+
+ // Rx satisfies the "the name string is empty" and "lacks a %x3D ("=")"
+ // constraints as well as trimming any whitespace.
+ if (!result) return;
+
+ var c = new Cookie();
+ c.key = result[1]; // the regexp should trim() already
+ c.value = result[3]; // [2] is quotes or empty-string
+
+ if (firstSemi === -1) return c;
+
+ // S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string
+ // (including the %x3B (";") in question)." plus later on in the same section
+ // "discard the first ";" and trim".
+ var unparsed = str.slice(firstSemi).replace(/^\s*;\s*/,'').trim();
+
+ // "If the unparsed-attributes string is empty, skip the rest of these
+ // steps."
+ if (unparsed.length === 0) return c;
+
+ /*
+ * S5.2 says that when looping over the items "[p]rocess the attribute-name
+ * and attribute-value according to the requirements in the following
+ * subsections" for every item. Plus, for many of the individual attributes
+ * in S5.3 it says to use the "attribute-value of the last attribute in the
+ * cookie-attribute-list". Therefore, in this implementation, we overwrite
+ * the previous value.
+ */
+ var cookie_avs = unparsed.split(/\s*;\s*/);
+ while (cookie_avs.length) {
+ var av = cookie_avs.shift();
+
+ if (strict && !EXTENSION_AV.test(av)) return;
+
+ var av_sep = av.indexOf('=');
+ var av_key, av_value;
+ if (av_sep === -1) {
+ av_key = av;
+ av_value = null;
+ } else {
+ av_key = av.substr(0,av_sep);
+ av_value = av.substr(av_sep+1);
+ }
+
+ av_key = av_key.trim().toLowerCase();
+ if (av_value) av_value = av_value.trim();
+
+ switch(av_key) {
+ case 'expires': // S5.2.1
+ if (!av_value) { if(strict){return}else{break;} }
+ var exp = parseDate(av_value,strict);
+ // "If the attribute-value failed to parse as a cookie date, ignore the
+ // cookie-av."
+ if (exp == null) { if(strict){return}else{break;} }
+ c.expires = exp;
+ // over and underflow not realistically a concern: V8's getTime() seems to
+ // store something larger than a 32-bit time_t (even with 32-bit node)
+ break;
+
+ case 'max-age': // S5.2.2
+ if (!av_value) { if(strict){return}else{break;} }
+ // "If the first character of the attribute-value is not a DIGIT or a "-"
+ // character ...[or]... If the remainder of attribute-value contains a
+ // non-DIGIT character, ignore the cookie-av."
+ if (!/^-?[0-9]+$/.test(av_value)) { if(strict){return}else{break;} }
+ var delta = parseInt(av_value,10);
+ if (strict && delta <= 0) return; // S4.1.1
+ // "If delta-seconds is less than or equal to zero (0), let expiry-time
+ // be the earliest representable date and time."
+ c.setMaxAge(delta);
+ break;
+
+ case 'domain': // S5.2.3
+ // "If the attribute-value is empty, the behavior is undefined. However,
+ // the user agent SHOULD ignore the cookie-av entirely."
+ if (!av_value) { if(strict){return}else{break;} }
+ // S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E
+ // (".") character."
+ var domain = av_value.trim().replace(/^\./,'');
+ if (!domain) { if(strict){return}else{break;} } // see "is empty" above
+ // "Convert the cookie-domain to lower case."
+ c.domain = domain.toLowerCase();
+ break;
+
+ case 'path': // S5.2.4
+ /*
+ * "If the attribute-value is empty or if the first character of the
+ * attribute-value is not %x2F ("/"):
+ * Let cookie-path be the default-path.
+ * Otherwise:
+ * Let cookie-path be the attribute-value."
+ *
+ * We'll represent the default-path as null since it depends on the
+ * context of the parsing.
+ */
+ if (!av_value || av_value.substr(0,1) != "/") { if(strict){return}else{break;} }
+ c.path = av_value;
+ break;
+
+ case 'secure': // S5.2.5
+ /*
+ * "If the attribute-name case-insensitively matches the string "Secure",
+ * the user agent MUST append an attribute to the cookie-attribute-list
+ * with an attribute-name of Secure and an empty attribute-value."
+ */
+ if (av_value != null) { if(strict){return} }
+ c.secure = true;
+ break;
+
+ case 'httponly': // S5.2.6 -- effectively the same as 'secure'
+ if (av_value != null) { if(strict){return} }
+ c.httpOnly = true;
+ break;
+
+ default:
+ c.extensions = c.extensions || [];
+ c.extensions.push(av);
+ break;
+ }
+ }
+
+ // ensure a default date for sorting:
+ c.creation = new Date();
+ return c;
+}
+
+function fromJSON(str) {
+ if (!str) return null;
+
+ var obj;
+ try {
+ obj = JSON.parse(str);
+ } catch (e) {
+ return null;
+ }
+
+ var c = new Cookie();
+ for (var i=0; i<numCookieProperties; i++) {
+ var prop = cookieProperties[i];
+ if (obj[prop] == null) continue;
+ if (prop === 'expires' ||
+ prop === 'creation' ||
+ prop === 'lastAccessed')
+ {
+ c[prop] = obj[prop] == "Infinity" ? "Infinity" : new Date(obj[prop]);
+ } else {
+ c[prop] = obj[prop];
+ }
+ }
+
+
+ // ensure a default date for sorting:
+ c.creation = c.creation || new Date();
+
+ return c;
+}
+
+/* Section 5.4 part 2:
+ * "* Cookies with longer paths are listed before cookies with
+ * shorter paths.
+ *
+ * * Among cookies that have equal-length path fields, cookies with
+ * earlier creation-times are listed before cookies with later
+ * creation-times."
+ */
+
+function cookieCompare(a,b) {
+ // descending for length: b CMP a
+ var deltaLen = (b.path ? b.path.length : 0) - (a.path ? a.path.length : 0);
+ if (deltaLen !== 0) return deltaLen;
+ // ascending for time: a CMP b
+ return (a.creation ? a.creation.getTime() : MAX_TIME) -
+ (b.creation ? b.creation.getTime() : MAX_TIME);
+}
+
+// Gives the permutation of all possible domainMatch()es of a given domain. The
+// array is in shortest-to-longest order. Handy for indexing.
+function permuteDomain(domain) {
+ var pubSuf = pubsuffix.getPublicSuffix(domain);
+ if (!pubSuf) return null;
+ if (pubSuf == domain) return [domain];
+
+ var prefix = domain.slice(0,-(pubSuf.length+1)); // ".example.com"
+ var parts = prefix.split('.').reverse();
+ var cur = pubSuf;
+ var permutations = [cur];
+ while (parts.length) {
+ cur = parts.shift()+'.'+cur;
+ permutations.push(cur);
+ }
+ return permutations;
+}
+
+// Gives the permutation of all possible pathMatch()es of a given path. The
+// array is in longest-to-shortest order. Handy for indexing.
+function permutePath(path) {
+ var origPath = path;
+ if (path === '/') return ['/'];
+ if (path.lastIndexOf('/') === path.length-1)
+ path = path.substr(0,path.length-1);
+ var permutations = [path];
+ while (path.length > 1) {
+ var lindex = path.lastIndexOf('/');
+ if (lindex === 0) break;
+ path = path.substr(0,lindex);
+ permutations.push(path);
+ }
+ permutations.push('/');
+ return permutations;
+}
+
+
+function Cookie (opts) {
+ if (typeof opts !== "object") return;
+ Object.keys(opts).forEach(function (key) {
+ if (Cookie.prototype.hasOwnProperty(key)) {
+ this[key] = opts[key] || Cookie.prototype[key];
+ }
+ }.bind(this));
+}
+
+Cookie.parse = parse;
+Cookie.fromJSON = fromJSON;
+
+Cookie.prototype.key = "";
+Cookie.prototype.value = "";
+
+// the order in which the RFC has them:
+Cookie.prototype.expires = "Infinity"; // coerces to literal Infinity
+Cookie.prototype.maxAge = null; // takes precedence over expires for TTL
+Cookie.prototype.domain = null;
+Cookie.prototype.path = null;
+Cookie.prototype.secure = false;
+Cookie.prototype.httpOnly = false;
+Cookie.prototype.extensions = null;
+
+// set by the CookieJar:
+Cookie.prototype.hostOnly = null; // boolean when set
+Cookie.prototype.pathIsDefault = null; // boolean when set
+Cookie.prototype.creation = null; // Date when set; defaulted by Cookie.parse
+Cookie.prototype.lastAccessed = null; // Date when set
+
+var cookieProperties = Object.freeze(Object.keys(Cookie.prototype).map(function(p) {
+ if (p instanceof Function) return;
+ return p;
+}));
+var numCookieProperties = cookieProperties.length;
+
+Cookie.prototype.inspect = function inspect() {
+ var now = Date.now();
+ return 'Cookie="'+this.toString() +
+ '; hostOnly='+(this.hostOnly != null ? this.hostOnly : '?') +
+ '; aAge='+(this.lastAccessed ? (now-this.lastAccessed.getTime())+'ms' : '?') +
+ '; cAge='+(this.creation ? (now-this.creation.getTime())+'ms' : '?') +
+ '"';
+};
+
+Cookie.prototype.validate = function validate() {
+ if (!COOKIE_OCTETS.test(this.value))
+ return false;
+ if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires,true))
+ return false;
+ if (this.maxAge != null && this.maxAge <= 0)
+ return false; // "Max-Age=" non-zero-digit *DIGIT
+ if (this.path != null && !PATH_VALUE.test(this.path))
+ return false;
+
+ var cdomain = this.cdomain();
+ if (cdomain) {
+ if (cdomain.match(/\.$/))
+ return false; // S4.1.2.3 suggests that this is bad. domainMatch() tests confirm this
+ var suffix = pubsuffix.getPublicSuffix(cdomain);
+ if (suffix == null) // it's a public suffix
+ return false;
+ }
+ return true;
+};
+
+Cookie.prototype.setExpires = function setExpires(exp) {
+ if (exp instanceof Date) this.expires = exp;
+ else this.expires = parseDate(exp) || "Infinity";
+};
+
+Cookie.prototype.setMaxAge = function setMaxAge(age) {
+ if (age === Infinity || age === -Infinity)
+ this.maxAge = age.toString(); // so JSON.stringify() works
+ else
+ this.maxAge = age;
+};
+
+// gives Cookie header format
+Cookie.prototype.cookieString = function cookieString() {
+ var val = this.value;
+ if (val == null) val = '';
+ if (!val.length || COOKIE_OCTETS.test(val))
+ return this.key+'='+val;
+ else
+ return this.key+'="'+val+'"';
+};
+
+// gives Set-Cookie header format
+Cookie.prototype.toString = function toString() {
+ var str = this.cookieString();
+
+ if (this.expires != Infinity) {
+ if (this.expires instanceof Date)
+ str += '; Expires='+formatDate(this.expires);
+ else
+ str += '; Expires='+this.expires;
+ }
+
+ if (this.maxAge != null && this.maxAge != Infinity)
+ str += '; Max-Age='+this.maxAge;
+
+ if (this.domain && !this.hostOnly)
+ str += '; Domain='+this.domain;
+ if (this.path)
+ str += '; Path='+this.path;
+
+ if (this.secure) str += '; Secure';
+ if (this.httpOnly) str += '; HttpOnly';
+ if (this.extensions) {
+ this.extensions.forEach(function(ext) {
+ str += '; '+ext;
+ });
+ }
+
+ return str;
+};
+
+// TTL() partially replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
+// elsewhere)
+// S5.3 says to give the "latest representable date" for which we use Infinity
+// For "expired" we use 0
+Cookie.prototype.TTL = function TTL(now) {
+ /* RFC6265 S4.1.2.2 If a cookie has both the Max-Age and the Expires
+ * attribute, the Max-Age attribute has precedence and controls the
+ * expiration date of the cookie.
+ * (Concurs with S5.3 step 3)
+ */
+ if (this.maxAge != null) {
+ return this.maxAge<=0 ? 0 : this.maxAge*1000;
+ }
+
+ var expires = this.expires;
+ if (expires != Infinity) {
+ if (!(expires instanceof Date)) {
+ expires = parseDate(expires) || Infinity;
+ }
+
+ if (expires == Infinity)
+ return Infinity;
+
+ return expires.getTime() - (now || Date.now());
+ }
+
+ return Infinity;
+};
+
+// expiryTime() replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
+// elsewhere)
+Cookie.prototype.expiryTime = function expiryTime(now) {
+ if (this.maxAge != null) {
+ var relativeTo = this.creation || now || new Date();
+ var age = (this.maxAge <= 0) ? -Infinity : this.maxAge*1000;
+ return relativeTo.getTime() + age;
+ }
+
+ if (this.expires == Infinity) return Infinity;
+ return this.expires.getTime();
+};
+
+// expiryDate() replaces the "expiry-time" parts of S5.3 step 3 (setCookie()
+// elsewhere), except it returns a Date
+Cookie.prototype.expiryDate = function expiryDate(now) {
+ var millisec = this.expiryTime(now);
+ if (millisec == Infinity) return new Date(MAX_TIME);
+ else if (millisec == -Infinity) return new Date(MIN_TIME);
+ else return new Date(millisec);
+};
+
+// This replaces the "persistent-flag" parts of S5.3 step 3
+Cookie.prototype.isPersistent = function isPersistent() {
+ return (this.maxAge != null || this.expires != Infinity);
+};
+
+// Mostly S5.1.2 and S5.2.3:
+Cookie.prototype.cdomain =
+Cookie.prototype.canonicalizedDomain = function canonicalizedDomain() {
+ if (this.domain == null) return null;
+ return canonicalDomain(this.domain);
+};
+
+
+var memstore;
+function CookieJar(store, rejectPublicSuffixes) {
+ if (rejectPublicSuffixes != null) this.rejectPublicSuffixes = rejectPublicSuffixes;
+ if (!store) {
+ memstore = memstore || require('./memstore');
+ store = new memstore.MemoryCookieStore();
+ }
+ this.store = store;
+}
+CookieJar.prototype.store = null;
+CookieJar.prototype.rejectPublicSuffixes = true;
+
+CookieJar.prototype.setCookie = function setCookie(cookie, url, options, cb) {
+ var err;
+ var context = (url instanceof Object) ? url : urlParse(url);
+ if (options instanceof Function) {
+ cb = options;
+ options = {};
+ }
+
+ var host = canonicalDomain(context.hostname);
+
+ // S5.3 step 1
+ if (!(cookie instanceof Cookie))
+ cookie = Cookie.parse(cookie, options.strict === true);
+ if (!cookie) {
+ err = new Error("Cookie failed to parse");
+ return cb(options.ignoreError ? null : err);
+ }
+
+ // S5.3 step 2
+ var now = options.now || new Date(); // will assign later to save effort in the face of errors
+
+ // S5.3 step 3: NOOP; persistent-flag and expiry-time is handled by getCookie()
+
+ // S5.3 step 4: NOOP; domain is null by default
+
+ // S5.3 step 5: public suffixes
+ if (this.rejectPublicSuffixes && cookie.domain) {
+ var suffix = pubsuffix.getPublicSuffix(cookie.cdomain());
+ if (suffix == null) { // e.g. "com"
+ err = new Error("Cookie has domain set to a public suffix");
+ return cb(options.ignoreError ? null : err);
+ }
+ }
+
+ // S5.3 step 6:
+ if (cookie.domain) {
+ if (!domainMatch(host, cookie.cdomain(), false)) {
+ err = new Error("Cookie not in this host's domain. Cookie:"+cookie.cdomain()+" Request:"+host);
+ return cb(options.ignoreError ? null : err);
+ }
+
+ if (cookie.hostOnly == null) // don't reset if already set
+ cookie.hostOnly = false;
+
+ } else {
+ cookie.hostOnly = true;
+ cookie.domain = host;
+ }
+
+ // S5.3 step 7: "Otherwise, set the cookie's path to the default-path of the
+ // request-uri"
+ if (!cookie.path) {
+ cookie.path = defaultPath(context.pathname);
+ cookie.pathIsDefault = true;
+ } else {
+ if (cookie.path.length > 1 && cookie.path.substr(-1) == '/')
+ cookie.path = cookie.path.slice(0,-1);
+ }
+
+ // S5.3 step 8: NOOP; secure attribute
+ // S5.3 step 9: NOOP; httpOnly attribute
+
+ // S5.3 step 10
+ if (options.http === false && cookie.httpOnly) {
+ err = new Error("Cookie is HttpOnly and this isn't an HTTP API");
+ return cb(options.ignoreError ? null : err);
+ }
+
+ var store = this.store;
+
+ if (!store.updateCookie) {
+ store.updateCookie = function stubUpdateCookie(oldCookie, newCookie, cb) {
+ this.putCookie(newCookie, cb);
+ };
+ }
+
+ store.findCookie(cookie.domain, cookie.path, cookie.key, function(err,oldCookie) {
+ if (err) return cb(err);
+
+ var next = function(err) {
+ if (err) return cb(err);
+ else cb(null, cookie);
+ };
+
+ if (oldCookie) {
+ // S5.3 step 11 - "If the cookie store contains a cookie with the same name,
+ // domain, and path as the newly created cookie:"
+ if (options.http === false && oldCookie.httpOnly) { // step 11.2
+ err = new Error("old Cookie is HttpOnly and this isn't an HTTP API");
+ return cb(options.ignoreError ? null : err);
+ }
+ cookie.creation = oldCookie.creation; // step 11.3
+ cookie.lastAccessed = now;
+ // Step 11.4 (delete cookie) is implied by just setting the new one:
+ store.updateCookie(oldCookie, cookie, next); // step 12
+
+ } else {
+ cookie.creation = cookie.lastAccessed = now;
+ store.putCookie(cookie, next); // step 12
+ }
+ });
+};
+
+// RFC6365 S5.4
+CookieJar.prototype.getCookies = function getCookies(url, options, cb) {
+ var context = (url instanceof Object) ? url : urlParse(url);
+ if (options instanceof Function) {
+ cb = options;
+ options = {};
+ }
+
+ var host = canonicalDomain(context.hostname);
+ var path = context.pathname || '/';
+
+ var secure = options.secure;
+ if (secure == null && context.protocol &&
+ (context.protocol == 'https:' || context.protocol == 'wss:'))
+ {
+ secure = true;
+ }
+
+ var http = options.http;
+ if (http == null) http = true;
+
+ var now = options.now || Date.now();
+ var expireCheck = options.expire !== false;
+ var allPaths = !!options.allPaths;
+ var store = this.store;
+
+ function matchingCookie(c) {
+ // "Either:
+ // The cookie's host-only-flag is true and the canonicalized
+ // request-host is identical to the cookie's domain.
+ // Or:
+ // The cookie's host-only-flag is false and the canonicalized
+ // request-host domain-matches the cookie's domain."
+ if (c.hostOnly) {
+ if (c.domain != host) return false;
+ } else {
+ if (!domainMatch(host, c.domain, false)) return false;
+ }
+
+ // "The request-uri's path path-matches the cookie's path."
+ if (!allPaths && !pathMatch(path, c.path))
+ return false;
+
+ // "If the cookie's secure-only-flag is true, then the request-uri's
+ // scheme must denote a "secure" protocol"
+ if (c.secure && !secure)
+ return false;
+
+ // "If the cookie's http-only-flag is true, then exclude the cookie if the
+ // cookie-string is being generated for a "non-HTTP" API"
+ if (c.httpOnly && !http)
+ return false;
+
+ // deferred from S5.3
+ // non-RFC: allow retention of expired cookies by choice
+ if (expireCheck && c.expiryTime() <= now) {
+ store.removeCookie(c.domain, c.path, c.key, function(){}); // result ignored
+ return false;
+ }
+
+ return true;
+ }
+
+ store.findCookies(host, allPaths ? null : path, function(err,cookies) {
+ if (err) return cb(err);
+
+ cookies = cookies.filter(matchingCookie);
+
+ // sorting of S5.4 part 2
+ if (options.sort !== false)
+ cookies = cookies.sort(cookieCompare);
+
+ // S5.4 part 3
+ var now = new Date();
+ cookies.forEach(function(c) { c.lastAccessed = now });
+ // TODO persist lastAccessed
+
+ cb(null,cookies);
+ });
+};
+
+CookieJar.prototype.getCookieString = function(/*..., cb*/) {
+ var args = Array.prototype.slice.call(arguments,0);
+ var cb = args.pop();
+ var next = function(err,cookies) {
+ if (err) cb(err);
+ else cb(null, cookies.map(function(c){return c.cookieString()}).join('; '));
+ };
+ args.push(next);
+ this.getCookies.apply(this,args);
+};
+
+CookieJar.prototype.getSetCookieStrings = function(/*..., cb*/) {
+ var args = Array.prototype.slice.call(arguments,0);
+ var cb = args.pop();
+ var next = function(err,cookies) {
+ if (err) cb(err);
+ else cb(null, cookies.map(function(c){return c.toString()}));
+ };
+ args.push(next);
+ this.getCookies.apply(this,args);
+};
+
+
+
+module.exports = {
+ CookieJar: CookieJar,
+ Cookie: Cookie,
+ parseDate: parseDate,
+ formatDate: formatDate,
+ parse: parse,
+ fromJSON: fromJSON,
+ domainMatch: domainMatch,
+ defaultPath: defaultPath,
+ pathMatch: pathMatch,
+ getPublicSuffix: pubsuffix.getPublicSuffix,
+ cookieCompare: cookieCompare,
+ permuteDomain: permuteDomain,
+ permutePath: permutePath,
+ canonicalDomain: canonicalDomain,
+};
--- /dev/null
+var tough = require('./cookie');
+var permuteDomain = tough.permuteDomain;
+var permutePath = tough.permutePath;
+var util = require('util');
+
+function MemoryCookieStore() {
+ this.idx = {};
+}
+module.exports.MemoryCookieStore = MemoryCookieStore;
+MemoryCookieStore.prototype.idx = null;
+
+// force a default depth:
+MemoryCookieStore.prototype.inspect = function inspect() {
+ return "{ idx: "+util.inspect(this.idx, false, 2)+' }';
+};
+
+MemoryCookieStore.prototype.findCookie = function findCookie(domain, path, key, cb) {
+ if (!this.idx[domain]) return cb(null,undefined);
+ if (!this.idx[domain][path]) return cb(null,undefined);
+ return cb(null,this.idx[domain][path][key]||null);
+};
+
+MemoryCookieStore.prototype.findCookies = function findCookies(domain, path, cb) {
+ var results = [];
+ if (!domain) return cb(null,[]);
+
+ var pathMatcher;
+ if (!path) {
+ // null or '/' means "all paths"
+ pathMatcher = function matchAll(domainIndex) {
+ for (var curPath in domainIndex) {
+ var pathIndex = domainIndex[curPath];
+ for (var key in pathIndex) {
+ results.push(pathIndex[key]);
+ }
+ }
+ };
+
+ } else if (path === '/') {
+ pathMatcher = function matchSlash(domainIndex) {
+ var pathIndex = domainIndex['/'];
+ if (!pathIndex) return;
+ for (var key in pathIndex) {
+ results.push(pathIndex[key]);
+ }
+ };
+
+ } else {
+ var paths = permutePath(path) || [path];
+ pathMatcher = function matchRFC(domainIndex) {
+ paths.forEach(function(curPath) {
+ var pathIndex = domainIndex[curPath];
+ if (!pathIndex) return;
+ for (var key in pathIndex) {
+ results.push(pathIndex[key]);
+ }
+ });
+ };
+ }
+
+ var domains = permuteDomain(domain) || [domain];
+ var idx = this.idx;
+ domains.forEach(function(curDomain) {
+ var domainIndex = idx[curDomain];
+ if (!domainIndex) return;
+ pathMatcher(domainIndex);
+ });
+
+ cb(null,results);
+};
+
+MemoryCookieStore.prototype.putCookie = function putCookie(cookie, cb) {
+ if (!this.idx[cookie.domain]) this.idx[cookie.domain] = {};
+ if (!this.idx[cookie.domain][cookie.path]) this.idx[cookie.domain][cookie.path] = {};
+ this.idx[cookie.domain][cookie.path][cookie.key] = cookie;
+ cb(null);
+};
+
+MemoryCookieStore.prototype.updateCookie = function updateCookie(oldCookie, newCookie, cb) {
+ // updateCookie() may avoid updating cookies that are identical. For example,
+ // lastAccessed may not be important to some stores and an equality
+ // comparison could exclude that field.
+ this.putCookie(newCookie,cb);
+};
+
+MemoryCookieStore.prototype.removeCookie = function removeCookie(domain, path, key, cb) {
+ if (this.idx[domain] && this.idx[domain][path] && this.idx[domain][path][key]) {
+ delete this.idx[domain][path][key];
+ }
+ cb(null);
+};
+
+MemoryCookieStore.prototype.removeCookies = function removeCookies(domain, path, cb) {
+ if (!this.idx[domain]) {
+ if (path) {
+ delete this.idx[domain][path];
+ } else {
+ delete this.idx[domain];
+ }
+ }
+ return cb(null);
+};
--- /dev/null
+/****************************************************
+ * AUTOMATICALLY GENERATED by generate-pubsuffix.js *
+ * DO NOT EDIT! *
+ ****************************************************/
+
+module.exports.getPublicSuffix = function getPublicSuffix(domain) {
+ /*
+ * Copyright GoInstant, Inc. and other contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+ if (!domain) return null;
+ if (domain.match(/^\./)) return null;
+
+ domain = domain.toLowerCase();
+ var parts = domain.split('.').reverse();
+
+ var suffix = '';
+ var suffixLen = 0;
+ for (var i=0; i<parts.length; i++) {
+ var part = parts[i];
+ var starstr = '*'+suffix;
+ var partstr = part+suffix;
+
+ if (index[starstr]) { // star rule matches
+ suffixLen = i+1;
+ if (index[partstr] === false) { // exception rule matches (NB: false, not undefined)
+ suffixLen--;
+ }
+ } else if (index[partstr]) { // exact match, not exception
+ suffixLen = i+1;
+ }
+
+ suffix = '.'+part+suffix;
+ }
+
+ if (index['*'+suffix]) { // *.domain exists (e.g. *.kyoto.jp for domain='kyoto.jp');
+ return null;
+ }
+
+ if (suffixLen && parts.length > suffixLen) {
+ return parts.slice(0,suffixLen+1).reverse().join('.');
+ }
+
+ return null;
+};
+
+// The following generated structure is used under the MPL version 1.1
+// See public-suffix.txt for more information
+
+var index = module.exports.index = Object.freeze(
+{"ac":true,"com.ac":true,"edu.ac":true,"gov.ac":true,"net.ac":true,"mil.ac":true,"org.ac":true,"ad":true,"nom.ad":true,"ae":true,"co.ae":true,"net.ae":true,"org.ae":true,"sch.ae":true,"ac.ae":true,"gov.ae":true,"mil.ae":true,"aero":true,"accident-investigation.aero":true,"accident-prevention.aero":true,"aerobatic.aero":true,"aeroclub.aero":true,"aerodrome.aero":true,"agents.aero":true,"aircraft.aero":true,"airline.aero":true,"airport.aero":true,"air-surveillance.aero":true,"airtraffic.aero":true,"air-traffic-control.aero":true,"ambulance.aero":true,"amusement.aero":true,"association.aero":true,"author.aero":true,"ballooning.aero":true,"broker.aero":true,"caa.aero":true,"cargo.aero":true,"catering.aero":true,"certification.aero":true,"championship.aero":true,"charter.aero":true,"civilaviation.aero":true,"club.aero":true,"conference.aero":true,"consultant.aero":true,"consulting.aero":true,"control.aero":true,"council.aero":true,"crew.aero":true,"design.aero":true,"dgca.aero":true,"educator.aero":true,"emergency.aero":true,"engine.aero":true,"engineer.aero":true,"entertainment.aero":true,"equipment.aero":true,"exchange.aero":true,"express.aero":true,"federation.aero":true,"flight.aero":true,"freight.aero":true,"fuel.aero":true,"gliding.aero":true,"government.aero":true,"groundhandling.aero":true,"group.aero":true,"hanggliding.aero":true,"homebuilt.aero":true,"insurance.aero":true,"journal.aero":true,"journalist.aero":true,"leasing.aero":true,"logistics.aero":true,"magazine.aero":true,"maintenance.aero":true,"marketplace.aero":true,"media.aero":true,"microlight.aero":true,"modelling.aero":true,"navigation.aero":true,"parachuting.aero":true,"paragliding.aero":true,"passenger-association.aero":true,"pilot.aero":true,"press.aero":true,"production.aero":true,"recreation.aero":true,"repbody.aero":true,"res.aero":true,"research.aero":true,"rotorcraft.aero":true,"safety.aero":true,"scientist.aero":true,"services.aero":true,"show.aero":true,"skydiving.aero":true,"software.aero":true,"student.aero":true,"taxi.aero":true,"trader.aero":true,"trading.aero":true,"trainer.aero":true,"union.aero":true,"workinggroup.aero":true,"works.aero":true,"af":true,"gov.af":true,"com.af":true,"org.af":true,"net.af":true,"edu.af":true,"ag":true,"com.ag":true,"org.ag":true,"net.ag":true,"co.ag":true,"nom.ag":true,"ai":true,"off.ai":true,"com.ai":true,"net.ai":true,"org.ai":true,"al":true,"com.al":true,"edu.al":true,"gov.al":true,"mil.al":true,"net.al":true,"org.al":true,"am":true,"an":true,"com.an":true,"net.an":true,"org.an":true,"edu.an":true,"ao":true,"ed.ao":true,"gv.ao":true,"og.ao":true,"co.ao":true,"pb.ao":true,"it.ao":true,"aq":true,"*.ar":true,"congresodelalengua3.ar":false,"educ.ar":false,"gobiernoelectronico.ar":false,"mecon.ar":false,"nacion.ar":false,"nic.ar":false,"promocion.ar":false,"retina.ar":false,"uba.ar":false,"e164.arpa":true,"in-addr.arpa":true,"ip6.arpa":true,"iris.arpa":true,"uri.arpa":true,"urn.arpa":true,"as":true,"gov.as":true,"asia":true,"at":true,"ac.at":true,"co.at":true,"gv.at":true,"or.at":true,"com.au":true,"net.au":true,"org.au":true,"edu.au":true,"gov.au":true,"csiro.au":true,"asn.au":true,"id.au":true,"info.au":true,"conf.au":true,"oz.au":true,"act.au":true,"nsw.au":true,"nt.au":true,"qld.au":true,"sa.au":true,"tas.au":true,"vic.au":true,"wa.au":true,"act.edu.au":true,"nsw.edu.au":true,"nt.edu.au":true,"qld.edu.au":true,"sa.edu.au":true,"tas.edu.au":true,"vic.edu.au":true,"wa.edu.au":true,"act.gov.au":true,"nt.gov.au":true,"qld.gov.au":true,"sa.gov.au":true,"tas.gov.au":true,"vic.gov.au":true,"wa.gov.au":true,"aw":true,"com.aw":true,"ax":true,"az":true,"com.az":true,"net.az":true,"int.az":true,"gov.az":true,"org.az":true,"edu.az":true,"info.az":true,"pp.az":true,"mil.az":true,"name.az":true,"pro.az":true,"biz.az":true,"ba":true,"org.ba":true,"net.ba":true,"edu.ba":true,"gov.ba":true,"mil.ba":true,"unsa.ba":true,"unbi.ba":true,"co.ba":true,"com.ba":true,"rs.ba":true,"bb":true,"biz.bb":true,"com.bb":true,"edu.bb":true,"gov.bb":true,"info.bb":true,"net.bb":true,"org.bb":true,"store.bb":true,"*.bd":true,"be":true,"ac.be":true,"bf":true,"gov.bf":true,"bg":true,"a.bg":true,"b.bg":true,"c.bg":true,"d.bg":true,"e.bg":true,"f.bg":true,"g.bg":true,"h.bg":true,"i.bg":true,"j.bg":true,"k.bg":true,"l.bg":true,"m.bg":true,"n.bg":true,"o.bg":true,"p.bg":true,"q.bg":true,"r.bg":true,"s.bg":true,"t.bg":true,"u.bg":true,"v.bg":true,"w.bg":true,"x.bg":true,"y.bg":true,"z.bg":true,"0.bg":true,"1.bg":true,"2.bg":true,"3.bg":true,"4.bg":true,"5.bg":true,"6.bg":true,"7.bg":true,"8.bg":true,"9.bg":true,"bh":true,"com.bh":true,"edu.bh":true,"net.bh":true,"org.bh":true,"gov.bh":true,"bi":true,"co.bi":true,"com.bi":true,"edu.bi":true,"or.bi":true,"org.bi":true,"biz":true,"bj":true,"asso.bj":true,"barreau.bj":true,"gouv.bj":true,"bm":true,"com.bm":true,"edu.bm":true,"gov.bm":true,"net.bm":true,"org.bm":true,"*.bn":true,"bo":true,"com.bo":true,"edu.bo":true,"gov.bo":true,"gob.bo":true,"int.bo":true,"org.bo":true,"net.bo":true,"mil.bo":true,"tv.bo":true,"br":true,"adm.br":true,"adv.br":true,"agr.br":true,"am.br":true,"arq.br":true,"art.br":true,"ato.br":true,"b.br":true,"bio.br":true,"blog.br":true,"bmd.br":true,"can.br":true,"cim.br":true,"cng.br":true,"cnt.br":true,"com.br":true,"coop.br":true,"ecn.br":true,"edu.br":true,"emp.br":true,"eng.br":true,"esp.br":true,"etc.br":true,"eti.br":true,"far.br":true,"flog.br":true,"fm.br":true,"fnd.br":true,"fot.br":true,"fst.br":true,"g12.br":true,"ggf.br":true,"gov.br":true,"imb.br":true,"ind.br":true,"inf.br":true,"jor.br":true,"jus.br":true,"lel.br":true,"mat.br":true,"med.br":true,"mil.br":true,"mus.br":true,"net.br":true,"nom.br":true,"not.br":true,"ntr.br":true,"odo.br":true,"org.br":true,"ppg.br":true,"pro.br":true,"psc.br":true,"psi.br":true,"qsl.br":true,"radio.br":true,"rec.br":true,"slg.br":true,"srv.br":true,"taxi.br":true,"teo.br":true,"tmp.br":true,"trd.br":true,"tur.br":true,"tv.br":true,"vet.br":true,"vlog.br":true,"wiki.br":true,"zlg.br":true,"bs":true,"com.bs":true,"net.bs":true,"org.bs":true,"edu.bs":true,"gov.bs":true,"bt":true,"com.bt":true,"edu.bt":true,"gov.bt":true,"net.bt":true,"org.bt":true,"bw":true,"co.bw":true,"org.bw":true,"by":true,"gov.by":true,"mil.by":true,"com.by":true,"of.by":true,"bz":true,"com.bz":true,"net.bz":true,"org.bz":true,"edu.bz":true,"gov.bz":true,"ca":true,"ab.ca":true,"bc.ca":true,"mb.ca":true,"nb.ca":true,"nf.ca":true,"nl.ca":true,"ns.ca":true,"nt.ca":true,"nu.ca":true,"on.ca":true,"pe.ca":true,"qc.ca":true,"sk.ca":true,"yk.ca":true,"gc.ca":true,"cat":true,"cc":true,"cd":true,"gov.cd":true,"cf":true,"cg":true,"ch":true,"ci":true,"org.ci":true,"or.ci":true,"com.ci":true,"co.ci":true,"edu.ci":true,"ed.ci":true,"ac.ci":true,"net.ci":true,"go.ci":true,"asso.ci":true,"xn--aroport-bya.ci":true,"int.ci":true,"presse.ci":true,"md.ci":true,"gouv.ci":true,"*.ck":true,"www.ck":false,"cl":true,"gov.cl":true,"gob.cl":true,"co.cl":true,"mil.cl":true,"cm":true,"gov.cm":true,"cn":true,"ac.cn":true,"com.cn":true,"edu.cn":true,"gov.cn":true,"net.cn":true,"org.cn":true,"mil.cn":true,"xn--55qx5d.cn":true,"xn--io0a7i.cn":true,"xn--od0alg.cn":true,"ah.cn":true,"bj.cn":true,"cq.cn":true,"fj.cn":true,"gd.cn":true,"gs.cn":true,"gz.cn":true,"gx.cn":true,"ha.cn":true,"hb.cn":true,"he.cn":true,"hi.cn":true,"hl.cn":true,"hn.cn":true,"jl.cn":true,"js.cn":true,"jx.cn":true,"ln.cn":true,"nm.cn":true,"nx.cn":true,"qh.cn":true,"sc.cn":true,"sd.cn":true,"sh.cn":true,"sn.cn":true,"sx.cn":true,"tj.cn":true,"xj.cn":true,"xz.cn":true,"yn.cn":true,"zj.cn":true,"hk.cn":true,"mo.cn":true,"tw.cn":true,"co":true,"arts.co":true,"com.co":true,"edu.co":true,"firm.co":true,"gov.co":true,"info.co":true,"int.co":true,"mil.co":true,"net.co":true,"nom.co":true,"org.co":true,"rec.co":true,"web.co":true,"com":true,"coop":true,"cr":true,"ac.cr":true,"co.cr":true,"ed.cr":true,"fi.cr":true,"go.cr":true,"or.cr":true,"sa.cr":true,"cu":true,"com.cu":true,"edu.cu":true,"org.cu":true,"net.cu":true,"gov.cu":true,"inf.cu":true,"cv":true,"cx":true,"gov.cx":true,"*.cy":true,"cz":true,"de":true,"dj":true,"dk":true,"dm":true,"com.dm":true,"net.dm":true,"org.dm":true,"edu.dm":true,"gov.dm":true,"do":true,"art.do":true,"com.do":true,"edu.do":true,"gob.do":true,"gov.do":true,"mil.do":true,"net.do":true,"org.do":true,"sld.do":true,"web.do":true,"dz":true,"com.dz":true,"org.dz":true,"net.dz":true,"gov.dz":true,"edu.dz":true,"asso.dz":true,"pol.dz":true,"art.dz":true,"ec":true,"com.ec":true,"info.ec":true,"net.ec":true,"fin.ec":true,"k12.ec":true,"med.ec":true,"pro.ec":true,"org.ec":true,"edu.ec":true,"gov.ec":true,"gob.ec":true,"mil.ec":true,"edu":true,"ee":true,"edu.ee":true,"gov.ee":true,"riik.ee":true,"lib.ee":true,"med.ee":true,"com.ee":true,"pri.ee":true,"aip.ee":true,"org.ee":true,"fie.ee":true,"eg":true,"com.eg":true,"edu.eg":true,"eun.eg":true,"gov.eg":true,"mil.eg":true,"name.eg":true,"net.eg":true,"org.eg":true,"sci.eg":true,"*.er":true,"es":true,"com.es":true,"nom.es":true,"org.es":true,"gob.es":true,"edu.es":true,"*.et":true,"eu":true,"fi":true,"aland.fi":true,"*.fj":true,"*.fk":true,"fm":true,"fo":true,"fr":true,"com.fr":true,"asso.fr":true,"nom.fr":true,"prd.fr":true,"presse.fr":true,"tm.fr":true,"aeroport.fr":true,"assedic.fr":true,"avocat.fr":true,"avoues.fr":true,"cci.fr":true,"chambagri.fr":true,"chirurgiens-dentistes.fr":true,"experts-comptables.fr":true,"geometre-expert.fr":true,"gouv.fr":true,"greta.fr":true,"huissier-justice.fr":true,"medecin.fr":true,"notaires.fr":true,"pharmacien.fr":true,"port.fr":true,"veterinaire.fr":true,"ga":true,"gd":true,"ge":true,"com.ge":true,"edu.ge":true,"gov.ge":true,"org.ge":true,"mil.ge":true,"net.ge":true,"pvt.ge":true,"gf":true,"gg":true,"co.gg":true,"org.gg":true,"net.gg":true,"sch.gg":true,"gov.gg":true,"gh":true,"com.gh":true,"edu.gh":true,"gov.gh":true,"org.gh":true,"mil.gh":true,"gi":true,"com.gi":true,"ltd.gi":true,"gov.gi":true,"mod.gi":true,"edu.gi":true,"org.gi":true,"gl":true,"gm":true,"ac.gn":true,"com.gn":true,"edu.gn":true,"gov.gn":true,"org.gn":true,"net.gn":true,"gov":true,"gp":true,"com.gp":true,"net.gp":true,"mobi.gp":true,"edu.gp":true,"org.gp":true,"asso.gp":true,"gq":true,"gr":true,"com.gr":true,"edu.gr":true,"net.gr":true,"org.gr":true,"gov.gr":true,"gs":true,"*.gt":true,"www.gt":false,"*.gu":true,"gw":true,"gy":true,"co.gy":true,"com.gy":true,"net.gy":true,"hk":true,"com.hk":true,"edu.hk":true,"gov.hk":true,"idv.hk":true,"net.hk":true,"org.hk":true,"xn--55qx5d.hk":true,"xn--wcvs22d.hk":true,"xn--lcvr32d.hk":true,"xn--mxtq1m.hk":true,"xn--gmqw5a.hk":true,"xn--ciqpn.hk":true,"xn--gmq050i.hk":true,"xn--zf0avx.hk":true,"xn--io0a7i.hk":true,"xn--mk0axi.hk":true,"xn--od0alg.hk":true,"xn--od0aq3b.hk":true,"xn--tn0ag.hk":true,"xn--uc0atv.hk":true,"xn--uc0ay4a.hk":true,"hm":true,"hn":true,"com.hn":true,"edu.hn":true,"org.hn":true,"net.hn":true,"mil.hn":true,"gob.hn":true,"hr":true,"iz.hr":true,"from.hr":true,"name.hr":true,"com.hr":true,"ht":true,"com.ht":true,"shop.ht":true,"firm.ht":true,"info.ht":true,"adult.ht":true,"net.ht":true,"pro.ht":true,"org.ht":true,"med.ht":true,"art.ht":true,"coop.ht":true,"pol.ht":true,"asso.ht":true,"edu.ht":true,"rel.ht":true,"gouv.ht":true,"perso.ht":true,"hu":true,"co.hu":true,"info.hu":true,"org.hu":true,"priv.hu":true,"sport.hu":true,"tm.hu":true,"2000.hu":true,"agrar.hu":true,"bolt.hu":true,"casino.hu":true,"city.hu":true,"erotica.hu":true,"erotika.hu":true,"film.hu":true,"forum.hu":true,"games.hu":true,"hotel.hu":true,"ingatlan.hu":true,"jogasz.hu":true,"konyvelo.hu":true,"lakas.hu":true,"media.hu":true,"news.hu":true,"reklam.hu":true,"sex.hu":true,"shop.hu":true,"suli.hu":true,"szex.hu":true,"tozsde.hu":true,"utazas.hu":true,"video.hu":true,"id":true,"ac.id":true,"co.id":true,"go.id":true,"mil.id":true,"net.id":true,"or.id":true,"sch.id":true,"web.id":true,"ie":true,"gov.ie":true,"*.il":true,"im":true,"co.im":true,"ltd.co.im":true,"plc.co.im":true,"net.im":true,"gov.im":true,"org.im":true,"nic.im":true,"ac.im":true,"in":true,"co.in":true,"firm.in":true,"net.in":true,"org.in":true,"gen.in":true,"ind.in":true,"nic.in":true,"ac.in":true,"edu.in":true,"res.in":true,"gov.in":true,"mil.in":true,"info":true,"int":true,"eu.int":true,"io":true,"com.io":true,"iq":true,"gov.iq":true,"edu.iq":true,"mil.iq":true,"com.iq":true,"org.iq":true,"net.iq":true,"ir":true,"ac.ir":true,"co.ir":true,"gov.ir":true,"id.ir":true,"net.ir":true,"org.ir":true,"sch.ir":true,"xn--mgba3a4f16a.ir":true,"xn--mgba3a4fra.ir":true,"is":true,"net.is":true,"com.is":true,"edu.is":true,"gov.is":true,"org.is":true,"int.is":true,"it":true,"gov.it":true,"edu.it":true,"agrigento.it":true,"ag.it":true,"alessandria.it":true,"al.it":true,"ancona.it":true,"an.it":true,"aosta.it":true,"aoste.it":true,"ao.it":true,"arezzo.it":true,"ar.it":true,"ascoli-piceno.it":true,"ascolipiceno.it":true,"ap.it":true,"asti.it":true,"at.it":true,"avellino.it":true,"av.it":true,"bari.it":true,"ba.it":true,"andria-barletta-trani.it":true,"andriabarlettatrani.it":true,"trani-barletta-andria.it":true,"tranibarlettaandria.it":true,"barletta-trani-andria.it":true,"barlettatraniandria.it":true,"andria-trani-barletta.it":true,"andriatranibarletta.it":true,"trani-andria-barletta.it":true,"traniandriabarletta.it":true,"bt.it":true,"belluno.it":true,"bl.it":true,"benevento.it":true,"bn.it":true,"bergamo.it":true,"bg.it":true,"biella.it":true,"bi.it":true,"bologna.it":true,"bo.it":true,"bolzano.it":true,"bozen.it":true,"balsan.it":true,"alto-adige.it":true,"altoadige.it":true,"suedtirol.it":true,"bz.it":true,"brescia.it":true,"bs.it":true,"brindisi.it":true,"br.it":true,"cagliari.it":true,"ca.it":true,"caltanissetta.it":true,"cl.it":true,"campobasso.it":true,"cb.it":true,"carboniaiglesias.it":true,"carbonia-iglesias.it":true,"iglesias-carbonia.it":true,"iglesiascarbonia.it":true,"ci.it":true,"caserta.it":true,"ce.it":true,"catania.it":true,"ct.it":true,"catanzaro.it":true,"cz.it":true,"chieti.it":true,"ch.it":true,"como.it":true,"co.it":true,"cosenza.it":true,"cs.it":true,"cremona.it":true,"cr.it":true,"crotone.it":true,"kr.it":true,"cuneo.it":true,"cn.it":true,"dell-ogliastra.it":true,"dellogliastra.it":true,"ogliastra.it":true,"og.it":true,"enna.it":true,"en.it":true,"ferrara.it":true,"fe.it":true,"fermo.it":true,"fm.it":true,"firenze.it":true,"florence.it":true,"fi.it":true,"foggia.it":true,"fg.it":true,"forli-cesena.it":true,"forlicesena.it":true,"cesena-forli.it":true,"cesenaforli.it":true,"fc.it":true,"frosinone.it":true,"fr.it":true,"genova.it":true,"genoa.it":true,"ge.it":true,"gorizia.it":true,"go.it":true,"grosseto.it":true,"gr.it":true,"imperia.it":true,"im.it":true,"isernia.it":true,"is.it":true,"laquila.it":true,"aquila.it":true,"aq.it":true,"la-spezia.it":true,"laspezia.it":true,"sp.it":true,"latina.it":true,"lt.it":true,"lecce.it":true,"le.it":true,"lecco.it":true,"lc.it":true,"livorno.it":true,"li.it":true,"lodi.it":true,"lo.it":true,"lucca.it":true,"lu.it":true,"macerata.it":true,"mc.it":true,"mantova.it":true,"mn.it":true,"massa-carrara.it":true,"massacarrara.it":true,"carrara-massa.it":true,"carraramassa.it":true,"ms.it":true,"matera.it":true,"mt.it":true,"medio-campidano.it":true,"mediocampidano.it":true,"campidano-medio.it":true,"campidanomedio.it":true,"vs.it":true,"messina.it":true,"me.it":true,"milano.it":true,"milan.it":true,"mi.it":true,"modena.it":true,"mo.it":true,"monza.it":true,"monza-brianza.it":true,"monzabrianza.it":true,"monzaebrianza.it":true,"monzaedellabrianza.it":true,"monza-e-della-brianza.it":true,"mb.it":true,"napoli.it":true,"naples.it":true,"na.it":true,"novara.it":true,"no.it":true,"nuoro.it":true,"nu.it":true,"oristano.it":true,"or.it":true,"padova.it":true,"padua.it":true,"pd.it":true,"palermo.it":true,"pa.it":true,"parma.it":true,"pr.it":true,"pavia.it":true,"pv.it":true,"perugia.it":true,"pg.it":true,"pescara.it":true,"pe.it":true,"pesaro-urbino.it":true,"pesarourbino.it":true,"urbino-pesaro.it":true,"urbinopesaro.it":true,"pu.it":true,"piacenza.it":true,"pc.it":true,"pisa.it":true,"pi.it":true,"pistoia.it":true,"pt.it":true,"pordenone.it":true,"pn.it":true,"potenza.it":true,"pz.it":true,"prato.it":true,"po.it":true,"ragusa.it":true,"rg.it":true,"ravenna.it":true,"ra.it":true,"reggio-calabria.it":true,"reggiocalabria.it":true,"rc.it":true,"reggio-emilia.it":true,"reggioemilia.it":true,"re.it":true,"rieti.it":true,"ri.it":true,"rimini.it":true,"rn.it":true,"roma.it":true,"rome.it":true,"rm.it":true,"rovigo.it":true,"ro.it":true,"salerno.it":true,"sa.it":true,"sassari.it":true,"ss.it":true,"savona.it":true,"sv.it":true,"siena.it":true,"si.it":true,"siracusa.it":true,"sr.it":true,"sondrio.it":true,"so.it":true,"taranto.it":true,"ta.it":true,"tempio-olbia.it":true,"tempioolbia.it":true,"olbia-tempio.it":true,"olbiatempio.it":true,"ot.it":true,"teramo.it":true,"te.it":true,"terni.it":true,"tr.it":true,"torino.it":true,"turin.it":true,"to.it":true,"trapani.it":true,"tp.it":true,"trento.it":true,"trentino.it":true,"tn.it":true,"treviso.it":true,"tv.it":true,"trieste.it":true,"ts.it":true,"udine.it":true,"ud.it":true,"varese.it":true,"va.it":true,"venezia.it":true,"venice.it":true,"ve.it":true,"verbania.it":true,"vb.it":true,"vercelli.it":true,"vc.it":true,"verona.it":true,"vr.it":true,"vibo-valentia.it":true,"vibovalentia.it":true,"vv.it":true,"vicenza.it":true,"vi.it":true,"viterbo.it":true,"vt.it":true,"je":true,"co.je":true,"org.je":true,"net.je":true,"sch.je":true,"gov.je":true,"*.jm":true,"jo":true,"com.jo":true,"org.jo":true,"net.jo":true,"edu.jo":true,"sch.jo":true,"gov.jo":true,"mil.jo":true,"name.jo":true,"jobs":true,"jp":true,"ac.jp":true,"ad.jp":true,"co.jp":true,"ed.jp":true,"go.jp":true,"gr.jp":true,"lg.jp":true,"ne.jp":true,"or.jp":true,"*.aichi.jp":true,"*.akita.jp":true,"*.aomori.jp":true,"*.chiba.jp":true,"*.ehime.jp":true,"*.fukui.jp":true,"*.fukuoka.jp":true,"*.fukushima.jp":true,"*.gifu.jp":true,"*.gunma.jp":true,"*.hiroshima.jp":true,"*.hokkaido.jp":true,"*.hyogo.jp":true,"*.ibaraki.jp":true,"*.ishikawa.jp":true,"*.iwate.jp":true,"*.kagawa.jp":true,"*.kagoshima.jp":true,"*.kanagawa.jp":true,"*.kawasaki.jp":true,"*.kitakyushu.jp":true,"*.kobe.jp":true,"*.kochi.jp":true,"*.kumamoto.jp":true,"*.kyoto.jp":true,"*.mie.jp":true,"*.miyagi.jp":true,"*.miyazaki.jp":true,"*.nagano.jp":true,"*.nagasaki.jp":true,"*.nagoya.jp":true,"*.nara.jp":true,"*.niigata.jp":true,"*.oita.jp":true,"*.okayama.jp":true,"*.okinawa.jp":true,"*.osaka.jp":true,"*.saga.jp":true,"*.saitama.jp":true,"*.sapporo.jp":true,"*.sendai.jp":true,"*.shiga.jp":true,"*.shimane.jp":true,"*.shizuoka.jp":true,"*.tochigi.jp":true,"*.tokushima.jp":true,"*.tokyo.jp":true,"*.tottori.jp":true,"*.toyama.jp":true,"*.wakayama.jp":true,"*.yamagata.jp":true,"*.yamaguchi.jp":true,"*.yamanashi.jp":true,"*.yokohama.jp":true,"metro.tokyo.jp":false,"pref.aichi.jp":false,"pref.akita.jp":false,"pref.aomori.jp":false,"pref.chiba.jp":false,"pref.ehime.jp":false,"pref.fukui.jp":false,"pref.fukuoka.jp":false,"pref.fukushima.jp":false,"pref.gifu.jp":false,"pref.gunma.jp":false,"pref.hiroshima.jp":false,"pref.hokkaido.jp":false,"pref.hyogo.jp":false,"pref.ibaraki.jp":false,"pref.ishikawa.jp":false,"pref.iwate.jp":false,"pref.kagawa.jp":false,"pref.kagoshima.jp":false,"pref.kanagawa.jp":false,"pref.kochi.jp":false,"pref.kumamoto.jp":false,"pref.kyoto.jp":false,"pref.mie.jp":false,"pref.miyagi.jp":false,"pref.miyazaki.jp":false,"pref.nagano.jp":false,"pref.nagasaki.jp":false,"pref.nara.jp":false,"pref.niigata.jp":false,"pref.oita.jp":false,"pref.okayama.jp":false,"pref.okinawa.jp":false,"pref.osaka.jp":false,"pref.saga.jp":false,"pref.saitama.jp":false,"pref.shiga.jp":false,"pref.shimane.jp":false,"pref.shizuoka.jp":false,"pref.tochigi.jp":false,"pref.tokushima.jp":false,"pref.tottori.jp":false,"pref.toyama.jp":false,"pref.wakayama.jp":false,"pref.yamagata.jp":false,"pref.yamaguchi.jp":false,"pref.yamanashi.jp":false,"city.chiba.jp":false,"city.fukuoka.jp":false,"city.hiroshima.jp":false,"city.kawasaki.jp":false,"city.kitakyushu.jp":false,"city.kobe.jp":false,"city.kyoto.jp":false,"city.nagoya.jp":false,"city.niigata.jp":false,"city.okayama.jp":false,"city.osaka.jp":false,"city.saitama.jp":false,"city.sapporo.jp":false,"city.sendai.jp":false,"city.shizuoka.jp":false,"city.yokohama.jp":false,"*.ke":true,"kg":true,"org.kg":true,"net.kg":true,"com.kg":true,"edu.kg":true,"gov.kg":true,"mil.kg":true,"*.kh":true,"ki":true,"edu.ki":true,"biz.ki":true,"net.ki":true,"org.ki":true,"gov.ki":true,"info.ki":true,"com.ki":true,"km":true,"org.km":true,"nom.km":true,"gov.km":true,"prd.km":true,"tm.km":true,"edu.km":true,"mil.km":true,"ass.km":true,"com.km":true,"coop.km":true,"asso.km":true,"presse.km":true,"medecin.km":true,"notaires.km":true,"pharmaciens.km":true,"veterinaire.km":true,"gouv.km":true,"kn":true,"net.kn":true,"org.kn":true,"edu.kn":true,"gov.kn":true,"com.kp":true,"edu.kp":true,"gov.kp":true,"org.kp":true,"rep.kp":true,"tra.kp":true,"kr":true,"ac.kr":true,"co.kr":true,"es.kr":true,"go.kr":true,"hs.kr":true,"kg.kr":true,"mil.kr":true,"ms.kr":true,"ne.kr":true,"or.kr":true,"pe.kr":true,"re.kr":true,"sc.kr":true,"busan.kr":true,"chungbuk.kr":true,"chungnam.kr":true,"daegu.kr":true,"daejeon.kr":true,"gangwon.kr":true,"gwangju.kr":true,"gyeongbuk.kr":true,"gyeonggi.kr":true,"gyeongnam.kr":true,"incheon.kr":true,"jeju.kr":true,"jeonbuk.kr":true,"jeonnam.kr":true,"seoul.kr":true,"ulsan.kr":true,"*.kw":true,"ky":true,"edu.ky":true,"gov.ky":true,"com.ky":true,"org.ky":true,"net.ky":true,"kz":true,"org.kz":true,"edu.kz":true,"net.kz":true,"gov.kz":true,"mil.kz":true,"com.kz":true,"la":true,"int.la":true,"net.la":true,"info.la":true,"edu.la":true,"gov.la":true,"per.la":true,"com.la":true,"org.la":true,"com.lb":true,"edu.lb":true,"gov.lb":true,"net.lb":true,"org.lb":true,"lc":true,"com.lc":true,"net.lc":true,"co.lc":true,"org.lc":true,"edu.lc":true,"gov.lc":true,"li":true,"lk":true,"gov.lk":true,"sch.lk":true,"net.lk":true,"int.lk":true,"com.lk":true,"org.lk":true,"edu.lk":true,"ngo.lk":true,"soc.lk":true,"web.lk":true,"ltd.lk":true,"assn.lk":true,"grp.lk":true,"hotel.lk":true,"com.lr":true,"edu.lr":true,"gov.lr":true,"org.lr":true,"net.lr":true,"ls":true,"co.ls":true,"org.ls":true,"lt":true,"gov.lt":true,"lu":true,"lv":true,"com.lv":true,"edu.lv":true,"gov.lv":true,"org.lv":true,"mil.lv":true,"id.lv":true,"net.lv":true,"asn.lv":true,"conf.lv":true,"ly":true,"com.ly":true,"net.ly":true,"gov.ly":true,"plc.ly":true,"edu.ly":true,"sch.ly":true,"med.ly":true,"org.ly":true,"id.ly":true,"ma":true,"co.ma":true,"net.ma":true,"gov.ma":true,"org.ma":true,"ac.ma":true,"press.ma":true,"mc":true,"tm.mc":true,"asso.mc":true,"md":true,"me":true,"co.me":true,"net.me":true,"org.me":true,"edu.me":true,"ac.me":true,"gov.me":true,"its.me":true,"priv.me":true,"mg":true,"org.mg":true,"nom.mg":true,"gov.mg":true,"prd.mg":true,"tm.mg":true,"edu.mg":true,"mil.mg":true,"com.mg":true,"mh":true,"mil":true,"mk":true,"com.mk":true,"org.mk":true,"net.mk":true,"edu.mk":true,"gov.mk":true,"inf.mk":true,"name.mk":true,"ml":true,"com.ml":true,"edu.ml":true,"gouv.ml":true,"gov.ml":true,"net.ml":true,"org.ml":true,"presse.ml":true,"*.mm":true,"mn":true,"gov.mn":true,"edu.mn":true,"org.mn":true,"mo":true,"com.mo":true,"net.mo":true,"org.mo":true,"edu.mo":true,"gov.mo":true,"mobi":true,"mp":true,"mq":true,"mr":true,"gov.mr":true,"ms":true,"*.mt":true,"mu":true,"com.mu":true,"net.mu":true,"org.mu":true,"gov.mu":true,"ac.mu":true,"co.mu":true,"or.mu":true,"museum":true,"academy.museum":true,"agriculture.museum":true,"air.museum":true,"airguard.museum":true,"alabama.museum":true,"alaska.museum":true,"amber.museum":true,"ambulance.museum":true,"american.museum":true,"americana.museum":true,"americanantiques.museum":true,"americanart.museum":true,"amsterdam.museum":true,"and.museum":true,"annefrank.museum":true,"anthro.museum":true,"anthropology.museum":true,"antiques.museum":true,"aquarium.museum":true,"arboretum.museum":true,"archaeological.museum":true,"archaeology.museum":true,"architecture.museum":true,"art.museum":true,"artanddesign.museum":true,"artcenter.museum":true,"artdeco.museum":true,"arteducation.museum":true,"artgallery.museum":true,"arts.museum":true,"artsandcrafts.museum":true,"asmatart.museum":true,"assassination.museum":true,"assisi.museum":true,"association.museum":true,"astronomy.museum":true,"atlanta.museum":true,"austin.museum":true,"australia.museum":true,"automotive.museum":true,"aviation.museum":true,"axis.museum":true,"badajoz.museum":true,"baghdad.museum":true,"bahn.museum":true,"bale.museum":true,"baltimore.museum":true,"barcelona.museum":true,"baseball.museum":true,"basel.museum":true,"baths.museum":true,"bauern.museum":true,"beauxarts.museum":true,"beeldengeluid.museum":true,"bellevue.museum":true,"bergbau.museum":true,"berkeley.museum":true,"berlin.museum":true,"bern.museum":true,"bible.museum":true,"bilbao.museum":true,"bill.museum":true,"birdart.museum":true,"birthplace.museum":true,"bonn.museum":true,"boston.museum":true,"botanical.museum":true,"botanicalgarden.museum":true,"botanicgarden.museum":true,"botany.museum":true,"brandywinevalley.museum":true,"brasil.museum":true,"bristol.museum":true,"british.museum":true,"britishcolumbia.museum":true,"broadcast.museum":true,"brunel.museum":true,"brussel.museum":true,"brussels.museum":true,"bruxelles.museum":true,"building.museum":true,"burghof.museum":true,"bus.museum":true,"bushey.museum":true,"cadaques.museum":true,"california.museum":true,"cambridge.museum":true,"can.museum":true,"canada.museum":true,"capebreton.museum":true,"carrier.museum":true,"cartoonart.museum":true,"casadelamoneda.museum":true,"castle.museum":true,"castres.museum":true,"celtic.museum":true,"center.museum":true,"chattanooga.museum":true,"cheltenham.museum":true,"chesapeakebay.museum":true,"chicago.museum":true,"children.museum":true,"childrens.museum":true,"childrensgarden.museum":true,"chiropractic.museum":true,"chocolate.museum":true,"christiansburg.museum":true,"cincinnati.museum":true,"cinema.museum":true,"circus.museum":true,"civilisation.museum":true,"civilization.museum":true,"civilwar.museum":true,"clinton.museum":true,"clock.museum":true,"coal.museum":true,"coastaldefence.museum":true,"cody.museum":true,"coldwar.museum":true,"collection.museum":true,"colonialwilliamsburg.museum":true,"coloradoplateau.museum":true,"columbia.museum":true,"columbus.museum":true,"communication.museum":true,"communications.museum":true,"community.museum":true,"computer.museum":true,"computerhistory.museum":true,"xn--comunicaes-v6a2o.museum":true,"contemporary.museum":true,"contemporaryart.museum":true,"convent.museum":true,"copenhagen.museum":true,"corporation.museum":true,"xn--correios-e-telecomunicaes-ghc29a.museum":true,"corvette.museum":true,"costume.museum":true,"countryestate.museum":true,"county.museum":true,"crafts.museum":true,"cranbrook.museum":true,"creation.museum":true,"cultural.museum":true,"culturalcenter.museum":true,"culture.museum":true,"cyber.museum":true,"cymru.museum":true,"dali.museum":true,"dallas.museum":true,"database.museum":true,"ddr.museum":true,"decorativearts.museum":true,"delaware.museum":true,"delmenhorst.museum":true,"denmark.museum":true,"depot.museum":true,"design.museum":true,"detroit.museum":true,"dinosaur.museum":true,"discovery.museum":true,"dolls.museum":true,"donostia.museum":true,"durham.museum":true,"eastafrica.museum":true,"eastcoast.museum":true,"education.museum":true,"educational.museum":true,"egyptian.museum":true,"eisenbahn.museum":true,"elburg.museum":true,"elvendrell.museum":true,"embroidery.museum":true,"encyclopedic.museum":true,"england.museum":true,"entomology.museum":true,"environment.museum":true,"environmentalconservation.museum":true,"epilepsy.museum":true,"essex.museum":true,"estate.museum":true,"ethnology.museum":true,"exeter.museum":true,"exhibition.museum":true,"family.museum":true,"farm.museum":true,"farmequipment.museum":true,"farmers.museum":true,"farmstead.museum":true,"field.museum":true,"figueres.museum":true,"filatelia.museum":true,"film.museum":true,"fineart.museum":true,"finearts.museum":true,"finland.museum":true,"flanders.museum":true,"florida.museum":true,"force.museum":true,"fortmissoula.museum":true,"fortworth.museum":true,"foundation.museum":true,"francaise.museum":true,"frankfurt.museum":true,"franziskaner.museum":true,"freemasonry.museum":true,"freiburg.museum":true,"fribourg.museum":true,"frog.museum":true,"fundacio.museum":true,"furniture.museum":true,"gallery.museum":true,"garden.museum":true,"gateway.museum":true,"geelvinck.museum":true,"gemological.museum":true,"geology.museum":true,"georgia.museum":true,"giessen.museum":true,"glas.museum":true,"glass.museum":true,"gorge.museum":true,"grandrapids.museum":true,"graz.museum":true,"guernsey.museum":true,"halloffame.museum":true,"hamburg.museum":true,"handson.museum":true,"harvestcelebration.museum":true,"hawaii.museum":true,"health.museum":true,"heimatunduhren.museum":true,"hellas.museum":true,"helsinki.museum":true,"hembygdsforbund.museum":true,"heritage.museum":true,"histoire.museum":true,"historical.museum":true,"historicalsociety.museum":true,"historichouses.museum":true,"historisch.museum":true,"historisches.museum":true,"history.museum":true,"historyofscience.museum":true,"horology.museum":true,"house.museum":true,"humanities.museum":true,"illustration.museum":true,"imageandsound.museum":true,"indian.museum":true,"indiana.museum":true,"indianapolis.museum":true,"indianmarket.museum":true,"intelligence.museum":true,"interactive.museum":true,"iraq.museum":true,"iron.museum":true,"isleofman.museum":true,"jamison.museum":true,"jefferson.museum":true,"jerusalem.museum":true,"jewelry.museum":true,"jewish.museum":true,"jewishart.museum":true,"jfk.museum":true,"journalism.museum":true,"judaica.museum":true,"judygarland.museum":true,"juedisches.museum":true,"juif.museum":true,"karate.museum":true,"karikatur.museum":true,"kids.museum":true,"koebenhavn.museum":true,"koeln.museum":true,"kunst.museum":true,"kunstsammlung.museum":true,"kunstunddesign.museum":true,"labor.museum":true,"labour.museum":true,"lajolla.museum":true,"lancashire.museum":true,"landes.museum":true,"lans.museum":true,"xn--lns-qla.museum":true,"larsson.museum":true,"lewismiller.museum":true,"lincoln.museum":true,"linz.museum":true,"living.museum":true,"livinghistory.museum":true,"localhistory.museum":true,"london.museum":true,"losangeles.museum":true,"louvre.museum":true,"loyalist.museum":true,"lucerne.museum":true,"luxembourg.museum":true,"luzern.museum":true,"mad.museum":true,"madrid.museum":true,"mallorca.museum":true,"manchester.museum":true,"mansion.museum":true,"mansions.museum":true,"manx.museum":true,"marburg.museum":true,"maritime.museum":true,"maritimo.museum":true,"maryland.museum":true,"marylhurst.museum":true,"media.museum":true,"medical.museum":true,"medizinhistorisches.museum":true,"meeres.museum":true,"memorial.museum":true,"mesaverde.museum":true,"michigan.museum":true,"midatlantic.museum":true,"military.museum":true,"mill.museum":true,"miners.museum":true,"mining.museum":true,"minnesota.museum":true,"missile.museum":true,"missoula.museum":true,"modern.museum":true,"moma.museum":true,"money.museum":true,"monmouth.museum":true,"monticello.museum":true,"montreal.museum":true,"moscow.museum":true,"motorcycle.museum":true,"muenchen.museum":true,"muenster.museum":true,"mulhouse.museum":true,"muncie.museum":true,"museet.museum":true,"museumcenter.museum":true,"museumvereniging.museum":true,"music.museum":true,"national.museum":true,"nationalfirearms.museum":true,"nationalheritage.museum":true,"nativeamerican.museum":true,"naturalhistory.museum":true,"naturalhistorymuseum.museum":true,"naturalsciences.museum":true,"nature.museum":true,"naturhistorisches.museum":true,"natuurwetenschappen.museum":true,"naumburg.museum":true,"naval.museum":true,"nebraska.museum":true,"neues.museum":true,"newhampshire.museum":true,"newjersey.museum":true,"newmexico.museum":true,"newport.museum":true,"newspaper.museum":true,"newyork.museum":true,"niepce.museum":true,"norfolk.museum":true,"north.museum":true,"nrw.museum":true,"nuernberg.museum":true,"nuremberg.museum":true,"nyc.museum":true,"nyny.museum":true,"oceanographic.museum":true,"oceanographique.museum":true,"omaha.museum":true,"online.museum":true,"ontario.museum":true,"openair.museum":true,"oregon.museum":true,"oregontrail.museum":true,"otago.museum":true,"oxford.museum":true,"pacific.museum":true,"paderborn.museum":true,"palace.museum":true,"paleo.museum":true,"palmsprings.museum":true,"panama.museum":true,"paris.museum":true,"pasadena.museum":true,"pharmacy.museum":true,"philadelphia.museum":true,"philadelphiaarea.museum":true,"philately.museum":true,"phoenix.museum":true,"photography.museum":true,"pilots.museum":true,"pittsburgh.museum":true,"planetarium.museum":true,"plantation.museum":true,"plants.museum":true,"plaza.museum":true,"portal.museum":true,"portland.museum":true,"portlligat.museum":true,"posts-and-telecommunications.museum":true,"preservation.museum":true,"presidio.museum":true,"press.museum":true,"project.museum":true,"public.museum":true,"pubol.museum":true,"quebec.museum":true,"railroad.museum":true,"railway.museum":true,"research.museum":true,"resistance.museum":true,"riodejaneiro.museum":true,"rochester.museum":true,"rockart.museum":true,"roma.museum":true,"russia.museum":true,"saintlouis.museum":true,"salem.museum":true,"salvadordali.museum":true,"salzburg.museum":true,"sandiego.museum":true,"sanfrancisco.museum":true,"santabarbara.museum":true,"santacruz.museum":true,"santafe.museum":true,"saskatchewan.museum":true,"satx.museum":true,"savannahga.museum":true,"schlesisches.museum":true,"schoenbrunn.museum":true,"schokoladen.museum":true,"school.museum":true,"schweiz.museum":true,"science.museum":true,"scienceandhistory.museum":true,"scienceandindustry.museum":true,"sciencecenter.museum":true,"sciencecenters.museum":true,"science-fiction.museum":true,"sciencehistory.museum":true,"sciences.museum":true,"sciencesnaturelles.museum":true,"scotland.museum":true,"seaport.museum":true,"settlement.museum":true,"settlers.museum":true,"shell.museum":true,"sherbrooke.museum":true,"sibenik.museum":true,"silk.museum":true,"ski.museum":true,"skole.museum":true,"society.museum":true,"sologne.museum":true,"soundandvision.museum":true,"southcarolina.museum":true,"southwest.museum":true,"space.museum":true,"spy.museum":true,"square.museum":true,"stadt.museum":true,"stalbans.museum":true,"starnberg.museum":true,"state.museum":true,"stateofdelaware.museum":true,"station.museum":true,"steam.museum":true,"steiermark.museum":true,"stjohn.museum":true,"stockholm.museum":true,"stpetersburg.museum":true,"stuttgart.museum":true,"suisse.museum":true,"surgeonshall.museum":true,"surrey.museum":true,"svizzera.museum":true,"sweden.museum":true,"sydney.museum":true,"tank.museum":true,"tcm.museum":true,"technology.museum":true,"telekommunikation.museum":true,"television.museum":true,"texas.museum":true,"textile.museum":true,"theater.museum":true,"time.museum":true,"timekeeping.museum":true,"topology.museum":true,"torino.museum":true,"touch.museum":true,"town.museum":true,"transport.museum":true,"tree.museum":true,"trolley.museum":true,"trust.museum":true,"trustee.museum":true,"uhren.museum":true,"ulm.museum":true,"undersea.museum":true,"university.museum":true,"usa.museum":true,"usantiques.museum":true,"usarts.museum":true,"uscountryestate.museum":true,"usculture.museum":true,"usdecorativearts.museum":true,"usgarden.museum":true,"ushistory.museum":true,"ushuaia.museum":true,"uslivinghistory.museum":true,"utah.museum":true,"uvic.museum":true,"valley.museum":true,"vantaa.museum":true,"versailles.museum":true,"viking.museum":true,"village.museum":true,"virginia.museum":true,"virtual.museum":true,"virtuel.museum":true,"vlaanderen.museum":true,"volkenkunde.museum":true,"wales.museum":true,"wallonie.museum":true,"war.museum":true,"washingtondc.museum":true,"watchandclock.museum":true,"watch-and-clock.museum":true,"western.museum":true,"westfalen.museum":true,"whaling.museum":true,"wildlife.museum":true,"williamsburg.museum":true,"windmill.museum":true,"workshop.museum":true,"york.museum":true,"yorkshire.museum":true,"yosemite.museum":true,"youth.museum":true,"zoological.museum":true,"zoology.museum":true,"xn--9dbhblg6di.museum":true,"xn--h1aegh.museum":true,"mv":true,"aero.mv":true,"biz.mv":true,"com.mv":true,"coop.mv":true,"edu.mv":true,"gov.mv":true,"info.mv":true,"int.mv":true,"mil.mv":true,"museum.mv":true,"name.mv":true,"net.mv":true,"org.mv":true,"pro.mv":true,"mw":true,"ac.mw":true,"biz.mw":true,"co.mw":true,"com.mw":true,"coop.mw":true,"edu.mw":true,"gov.mw":true,"int.mw":true,"museum.mw":true,"net.mw":true,"org.mw":true,"mx":true,"com.mx":true,"org.mx":true,"gob.mx":true,"edu.mx":true,"net.mx":true,"my":true,"com.my":true,"net.my":true,"org.my":true,"gov.my":true,"edu.my":true,"mil.my":true,"name.my":true,"*.mz":true,"na":true,"info.na":true,"pro.na":true,"name.na":true,"school.na":true,"or.na":true,"dr.na":true,"us.na":true,"mx.na":true,"ca.na":true,"in.na":true,"cc.na":true,"tv.na":true,"ws.na":true,"mobi.na":true,"co.na":true,"com.na":true,"org.na":true,"name":true,"nc":true,"asso.nc":true,"ne":true,"net":true,"nf":true,"com.nf":true,"net.nf":true,"per.nf":true,"rec.nf":true,"web.nf":true,"arts.nf":true,"firm.nf":true,"info.nf":true,"other.nf":true,"store.nf":true,"ac.ng":true,"com.ng":true,"edu.ng":true,"gov.ng":true,"net.ng":true,"org.ng":true,"*.ni":true,"nl":true,"bv.nl":true,"no":true,"fhs.no":true,"vgs.no":true,"fylkesbibl.no":true,"folkebibl.no":true,"museum.no":true,"idrett.no":true,"priv.no":true,"mil.no":true,"stat.no":true,"dep.no":true,"kommune.no":true,"herad.no":true,"aa.no":true,"ah.no":true,"bu.no":true,"fm.no":true,"hl.no":true,"hm.no":true,"jan-mayen.no":true,"mr.no":true,"nl.no":true,"nt.no":true,"of.no":true,"ol.no":true,"oslo.no":true,"rl.no":true,"sf.no":true,"st.no":true,"svalbard.no":true,"tm.no":true,"tr.no":true,"va.no":true,"vf.no":true,"gs.aa.no":true,"gs.ah.no":true,"gs.bu.no":true,"gs.fm.no":true,"gs.hl.no":true,"gs.hm.no":true,"gs.jan-mayen.no":true,"gs.mr.no":true,"gs.nl.no":true,"gs.nt.no":true,"gs.of.no":true,"gs.ol.no":true,"gs.oslo.no":true,"gs.rl.no":true,"gs.sf.no":true,"gs.st.no":true,"gs.svalbard.no":true,"gs.tm.no":true,"gs.tr.no":true,"gs.va.no":true,"gs.vf.no":true,"akrehamn.no":true,"xn--krehamn-dxa.no":true,"algard.no":true,"xn--lgrd-poac.no":true,"arna.no":true,"brumunddal.no":true,"bryne.no":true,"bronnoysund.no":true,"xn--brnnysund-m8ac.no":true,"drobak.no":true,"xn--drbak-wua.no":true,"egersund.no":true,"fetsund.no":true,"floro.no":true,"xn--flor-jra.no":true,"fredrikstad.no":true,"hokksund.no":true,"honefoss.no":true,"xn--hnefoss-q1a.no":true,"jessheim.no":true,"jorpeland.no":true,"xn--jrpeland-54a.no":true,"kirkenes.no":true,"kopervik.no":true,"krokstadelva.no":true,"langevag.no":true,"xn--langevg-jxa.no":true,"leirvik.no":true,"mjondalen.no":true,"xn--mjndalen-64a.no":true,"mo-i-rana.no":true,"mosjoen.no":true,"xn--mosjen-eya.no":true,"nesoddtangen.no":true,"orkanger.no":true,"osoyro.no":true,"xn--osyro-wua.no":true,"raholt.no":true,"xn--rholt-mra.no":true,"sandnessjoen.no":true,"xn--sandnessjen-ogb.no":true,"skedsmokorset.no":true,"slattum.no":true,"spjelkavik.no":true,"stathelle.no":true,"stavern.no":true,"stjordalshalsen.no":true,"xn--stjrdalshalsen-sqb.no":true,"tananger.no":true,"tranby.no":true,"vossevangen.no":true,"afjord.no":true,"xn--fjord-lra.no":true,"agdenes.no":true,"al.no":true,"xn--l-1fa.no":true,"alesund.no":true,"xn--lesund-hua.no":true,"alstahaug.no":true,"alta.no":true,"xn--lt-liac.no":true,"alaheadju.no":true,"xn--laheadju-7ya.no":true,"alvdal.no":true,"amli.no":true,"xn--mli-tla.no":true,"amot.no":true,"xn--mot-tla.no":true,"andebu.no":true,"andoy.no":true,"xn--andy-ira.no":true,"andasuolo.no":true,"ardal.no":true,"xn--rdal-poa.no":true,"aremark.no":true,"arendal.no":true,"xn--s-1fa.no":true,"aseral.no":true,"xn--seral-lra.no":true,"asker.no":true,"askim.no":true,"askvoll.no":true,"askoy.no":true,"xn--asky-ira.no":true,"asnes.no":true,"xn--snes-poa.no":true,"audnedaln.no":true,"aukra.no":true,"aure.no":true,"aurland.no":true,"aurskog-holand.no":true,"xn--aurskog-hland-jnb.no":true,"austevoll.no":true,"austrheim.no":true,"averoy.no":true,"xn--avery-yua.no":true,"balestrand.no":true,"ballangen.no":true,"balat.no":true,"xn--blt-elab.no":true,"balsfjord.no":true,"bahccavuotna.no":true,"xn--bhccavuotna-k7a.no":true,"bamble.no":true,"bardu.no":true,"beardu.no":true,"beiarn.no":true,"bajddar.no":true,"xn--bjddar-pta.no":true,"baidar.no":true,"xn--bidr-5nac.no":true,"berg.no":true,"bergen.no":true,"berlevag.no":true,"xn--berlevg-jxa.no":true,"bearalvahki.no":true,"xn--bearalvhki-y4a.no":true,"bindal.no":true,"birkenes.no":true,"bjarkoy.no":true,"xn--bjarky-fya.no":true,"bjerkreim.no":true,"bjugn.no":true,"bodo.no":true,"xn--bod-2na.no":true,"badaddja.no":true,"xn--bdddj-mrabd.no":true,"budejju.no":true,"bokn.no":true,"bremanger.no":true,"bronnoy.no":true,"xn--brnny-wuac.no":true,"bygland.no":true,"bykle.no":true,"barum.no":true,"xn--brum-voa.no":true,"bo.telemark.no":true,"xn--b-5ga.telemark.no":true,"bo.nordland.no":true,"xn--b-5ga.nordland.no":true,"bievat.no":true,"xn--bievt-0qa.no":true,"bomlo.no":true,"xn--bmlo-gra.no":true,"batsfjord.no":true,"xn--btsfjord-9za.no":true,"bahcavuotna.no":true,"xn--bhcavuotna-s4a.no":true,"dovre.no":true,"drammen.no":true,"drangedal.no":true,"dyroy.no":true,"xn--dyry-ira.no":true,"donna.no":true,"xn--dnna-gra.no":true,"eid.no":true,"eidfjord.no":true,"eidsberg.no":true,"eidskog.no":true,"eidsvoll.no":true,"eigersund.no":true,"elverum.no":true,"enebakk.no":true,"engerdal.no":true,"etne.no":true,"etnedal.no":true,"evenes.no":true,"evenassi.no":true,"xn--eveni-0qa01ga.no":true,"evje-og-hornnes.no":true,"farsund.no":true,"fauske.no":true,"fuossko.no":true,"fuoisku.no":true,"fedje.no":true,"fet.no":true,"finnoy.no":true,"xn--finny-yua.no":true,"fitjar.no":true,"fjaler.no":true,"fjell.no":true,"flakstad.no":true,"flatanger.no":true,"flekkefjord.no":true,"flesberg.no":true,"flora.no":true,"fla.no":true,"xn--fl-zia.no":true,"folldal.no":true,"forsand.no":true,"fosnes.no":true,"frei.no":true,"frogn.no":true,"froland.no":true,"frosta.no":true,"frana.no":true,"xn--frna-woa.no":true,"froya.no":true,"xn--frya-hra.no":true,"fusa.no":true,"fyresdal.no":true,"forde.no":true,"xn--frde-gra.no":true,"gamvik.no":true,"gangaviika.no":true,"xn--ggaviika-8ya47h.no":true,"gaular.no":true,"gausdal.no":true,"gildeskal.no":true,"xn--gildeskl-g0a.no":true,"giske.no":true,"gjemnes.no":true,"gjerdrum.no":true,"gjerstad.no":true,"gjesdal.no":true,"gjovik.no":true,"xn--gjvik-wua.no":true,"gloppen.no":true,"gol.no":true,"gran.no":true,"grane.no":true,"granvin.no":true,"gratangen.no":true,"grimstad.no":true,"grong.no":true,"kraanghke.no":true,"xn--kranghke-b0a.no":true,"grue.no":true,"gulen.no":true,"hadsel.no":true,"halden.no":true,"halsa.no":true,"hamar.no":true,"hamaroy.no":true,"habmer.no":true,"xn--hbmer-xqa.no":true,"hapmir.no":true,"xn--hpmir-xqa.no":true,"hammerfest.no":true,"hammarfeasta.no":true,"xn--hmmrfeasta-s4ac.no":true,"haram.no":true,"hareid.no":true,"harstad.no":true,"hasvik.no":true,"aknoluokta.no":true,"xn--koluokta-7ya57h.no":true,"hattfjelldal.no":true,"aarborte.no":true,"haugesund.no":true,"hemne.no":true,"hemnes.no":true,"hemsedal.no":true,"heroy.more-og-romsdal.no":true,"xn--hery-ira.xn--mre-og-romsdal-qqb.no":true,"heroy.nordland.no":true,"xn--hery-ira.nordland.no":true,"hitra.no":true,"hjartdal.no":true,"hjelmeland.no":true,"hobol.no":true,"xn--hobl-ira.no":true,"hof.no":true,"hol.no":true,"hole.no":true,"holmestrand.no":true,"holtalen.no":true,"xn--holtlen-hxa.no":true,"hornindal.no":true,"horten.no":true,"hurdal.no":true,"hurum.no":true,"hvaler.no":true,"hyllestad.no":true,"hagebostad.no":true,"xn--hgebostad-g3a.no":true,"hoyanger.no":true,"xn--hyanger-q1a.no":true,"hoylandet.no":true,"xn--hylandet-54a.no":true,"ha.no":true,"xn--h-2fa.no":true,"ibestad.no":true,"inderoy.no":true,"xn--indery-fya.no":true,"iveland.no":true,"jevnaker.no":true,"jondal.no":true,"jolster.no":true,"xn--jlster-bya.no":true,"karasjok.no":true,"karasjohka.no":true,"xn--krjohka-hwab49j.no":true,"karlsoy.no":true,"galsa.no":true,"xn--gls-elac.no":true,"karmoy.no":true,"xn--karmy-yua.no":true,"kautokeino.no":true,"guovdageaidnu.no":true,"klepp.no":true,"klabu.no":true,"xn--klbu-woa.no":true,"kongsberg.no":true,"kongsvinger.no":true,"kragero.no":true,"xn--krager-gya.no":true,"kristiansand.no":true,"kristiansund.no":true,"krodsherad.no":true,"xn--krdsherad-m8a.no":true,"kvalsund.no":true,"rahkkeravju.no":true,"xn--rhkkervju-01af.no":true,"kvam.no":true,"kvinesdal.no":true,"kvinnherad.no":true,"kviteseid.no":true,"kvitsoy.no":true,"xn--kvitsy-fya.no":true,"kvafjord.no":true,"xn--kvfjord-nxa.no":true,"giehtavuoatna.no":true,"kvanangen.no":true,"xn--kvnangen-k0a.no":true,"navuotna.no":true,"xn--nvuotna-hwa.no":true,"kafjord.no":true,"xn--kfjord-iua.no":true,"gaivuotna.no":true,"xn--givuotna-8ya.no":true,"larvik.no":true,"lavangen.no":true,"lavagis.no":true,"loabat.no":true,"xn--loabt-0qa.no":true,"lebesby.no":true,"davvesiida.no":true,"leikanger.no":true,"leirfjord.no":true,"leka.no":true,"leksvik.no":true,"lenvik.no":true,"leangaviika.no":true,"xn--leagaviika-52b.no":true,"lesja.no":true,"levanger.no":true,"lier.no":true,"lierne.no":true,"lillehammer.no":true,"lillesand.no":true,"lindesnes.no":true,"lindas.no":true,"xn--linds-pra.no":true,"lom.no":true,"loppa.no":true,"lahppi.no":true,"xn--lhppi-xqa.no":true,"lund.no":true,"lunner.no":true,"luroy.no":true,"xn--lury-ira.no":true,"luster.no":true,"lyngdal.no":true,"lyngen.no":true,"ivgu.no":true,"lardal.no":true,"lerdal.no":true,"xn--lrdal-sra.no":true,"lodingen.no":true,"xn--ldingen-q1a.no":true,"lorenskog.no":true,"xn--lrenskog-54a.no":true,"loten.no":true,"xn--lten-gra.no":true,"malvik.no":true,"masoy.no":true,"xn--msy-ula0h.no":true,"muosat.no":true,"xn--muost-0qa.no":true,"mandal.no":true,"marker.no":true,"marnardal.no":true,"masfjorden.no":true,"meland.no":true,"meldal.no":true,"melhus.no":true,"meloy.no":true,"xn--mely-ira.no":true,"meraker.no":true,"xn--merker-kua.no":true,"moareke.no":true,"xn--moreke-jua.no":true,"midsund.no":true,"midtre-gauldal.no":true,"modalen.no":true,"modum.no":true,"molde.no":true,"moskenes.no":true,"moss.no":true,"mosvik.no":true,"malselv.no":true,"xn--mlselv-iua.no":true,"malatvuopmi.no":true,"xn--mlatvuopmi-s4a.no":true,"namdalseid.no":true,"aejrie.no":true,"namsos.no":true,"namsskogan.no":true,"naamesjevuemie.no":true,"xn--nmesjevuemie-tcba.no":true,"laakesvuemie.no":true,"nannestad.no":true,"narvik.no":true,"narviika.no":true,"naustdal.no":true,"nedre-eiker.no":true,"nes.akershus.no":true,"nes.buskerud.no":true,"nesna.no":true,"nesodden.no":true,"nesseby.no":true,"unjarga.no":true,"xn--unjrga-rta.no":true,"nesset.no":true,"nissedal.no":true,"nittedal.no":true,"nord-aurdal.no":true,"nord-fron.no":true,"nord-odal.no":true,"norddal.no":true,"nordkapp.no":true,"davvenjarga.no":true,"xn--davvenjrga-y4a.no":true,"nordre-land.no":true,"nordreisa.no":true,"raisa.no":true,"xn--risa-5na.no":true,"nore-og-uvdal.no":true,"notodden.no":true,"naroy.no":true,"xn--nry-yla5g.no":true,"notteroy.no":true,"xn--nttery-byae.no":true,"odda.no":true,"oksnes.no":true,"xn--ksnes-uua.no":true,"oppdal.no":true,"oppegard.no":true,"xn--oppegrd-ixa.no":true,"orkdal.no":true,"orland.no":true,"xn--rland-uua.no":true,"orskog.no":true,"xn--rskog-uua.no":true,"orsta.no":true,"xn--rsta-fra.no":true,"os.hedmark.no":true,"os.hordaland.no":true,"osen.no":true,"osteroy.no":true,"xn--ostery-fya.no":true,"ostre-toten.no":true,"xn--stre-toten-zcb.no":true,"overhalla.no":true,"ovre-eiker.no":true,"xn--vre-eiker-k8a.no":true,"oyer.no":true,"xn--yer-zna.no":true,"oygarden.no":true,"xn--ygarden-p1a.no":true,"oystre-slidre.no":true,"xn--ystre-slidre-ujb.no":true,"porsanger.no":true,"porsangu.no":true,"xn--porsgu-sta26f.no":true,"porsgrunn.no":true,"radoy.no":true,"xn--rady-ira.no":true,"rakkestad.no":true,"rana.no":true,"ruovat.no":true,"randaberg.no":true,"rauma.no":true,"rendalen.no":true,"rennebu.no":true,"rennesoy.no":true,"xn--rennesy-v1a.no":true,"rindal.no":true,"ringebu.no":true,"ringerike.no":true,"ringsaker.no":true,"rissa.no":true,"risor.no":true,"xn--risr-ira.no":true,"roan.no":true,"rollag.no":true,"rygge.no":true,"ralingen.no":true,"xn--rlingen-mxa.no":true,"rodoy.no":true,"xn--rdy-0nab.no":true,"romskog.no":true,"xn--rmskog-bya.no":true,"roros.no":true,"xn--rros-gra.no":true,"rost.no":true,"xn--rst-0na.no":true,"royken.no":true,"xn--ryken-vua.no":true,"royrvik.no":true,"xn--ryrvik-bya.no":true,"rade.no":true,"xn--rde-ula.no":true,"salangen.no":true,"siellak.no":true,"saltdal.no":true,"salat.no":true,"xn--slt-elab.no":true,"xn--slat-5na.no":true,"samnanger.no":true,"sande.more-og-romsdal.no":true,"sande.xn--mre-og-romsdal-qqb.no":true,"sande.vestfold.no":true,"sandefjord.no":true,"sandnes.no":true,"sandoy.no":true,"xn--sandy-yua.no":true,"sarpsborg.no":true,"sauda.no":true,"sauherad.no":true,"sel.no":true,"selbu.no":true,"selje.no":true,"seljord.no":true,"sigdal.no":true,"siljan.no":true,"sirdal.no":true,"skaun.no":true,"skedsmo.no":true,"ski.no":true,"skien.no":true,"skiptvet.no":true,"skjervoy.no":true,"xn--skjervy-v1a.no":true,"skierva.no":true,"xn--skierv-uta.no":true,"skjak.no":true,"xn--skjk-soa.no":true,"skodje.no":true,"skanland.no":true,"xn--sknland-fxa.no":true,"skanit.no":true,"xn--sknit-yqa.no":true,"smola.no":true,"xn--smla-hra.no":true,"snillfjord.no":true,"snasa.no":true,"xn--snsa-roa.no":true,"snoasa.no":true,"snaase.no":true,"xn--snase-nra.no":true,"sogndal.no":true,"sokndal.no":true,"sola.no":true,"solund.no":true,"songdalen.no":true,"sortland.no":true,"spydeberg.no":true,"stange.no":true,"stavanger.no":true,"steigen.no":true,"steinkjer.no":true,"stjordal.no":true,"xn--stjrdal-s1a.no":true,"stokke.no":true,"stor-elvdal.no":true,"stord.no":true,"stordal.no":true,"storfjord.no":true,"omasvuotna.no":true,"strand.no":true,"stranda.no":true,"stryn.no":true,"sula.no":true,"suldal.no":true,"sund.no":true,"sunndal.no":true,"surnadal.no":true,"sveio.no":true,"svelvik.no":true,"sykkylven.no":true,"sogne.no":true,"xn--sgne-gra.no":true,"somna.no":true,"xn--smna-gra.no":true,"sondre-land.no":true,"xn--sndre-land-0cb.no":true,"sor-aurdal.no":true,"xn--sr-aurdal-l8a.no":true,"sor-fron.no":true,"xn--sr-fron-q1a.no":true,"sor-odal.no":true,"xn--sr-odal-q1a.no":true,"sor-varanger.no":true,"xn--sr-varanger-ggb.no":true,"matta-varjjat.no":true,"xn--mtta-vrjjat-k7af.no":true,"sorfold.no":true,"xn--srfold-bya.no":true,"sorreisa.no":true,"xn--srreisa-q1a.no":true,"sorum.no":true,"xn--srum-gra.no":true,"tana.no":true,"deatnu.no":true,"time.no":true,"tingvoll.no":true,"tinn.no":true,"tjeldsund.no":true,"dielddanuorri.no":true,"tjome.no":true,"xn--tjme-hra.no":true,"tokke.no":true,"tolga.no":true,"torsken.no":true,"tranoy.no":true,"xn--trany-yua.no":true,"tromso.no":true,"xn--troms-zua.no":true,"tromsa.no":true,"romsa.no":true,"trondheim.no":true,"troandin.no":true,"trysil.no":true,"trana.no":true,"xn--trna-woa.no":true,"trogstad.no":true,"xn--trgstad-r1a.no":true,"tvedestrand.no":true,"tydal.no":true,"tynset.no":true,"tysfjord.no":true,"divtasvuodna.no":true,"divttasvuotna.no":true,"tysnes.no":true,"tysvar.no":true,"xn--tysvr-vra.no":true,"tonsberg.no":true,"xn--tnsberg-q1a.no":true,"ullensaker.no":true,"ullensvang.no":true,"ulvik.no":true,"utsira.no":true,"vadso.no":true,"xn--vads-jra.no":true,"cahcesuolo.no":true,"xn--hcesuolo-7ya35b.no":true,"vaksdal.no":true,"valle.no":true,"vang.no":true,"vanylven.no":true,"vardo.no":true,"xn--vard-jra.no":true,"varggat.no":true,"xn--vrggt-xqad.no":true,"vefsn.no":true,"vaapste.no":true,"vega.no":true,"vegarshei.no":true,"xn--vegrshei-c0a.no":true,"vennesla.no":true,"verdal.no":true,"verran.no":true,"vestby.no":true,"vestnes.no":true,"vestre-slidre.no":true,"vestre-toten.no":true,"vestvagoy.no":true,"xn--vestvgy-ixa6o.no":true,"vevelstad.no":true,"vik.no":true,"vikna.no":true,"vindafjord.no":true,"volda.no":true,"voss.no":true,"varoy.no":true,"xn--vry-yla5g.no":true,"vagan.no":true,"xn--vgan-qoa.no":true,"voagat.no":true,"vagsoy.no":true,"xn--vgsy-qoa0j.no":true,"vaga.no":true,"xn--vg-yiab.no":true,"valer.ostfold.no":true,"xn--vler-qoa.xn--stfold-9xa.no":true,"valer.hedmark.no":true,"xn--vler-qoa.hedmark.no":true,"*.np":true,"nr":true,"biz.nr":true,"info.nr":true,"gov.nr":true,"edu.nr":true,"org.nr":true,"net.nr":true,"com.nr":true,"nu":true,"*.nz":true,"*.om":true,"mediaphone.om":false,"nawrastelecom.om":false,"nawras.om":false,"omanmobile.om":false,"omanpost.om":false,"omantel.om":false,"rakpetroleum.om":false,"siemens.om":false,"songfest.om":false,"statecouncil.om":false,"org":true,"pa":true,"ac.pa":true,"gob.pa":true,"com.pa":true,"org.pa":true,"sld.pa":true,"edu.pa":true,"net.pa":true,"ing.pa":true,"abo.pa":true,"med.pa":true,"nom.pa":true,"pe":true,"edu.pe":true,"gob.pe":true,"nom.pe":true,"mil.pe":true,"org.pe":true,"com.pe":true,"net.pe":true,"pf":true,"com.pf":true,"org.pf":true,"edu.pf":true,"*.pg":true,"ph":true,"com.ph":true,"net.ph":true,"org.ph":true,"gov.ph":true,"edu.ph":true,"ngo.ph":true,"mil.ph":true,"i.ph":true,"pk":true,"com.pk":true,"net.pk":true,"edu.pk":true,"org.pk":true,"fam.pk":true,"biz.pk":true,"web.pk":true,"gov.pk":true,"gob.pk":true,"gok.pk":true,"gon.pk":true,"gop.pk":true,"gos.pk":true,"info.pk":true,"pl":true,"aid.pl":true,"agro.pl":true,"atm.pl":true,"auto.pl":true,"biz.pl":true,"com.pl":true,"edu.pl":true,"gmina.pl":true,"gsm.pl":true,"info.pl":true,"mail.pl":true,"miasta.pl":true,"media.pl":true,"mil.pl":true,"net.pl":true,"nieruchomosci.pl":true,"nom.pl":true,"org.pl":true,"pc.pl":true,"powiat.pl":true,"priv.pl":true,"realestate.pl":true,"rel.pl":true,"sex.pl":true,"shop.pl":true,"sklep.pl":true,"sos.pl":true,"szkola.pl":true,"targi.pl":true,"tm.pl":true,"tourism.pl":true,"travel.pl":true,"turystyka.pl":true,"6bone.pl":true,"art.pl":true,"mbone.pl":true,"gov.pl":true,"uw.gov.pl":true,"um.gov.pl":true,"ug.gov.pl":true,"upow.gov.pl":true,"starostwo.gov.pl":true,"so.gov.pl":true,"sr.gov.pl":true,"po.gov.pl":true,"pa.gov.pl":true,"ngo.pl":true,"irc.pl":true,"usenet.pl":true,"augustow.pl":true,"babia-gora.pl":true,"bedzin.pl":true,"beskidy.pl":true,"bialowieza.pl":true,"bialystok.pl":true,"bielawa.pl":true,"bieszczady.pl":true,"boleslawiec.pl":true,"bydgoszcz.pl":true,"bytom.pl":true,"cieszyn.pl":true,"czeladz.pl":true,"czest.pl":true,"dlugoleka.pl":true,"elblag.pl":true,"elk.pl":true,"glogow.pl":true,"gniezno.pl":true,"gorlice.pl":true,"grajewo.pl":true,"ilawa.pl":true,"jaworzno.pl":true,"jelenia-gora.pl":true,"jgora.pl":true,"kalisz.pl":true,"kazimierz-dolny.pl":true,"karpacz.pl":true,"kartuzy.pl":true,"kaszuby.pl":true,"katowice.pl":true,"kepno.pl":true,"ketrzyn.pl":true,"klodzko.pl":true,"kobierzyce.pl":true,"kolobrzeg.pl":true,"konin.pl":true,"konskowola.pl":true,"kutno.pl":true,"lapy.pl":true,"lebork.pl":true,"legnica.pl":true,"lezajsk.pl":true,"limanowa.pl":true,"lomza.pl":true,"lowicz.pl":true,"lubin.pl":true,"lukow.pl":true,"malbork.pl":true,"malopolska.pl":true,"mazowsze.pl":true,"mazury.pl":true,"mielec.pl":true,"mielno.pl":true,"mragowo.pl":true,"naklo.pl":true,"nowaruda.pl":true,"nysa.pl":true,"olawa.pl":true,"olecko.pl":true,"olkusz.pl":true,"olsztyn.pl":true,"opoczno.pl":true,"opole.pl":true,"ostroda.pl":true,"ostroleka.pl":true,"ostrowiec.pl":true,"ostrowwlkp.pl":true,"pila.pl":true,"pisz.pl":true,"podhale.pl":true,"podlasie.pl":true,"polkowice.pl":true,"pomorze.pl":true,"pomorskie.pl":true,"prochowice.pl":true,"pruszkow.pl":true,"przeworsk.pl":true,"pulawy.pl":true,"radom.pl":true,"rawa-maz.pl":true,"rybnik.pl":true,"rzeszow.pl":true,"sanok.pl":true,"sejny.pl":true,"siedlce.pl":true,"slask.pl":true,"slupsk.pl":true,"sosnowiec.pl":true,"stalowa-wola.pl":true,"skoczow.pl":true,"starachowice.pl":true,"stargard.pl":true,"suwalki.pl":true,"swidnica.pl":true,"swiebodzin.pl":true,"swinoujscie.pl":true,"szczecin.pl":true,"szczytno.pl":true,"tarnobrzeg.pl":true,"tgory.pl":true,"turek.pl":true,"tychy.pl":true,"ustka.pl":true,"walbrzych.pl":true,"warmia.pl":true,"warszawa.pl":true,"waw.pl":true,"wegrow.pl":true,"wielun.pl":true,"wlocl.pl":true,"wloclawek.pl":true,"wodzislaw.pl":true,"wolomin.pl":true,"wroclaw.pl":true,"zachpomor.pl":true,"zagan.pl":true,"zarow.pl":true,"zgora.pl":true,"zgorzelec.pl":true,"gda.pl":true,"gdansk.pl":true,"gdynia.pl":true,"med.pl":true,"sopot.pl":true,"gliwice.pl":true,"krakow.pl":true,"poznan.pl":true,"wroc.pl":true,"zakopane.pl":true,"pm":true,"pn":true,"gov.pn":true,"co.pn":true,"org.pn":true,"edu.pn":true,"net.pn":true,"pr":true,"com.pr":true,"net.pr":true,"org.pr":true,"gov.pr":true,"edu.pr":true,"isla.pr":true,"pro.pr":true,"biz.pr":true,"info.pr":true,"name.pr":true,"est.pr":true,"prof.pr":true,"ac.pr":true,"pro":true,"aca.pro":true,"bar.pro":true,"cpa.pro":true,"jur.pro":true,"law.pro":true,"med.pro":true,"eng.pro":true,"ps":true,"edu.ps":true,"gov.ps":true,"sec.ps":true,"plo.ps":true,"com.ps":true,"org.ps":true,"net.ps":true,"pt":true,"net.pt":true,"gov.pt":true,"org.pt":true,"edu.pt":true,"int.pt":true,"publ.pt":true,"com.pt":true,"nome.pt":true,"pw":true,"co.pw":true,"ne.pw":true,"or.pw":true,"ed.pw":true,"go.pw":true,"belau.pw":true,"*.py":true,"qa":true,"com.qa":true,"edu.qa":true,"gov.qa":true,"mil.qa":true,"name.qa":true,"net.qa":true,"org.qa":true,"sch.qa":true,"re":true,"com.re":true,"asso.re":true,"nom.re":true,"ro":true,"com.ro":true,"org.ro":true,"tm.ro":true,"nt.ro":true,"nom.ro":true,"info.ro":true,"rec.ro":true,"arts.ro":true,"firm.ro":true,"store.ro":true,"www.ro":true,"rs":true,"co.rs":true,"org.rs":true,"edu.rs":true,"ac.rs":true,"gov.rs":true,"in.rs":true,"ru":true,"ac.ru":true,"com.ru":true,"edu.ru":true,"int.ru":true,"net.ru":true,"org.ru":true,"pp.ru":true,"adygeya.ru":true,"altai.ru":true,"amur.ru":true,"arkhangelsk.ru":true,"astrakhan.ru":true,"bashkiria.ru":true,"belgorod.ru":true,"bir.ru":true,"bryansk.ru":true,"buryatia.ru":true,"cbg.ru":true,"chel.ru":true,"chelyabinsk.ru":true,"chita.ru":true,"chukotka.ru":true,"chuvashia.ru":true,"dagestan.ru":true,"dudinka.ru":true,"e-burg.ru":true,"grozny.ru":true,"irkutsk.ru":true,"ivanovo.ru":true,"izhevsk.ru":true,"jar.ru":true,"joshkar-ola.ru":true,"kalmykia.ru":true,"kaluga.ru":true,"kamchatka.ru":true,"karelia.ru":true,"kazan.ru":true,"kchr.ru":true,"kemerovo.ru":true,"khabarovsk.ru":true,"khakassia.ru":true,"khv.ru":true,"kirov.ru":true,"koenig.ru":true,"komi.ru":true,"kostroma.ru":true,"krasnoyarsk.ru":true,"kuban.ru":true,"kurgan.ru":true,"kursk.ru":true,"lipetsk.ru":true,"magadan.ru":true,"mari.ru":true,"mari-el.ru":true,"marine.ru":true,"mordovia.ru":true,"mosreg.ru":true,"msk.ru":true,"murmansk.ru":true,"nalchik.ru":true,"nnov.ru":true,"nov.ru":true,"novosibirsk.ru":true,"nsk.ru":true,"omsk.ru":true,"orenburg.ru":true,"oryol.ru":true,"palana.ru":true,"penza.ru":true,"perm.ru":true,"pskov.ru":true,"ptz.ru":true,"rnd.ru":true,"ryazan.ru":true,"sakhalin.ru":true,"samara.ru":true,"saratov.ru":true,"simbirsk.ru":true,"smolensk.ru":true,"spb.ru":true,"stavropol.ru":true,"stv.ru":true,"surgut.ru":true,"tambov.ru":true,"tatarstan.ru":true,"tom.ru":true,"tomsk.ru":true,"tsaritsyn.ru":true,"tsk.ru":true,"tula.ru":true,"tuva.ru":true,"tver.ru":true,"tyumen.ru":true,"udm.ru":true,"udmurtia.ru":true,"ulan-ude.ru":true,"vladikavkaz.ru":true,"vladimir.ru":true,"vladivostok.ru":true,"volgograd.ru":true,"vologda.ru":true,"voronezh.ru":true,"vrn.ru":true,"vyatka.ru":true,"yakutia.ru":true,"yamal.ru":true,"yaroslavl.ru":true,"yekaterinburg.ru":true,"yuzhno-sakhalinsk.ru":true,"amursk.ru":true,"baikal.ru":true,"cmw.ru":true,"fareast.ru":true,"jamal.ru":true,"kms.ru":true,"k-uralsk.ru":true,"kustanai.ru":true,"kuzbass.ru":true,"magnitka.ru":true,"mytis.ru":true,"nakhodka.ru":true,"nkz.ru":true,"norilsk.ru":true,"oskol.ru":true,"pyatigorsk.ru":true,"rubtsovsk.ru":true,"snz.ru":true,"syzran.ru":true,"vdonsk.ru":true,"zgrad.ru":true,"gov.ru":true,"mil.ru":true,"test.ru":true,"rw":true,"gov.rw":true,"net.rw":true,"edu.rw":true,"ac.rw":true,"com.rw":true,"co.rw":true,"int.rw":true,"mil.rw":true,"gouv.rw":true,"sa":true,"com.sa":true,"net.sa":true,"org.sa":true,"gov.sa":true,"med.sa":true,"pub.sa":true,"edu.sa":true,"sch.sa":true,"sb":true,"com.sb":true,"edu.sb":true,"gov.sb":true,"net.sb":true,"org.sb":true,"sc":true,"com.sc":true,"gov.sc":true,"net.sc":true,"org.sc":true,"edu.sc":true,"sd":true,"com.sd":true,"net.sd":true,"org.sd":true,"edu.sd":true,"med.sd":true,"gov.sd":true,"info.sd":true,"se":true,"a.se":true,"ac.se":true,"b.se":true,"bd.se":true,"brand.se":true,"c.se":true,"d.se":true,"e.se":true,"f.se":true,"fh.se":true,"fhsk.se":true,"fhv.se":true,"g.se":true,"h.se":true,"i.se":true,"k.se":true,"komforb.se":true,"kommunalforbund.se":true,"komvux.se":true,"l.se":true,"lanbib.se":true,"m.se":true,"n.se":true,"naturbruksgymn.se":true,"o.se":true,"org.se":true,"p.se":true,"parti.se":true,"pp.se":true,"press.se":true,"r.se":true,"s.se":true,"sshn.se":true,"t.se":true,"tm.se":true,"u.se":true,"w.se":true,"x.se":true,"y.se":true,"z.se":true,"sg":true,"com.sg":true,"net.sg":true,"org.sg":true,"gov.sg":true,"edu.sg":true,"per.sg":true,"sh":true,"si":true,"sk":true,"sl":true,"com.sl":true,"net.sl":true,"edu.sl":true,"gov.sl":true,"org.sl":true,"sm":true,"sn":true,"art.sn":true,"com.sn":true,"edu.sn":true,"gouv.sn":true,"org.sn":true,"perso.sn":true,"univ.sn":true,"so":true,"com.so":true,"net.so":true,"org.so":true,"sr":true,"st":true,"co.st":true,"com.st":true,"consulado.st":true,"edu.st":true,"embaixada.st":true,"gov.st":true,"mil.st":true,"net.st":true,"org.st":true,"principe.st":true,"saotome.st":true,"store.st":true,"su":true,"*.sv":true,"sy":true,"edu.sy":true,"gov.sy":true,"net.sy":true,"mil.sy":true,"com.sy":true,"org.sy":true,"sz":true,"co.sz":true,"ac.sz":true,"org.sz":true,"tc":true,"td":true,"tel":true,"tf":true,"tg":true,"th":true,"ac.th":true,"co.th":true,"go.th":true,"in.th":true,"mi.th":true,"net.th":true,"or.th":true,"tj":true,"ac.tj":true,"biz.tj":true,"co.tj":true,"com.tj":true,"edu.tj":true,"go.tj":true,"gov.tj":true,"int.tj":true,"mil.tj":true,"name.tj":true,"net.tj":true,"nic.tj":true,"org.tj":true,"test.tj":true,"web.tj":true,"tk":true,"tl":true,"gov.tl":true,"tm":true,"tn":true,"com.tn":true,"ens.tn":true,"fin.tn":true,"gov.tn":true,"ind.tn":true,"intl.tn":true,"nat.tn":true,"net.tn":true,"org.tn":true,"info.tn":true,"perso.tn":true,"tourism.tn":true,"edunet.tn":true,"rnrt.tn":true,"rns.tn":true,"rnu.tn":true,"mincom.tn":true,"agrinet.tn":true,"defense.tn":true,"turen.tn":true,"to":true,"com.to":true,"gov.to":true,"net.to":true,"org.to":true,"edu.to":true,"mil.to":true,"*.tr":true,"nic.tr":false,"gov.nc.tr":true,"travel":true,"tt":true,"co.tt":true,"com.tt":true,"org.tt":true,"net.tt":true,"biz.tt":true,"info.tt":true,"pro.tt":true,"int.tt":true,"coop.tt":true,"jobs.tt":true,"mobi.tt":true,"travel.tt":true,"museum.tt":true,"aero.tt":true,"name.tt":true,"gov.tt":true,"edu.tt":true,"tv":true,"tw":true,"edu.tw":true,"gov.tw":true,"mil.tw":true,"com.tw":true,"net.tw":true,"org.tw":true,"idv.tw":true,"game.tw":true,"ebiz.tw":true,"club.tw":true,"xn--zf0ao64a.tw":true,"xn--uc0atv.tw":true,"xn--czrw28b.tw":true,"ac.tz":true,"co.tz":true,"go.tz":true,"mil.tz":true,"ne.tz":true,"or.tz":true,"sc.tz":true,"ua":true,"com.ua":true,"edu.ua":true,"gov.ua":true,"in.ua":true,"net.ua":true,"org.ua":true,"cherkassy.ua":true,"chernigov.ua":true,"chernovtsy.ua":true,"ck.ua":true,"cn.ua":true,"crimea.ua":true,"cv.ua":true,"dn.ua":true,"dnepropetrovsk.ua":true,"donetsk.ua":true,"dp.ua":true,"if.ua":true,"ivano-frankivsk.ua":true,"kh.ua":true,"kharkov.ua":true,"kherson.ua":true,"khmelnitskiy.ua":true,"kiev.ua":true,"kirovograd.ua":true,"km.ua":true,"kr.ua":true,"ks.ua":true,"kv.ua":true,"lg.ua":true,"lugansk.ua":true,"lutsk.ua":true,"lviv.ua":true,"mk.ua":true,"nikolaev.ua":true,"od.ua":true,"odessa.ua":true,"pl.ua":true,"poltava.ua":true,"rovno.ua":true,"rv.ua":true,"sebastopol.ua":true,"sumy.ua":true,"te.ua":true,"ternopil.ua":true,"uzhgorod.ua":true,"vinnica.ua":true,"vn.ua":true,"zaporizhzhe.ua":true,"zp.ua":true,"zhitomir.ua":true,"zt.ua":true,"co.ua":true,"pp.ua":true,"ug":true,"co.ug":true,"ac.ug":true,"sc.ug":true,"go.ug":true,"ne.ug":true,"or.ug":true,"*.uk":true,"*.sch.uk":true,"bl.uk":false,"british-library.uk":false,"icnet.uk":false,"jet.uk":false,"mod.uk":false,"nel.uk":false,"nhs.uk":false,"nic.uk":false,"nls.uk":false,"national-library-scotland.uk":false,"parliament.uk":false,"police.uk":false,"us":true,"dni.us":true,"fed.us":true,"isa.us":true,"kids.us":true,"nsn.us":true,"ak.us":true,"al.us":true,"ar.us":true,"as.us":true,"az.us":true,"ca.us":true,"co.us":true,"ct.us":true,"dc.us":true,"de.us":true,"fl.us":true,"ga.us":true,"gu.us":true,"hi.us":true,"ia.us":true,"id.us":true,"il.us":true,"in.us":true,"ks.us":true,"ky.us":true,"la.us":true,"ma.us":true,"md.us":true,"me.us":true,"mi.us":true,"mn.us":true,"mo.us":true,"ms.us":true,"mt.us":true,"nc.us":true,"nd.us":true,"ne.us":true,"nh.us":true,"nj.us":true,"nm.us":true,"nv.us":true,"ny.us":true,"oh.us":true,"ok.us":true,"or.us":true,"pa.us":true,"pr.us":true,"ri.us":true,"sc.us":true,"sd.us":true,"tn.us":true,"tx.us":true,"ut.us":true,"vi.us":true,"vt.us":true,"va.us":true,"wa.us":true,"wi.us":true,"wv.us":true,"wy.us":true,"k12.ak.us":true,"k12.al.us":true,"k12.ar.us":true,"k12.as.us":true,"k12.az.us":true,"k12.ca.us":true,"k12.co.us":true,"k12.ct.us":true,"k12.dc.us":true,"k12.de.us":true,"k12.fl.us":true,"k12.ga.us":true,"k12.gu.us":true,"k12.ia.us":true,"k12.id.us":true,"k12.il.us":true,"k12.in.us":true,"k12.ks.us":true,"k12.ky.us":true,"k12.la.us":true,"k12.ma.us":true,"k12.md.us":true,"k12.me.us":true,"k12.mi.us":true,"k12.mn.us":true,"k12.mo.us":true,"k12.ms.us":true,"k12.mt.us":true,"k12.nc.us":true,"k12.nd.us":true,"k12.ne.us":true,"k12.nh.us":true,"k12.nj.us":true,"k12.nm.us":true,"k12.nv.us":true,"k12.ny.us":true,"k12.oh.us":true,"k12.ok.us":true,"k12.or.us":true,"k12.pa.us":true,"k12.pr.us":true,"k12.ri.us":true,"k12.sc.us":true,"k12.sd.us":true,"k12.tn.us":true,"k12.tx.us":true,"k12.ut.us":true,"k12.vi.us":true,"k12.vt.us":true,"k12.va.us":true,"k12.wa.us":true,"k12.wi.us":true,"k12.wv.us":true,"k12.wy.us":true,"cc.ak.us":true,"cc.al.us":true,"cc.ar.us":true,"cc.as.us":true,"cc.az.us":true,"cc.ca.us":true,"cc.co.us":true,"cc.ct.us":true,"cc.dc.us":true,"cc.de.us":true,"cc.fl.us":true,"cc.ga.us":true,"cc.gu.us":true,"cc.hi.us":true,"cc.ia.us":true,"cc.id.us":true,"cc.il.us":true,"cc.in.us":true,"cc.ks.us":true,"cc.ky.us":true,"cc.la.us":true,"cc.ma.us":true,"cc.md.us":true,"cc.me.us":true,"cc.mi.us":true,"cc.mn.us":true,"cc.mo.us":true,"cc.ms.us":true,"cc.mt.us":true,"cc.nc.us":true,"cc.nd.us":true,"cc.ne.us":true,"cc.nh.us":true,"cc.nj.us":true,"cc.nm.us":true,"cc.nv.us":true,"cc.ny.us":true,"cc.oh.us":true,"cc.ok.us":true,"cc.or.us":true,"cc.pa.us":true,"cc.pr.us":true,"cc.ri.us":true,"cc.sc.us":true,"cc.sd.us":true,"cc.tn.us":true,"cc.tx.us":true,"cc.ut.us":true,"cc.vi.us":true,"cc.vt.us":true,"cc.va.us":true,"cc.wa.us":true,"cc.wi.us":true,"cc.wv.us":true,"cc.wy.us":true,"lib.ak.us":true,"lib.al.us":true,"lib.ar.us":true,"lib.as.us":true,"lib.az.us":true,"lib.ca.us":true,"lib.co.us":true,"lib.ct.us":true,"lib.dc.us":true,"lib.de.us":true,"lib.fl.us":true,"lib.ga.us":true,"lib.gu.us":true,"lib.hi.us":true,"lib.ia.us":true,"lib.id.us":true,"lib.il.us":true,"lib.in.us":true,"lib.ks.us":true,"lib.ky.us":true,"lib.la.us":true,"lib.ma.us":true,"lib.md.us":true,"lib.me.us":true,"lib.mi.us":true,"lib.mn.us":true,"lib.mo.us":true,"lib.ms.us":true,"lib.mt.us":true,"lib.nc.us":true,"lib.nd.us":true,"lib.ne.us":true,"lib.nh.us":true,"lib.nj.us":true,"lib.nm.us":true,"lib.nv.us":true,"lib.ny.us":true,"lib.oh.us":true,"lib.ok.us":true,"lib.or.us":true,"lib.pa.us":true,"lib.pr.us":true,"lib.ri.us":true,"lib.sc.us":true,"lib.sd.us":true,"lib.tn.us":true,"lib.tx.us":true,"lib.ut.us":true,"lib.vi.us":true,"lib.vt.us":true,"lib.va.us":true,"lib.wa.us":true,"lib.wi.us":true,"lib.wv.us":true,"lib.wy.us":true,"pvt.k12.ma.us":true,"chtr.k12.ma.us":true,"paroch.k12.ma.us":true,"*.uy":true,"uz":true,"com.uz":true,"co.uz":true,"va":true,"vc":true,"com.vc":true,"net.vc":true,"org.vc":true,"gov.vc":true,"mil.vc":true,"edu.vc":true,"*.ve":true,"vg":true,"vi":true,"co.vi":true,"com.vi":true,"k12.vi":true,"net.vi":true,"org.vi":true,"vn":true,"com.vn":true,"net.vn":true,"org.vn":true,"edu.vn":true,"gov.vn":true,"int.vn":true,"ac.vn":true,"biz.vn":true,"info.vn":true,"name.vn":true,"pro.vn":true,"health.vn":true,"vu":true,"wf":true,"ws":true,"com.ws":true,"net.ws":true,"org.ws":true,"gov.ws":true,"edu.ws":true,"yt":true,"xn--mgbaam7a8h":true,"xn--54b7fta0cc":true,"xn--fiqs8s":true,"xn--fiqz9s":true,"xn--lgbbat1ad8j":true,"xn--wgbh1c":true,"xn--node":true,"xn--j6w193g":true,"xn--h2brj9c":true,"xn--mgbbh1a71e":true,"xn--fpcrj9c3d":true,"xn--gecrj9c":true,"xn--s9brj9c":true,"xn--45brj9c":true,"xn--xkc2dl3a5ee0h":true,"xn--mgba3a4f16a":true,"xn--mgba3a4fra":true,"xn--mgbayh7gpa":true,"xn--3e0b707e":true,"xn--fzc2c9e2c":true,"xn--xkc2al3hye2a":true,"xn--mgbc0a9azcg":true,"xn--mgb9awbf":true,"xn--ygbi2ammx":true,"xn--90a3ac":true,"xn--p1ai":true,"xn--wgbl6a":true,"xn--mgberp4a5d4ar":true,"xn--mgberp4a5d4a87g":true,"xn--mgbqly7c0a67fbc":true,"xn--mgbqly7cvafr":true,"xn--ogbpf8fl":true,"xn--mgbtf8fl":true,"xn--yfro4i67o":true,"xn--clchc0ea0b2g2a9gcd":true,"xn--o3cw4h":true,"xn--pgbs0dh":true,"xn--kpry57d":true,"xn--kprw13d":true,"xn--nnx388a":true,"xn--j1amh":true,"xn--mgb2ddes":true,"xxx":true,"*.ye":true,"*.za":true,"*.zm":true,"*.zw":true,"biz.at":true,"info.at":true,"priv.at":true,"co.ca":true,"ar.com":true,"br.com":true,"cn.com":true,"de.com":true,"eu.com":true,"gb.com":true,"gr.com":true,"hu.com":true,"jpn.com":true,"kr.com":true,"no.com":true,"qc.com":true,"ru.com":true,"sa.com":true,"se.com":true,"uk.com":true,"us.com":true,"uy.com":true,"za.com":true,"gb.net":true,"jp.net":true,"se.net":true,"uk.net":true,"ae.org":true,"us.org":true,"com.de":true,"operaunite.com":true,"appspot.com":true,"iki.fi":true,"c.la":true,"za.net":true,"za.org":true,"co.nl":true,"co.no":true,"co.pl":true,"dyndns-at-home.com":true,"dyndns-at-work.com":true,"dyndns-blog.com":true,"dyndns-free.com":true,"dyndns-home.com":true,"dyndns-ip.com":true,"dyndns-mail.com":true,"dyndns-office.com":true,"dyndns-pics.com":true,"dyndns-remote.com":true,"dyndns-server.com":true,"dyndns-web.com":true,"dyndns-wiki.com":true,"dyndns-work.com":true,"dyndns.biz":true,"dyndns.info":true,"dyndns.org":true,"dyndns.tv":true,"at-band-camp.net":true,"ath.cx":true,"barrel-of-knowledge.info":true,"barrell-of-knowledge.info":true,"better-than.tv":true,"blogdns.com":true,"blogdns.net":true,"blogdns.org":true,"blogsite.org":true,"boldlygoingnowhere.org":true,"broke-it.net":true,"buyshouses.net":true,"cechire.com":true,"dnsalias.com":true,"dnsalias.net":true,"dnsalias.org":true,"dnsdojo.com":true,"dnsdojo.net":true,"dnsdojo.org":true,"does-it.net":true,"doesntexist.com":true,"doesntexist.org":true,"dontexist.com":true,"dontexist.net":true,"dontexist.org":true,"doomdns.com":true,"doomdns.org":true,"dvrdns.org":true,"dyn-o-saur.com":true,"dynalias.com":true,"dynalias.net":true,"dynalias.org":true,"dynathome.net":true,"dyndns.ws":true,"endofinternet.net":true,"endofinternet.org":true,"endoftheinternet.org":true,"est-a-la-maison.com":true,"est-a-la-masion.com":true,"est-le-patron.com":true,"est-mon-blogueur.com":true,"for-better.biz":true,"for-more.biz":true,"for-our.info":true,"for-some.biz":true,"for-the.biz":true,"forgot.her.name":true,"forgot.his.name":true,"from-ak.com":true,"from-al.com":true,"from-ar.com":true,"from-az.net":true,"from-ca.com":true,"from-co.net":true,"from-ct.com":true,"from-dc.com":true,"from-de.com":true,"from-fl.com":true,"from-ga.com":true,"from-hi.com":true,"from-ia.com":true,"from-id.com":true,"from-il.com":true,"from-in.com":true,"from-ks.com":true,"from-ky.com":true,"from-la.net":true,"from-ma.com":true,"from-md.com":true,"from-me.org":true,"from-mi.com":true,"from-mn.com":true,"from-mo.com":true,"from-ms.com":true,"from-mt.com":true,"from-nc.com":true,"from-nd.com":true,"from-ne.com":true,"from-nh.com":true,"from-nj.com":true,"from-nm.com":true,"from-nv.com":true,"from-ny.net":true,"from-oh.com":true,"from-ok.com":true,"from-or.com":true,"from-pa.com":true,"from-pr.com":true,"from-ri.com":true,"from-sc.com":true,"from-sd.com":true,"from-tn.com":true,"from-tx.com":true,"from-ut.com":true,"from-va.com":true,"from-vt.com":true,"from-wa.com":true,"from-wi.com":true,"from-wv.com":true,"from-wy.com":true,"ftpaccess.cc":true,"fuettertdasnetz.de":true,"game-host.org":true,"game-server.cc":true,"getmyip.com":true,"gets-it.net":true,"go.dyndns.org":true,"gotdns.com":true,"gotdns.org":true,"groks-the.info":true,"groks-this.info":true,"ham-radio-op.net":true,"here-for-more.info":true,"hobby-site.com":true,"hobby-site.org":true,"home.dyndns.org":true,"homedns.org":true,"homeftp.net":true,"homeftp.org":true,"homeip.net":true,"homelinux.com":true,"homelinux.net":true,"homelinux.org":true,"homeunix.com":true,"homeunix.net":true,"homeunix.org":true,"iamallama.com":true,"in-the-band.net":true,"is-a-anarchist.com":true,"is-a-blogger.com":true,"is-a-bookkeeper.com":true,"is-a-bruinsfan.org":true,"is-a-bulls-fan.com":true,"is-a-candidate.org":true,"is-a-caterer.com":true,"is-a-celticsfan.org":true,"is-a-chef.com":true,"is-a-chef.net":true,"is-a-chef.org":true,"is-a-conservative.com":true,"is-a-cpa.com":true,"is-a-cubicle-slave.com":true,"is-a-democrat.com":true,"is-a-designer.com":true,"is-a-doctor.com":true,"is-a-financialadvisor.com":true,"is-a-geek.com":true,"is-a-geek.net":true,"is-a-geek.org":true,"is-a-green.com":true,"is-a-guru.com":true,"is-a-hard-worker.com":true,"is-a-hunter.com":true,"is-a-knight.org":true,"is-a-landscaper.com":true,"is-a-lawyer.com":true,"is-a-liberal.com":true,"is-a-libertarian.com":true,"is-a-linux-user.org":true,"is-a-llama.com":true,"is-a-musician.com":true,"is-a-nascarfan.com":true,"is-a-nurse.com":true,"is-a-painter.com":true,"is-a-patsfan.org":true,"is-a-personaltrainer.com":true,"is-a-photographer.com":true,"is-a-player.com":true,"is-a-republican.com":true,"is-a-rockstar.com":true,"is-a-socialist.com":true,"is-a-soxfan.org":true,"is-a-student.com":true,"is-a-teacher.com":true,"is-a-techie.com":true,"is-a-therapist.com":true,"is-an-accountant.com":true,"is-an-actor.com":true,"is-an-actress.com":true,"is-an-anarchist.com":true,"is-an-artist.com":true,"is-an-engineer.com":true,"is-an-entertainer.com":true,"is-by.us":true,"is-certified.com":true,"is-found.org":true,"is-gone.com":true,"is-into-anime.com":true,"is-into-cars.com":true,"is-into-cartoons.com":true,"is-into-games.com":true,"is-leet.com":true,"is-lost.org":true,"is-not-certified.com":true,"is-saved.org":true,"is-slick.com":true,"is-uberleet.com":true,"is-very-bad.org":true,"is-very-evil.org":true,"is-very-good.org":true,"is-very-nice.org":true,"is-very-sweet.org":true,"is-with-theband.com":true,"isa-geek.com":true,"isa-geek.net":true,"isa-geek.org":true,"isa-hockeynut.com":true,"issmarterthanyou.com":true,"isteingeek.de":true,"istmein.de":true,"kicks-ass.net":true,"kicks-ass.org":true,"knowsitall.info":true,"land-4-sale.us":true,"lebtimnetz.de":true,"leitungsen.de":true,"likes-pie.com":true,"likescandy.com":true,"merseine.nu":true,"mine.nu":true,"misconfused.org":true,"mypets.ws":true,"myphotos.cc":true,"neat-url.com":true,"office-on-the.net":true,"on-the-web.tv":true,"podzone.net":true,"podzone.org":true,"readmyblog.org":true,"saves-the-whales.com":true,"scrapper-site.net":true,"scrapping.cc":true,"selfip.biz":true,"selfip.com":true,"selfip.info":true,"selfip.net":true,"selfip.org":true,"sells-for-less.com":true,"sells-for-u.com":true,"sells-it.net":true,"sellsyourhome.org":true,"servebbs.com":true,"servebbs.net":true,"servebbs.org":true,"serveftp.net":true,"serveftp.org":true,"servegame.org":true,"shacknet.nu":true,"simple-url.com":true,"space-to-rent.com":true,"stuff-4-sale.org":true,"stuff-4-sale.us":true,"teaches-yoga.com":true,"thruhere.net":true,"traeumtgerade.de":true,"webhop.biz":true,"webhop.info":true,"webhop.net":true,"webhop.org":true,"worse-than.tv":true,"writesthisblog.com":true});
+
+// END of automatically generated file
--- /dev/null
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
--- /dev/null
+Copyright Mathias Bynens <http://mathiasbynens.be/>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+{
+ "name": "punycode",
+ "version": "1.2.3",
+ "description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.",
+ "homepage": "http://mths.be/punycode",
+ "main": "punycode.js",
+ "keywords": [
+ "punycode",
+ "unicode",
+ "idn",
+ "idna",
+ "dns",
+ "url",
+ "domain"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://mths.be/mit"
+ },
+ {
+ "type": "GPL",
+ "url": "http://mths.be/gpl"
+ }
+ ],
+ "author": {
+ "name": "Mathias Bynens",
+ "email": "mathias@qiwi.be",
+ "url": "http://mathiasbynens.be/"
+ },
+ "contributors": [
+ {
+ "name": "Mathias Bynens",
+ "email": "mathias@qiwi.be",
+ "url": "http://mathiasbynens.be/"
+ },
+ {
+ "name": "John-David Dalton",
+ "email": "john.david.dalton@gmail.com",
+ "url": "http://allyoucanleet.com/"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/bestiejs/punycode.js/issues"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/bestiejs/punycode.js.git"
+ },
+ "engines": [
+ "node",
+ "rhino"
+ ],
+ "directories": {
+ "doc": "docs",
+ "test": "tests"
+ },
+ "scripts": {
+ "test": "node tests/tests.js"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.1",
+ "grunt-contrib-uglify": "~0.2.2",
+ "grunt-shell": "~0.2.2",
+ "istanbul": "~0.1.37",
+ "qunit-clib": "~1.3.0",
+ "qunitjs": "~1.11.0",
+ "requirejs": "~2.1.6"
+ },
+ "readme": "ERROR: No README data found!",
+ "_id": "punycode@1.2.3",
+ "dist": {
+ "shasum": "0af1f294b11513e272c304732a5c1571cfc6f811"
+ },
+ "_from": "punycode@>=0.2.0",
+ "_resolved": "https://registry.npmjs.org/punycode/-/punycode-1.2.3.tgz"
+}
--- /dev/null
+/*! http://mths.be/punycode v1.2.3 by @mathias */
+;(function(root) {
+
+ /** Detect free variables */
+ var freeExports = typeof exports == 'object' && exports;
+ var freeModule = typeof module == 'object' && module &&
+ module.exports == freeExports && module;
+ var freeGlobal = typeof global == 'object' && global;
+ if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
+ root = freeGlobal;
+ }
+
+ /**
+ * The `punycode` object.
+ * @name punycode
+ * @type Object
+ */
+ var punycode,
+
+ /** Highest positive signed 32-bit float value */
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
+
+ /** Bootstring parameters */
+ base = 36,
+ tMin = 1,
+ tMax = 26,
+ skew = 38,
+ damp = 700,
+ initialBias = 72,
+ initialN = 128, // 0x80
+ delimiter = '-', // '\x2D'
+
+ /** Regular expressions */
+ regexPunycode = /^xn--/,
+ regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
+ regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators
+
+ /** Error messages */
+ errors = {
+ 'overflow': 'Overflow: input needs wider integers to process',
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
+ 'invalid-input': 'Invalid input'
+ },
+
+ /** Convenience shortcuts */
+ baseMinusTMin = base - tMin,
+ floor = Math.floor,
+ stringFromCharCode = String.fromCharCode,
+
+ /** Temporary variable */
+ key;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * A generic error utility function.
+ * @private
+ * @param {String} type The error type.
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
+ */
+ function error(type) {
+ throw RangeError(errors[type]);
+ }
+
+ /**
+ * A generic `Array#map` utility function.
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} callback The function that gets called for every array
+ * item.
+ * @returns {Array} A new array of values returned by the callback function.
+ */
+ function map(array, fn) {
+ var length = array.length;
+ while (length--) {
+ array[length] = fn(array[length]);
+ }
+ return array;
+ }
+
+ /**
+ * A simple `Array#map`-like wrapper to work with domain name strings.
+ * @private
+ * @param {String} domain The domain name.
+ * @param {Function} callback The function that gets called for every
+ * character.
+ * @returns {Array} A new string of characters returned by the callback
+ * function.
+ */
+ function mapDomain(string, fn) {
+ return map(string.split(regexSeparators), fn).join('.');
+ }
+
+ /**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ * @see `punycode.ucs2.encode`
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
+ * @memberOf punycode.ucs2
+ * @name decode
+ * @param {String} string The Unicode input string (UCS-2).
+ * @returns {Array} The new array of code points.
+ */
+ function ucs2decode(string) {
+ var output = [],
+ counter = 0,
+ length = string.length,
+ value,
+ extra;
+ while (counter < length) {
+ value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ // high surrogate, and there is a next character
+ extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ // unmatched surrogate; only append this code unit, in case the next
+ // code unit is the high surrogate of a surrogate pair
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+ }
+
+ /**
+ * Creates a string based on an array of numeric code points.
+ * @see `punycode.ucs2.decode`
+ * @memberOf punycode.ucs2
+ * @name encode
+ * @param {Array} codePoints The array of numeric code points.
+ * @returns {String} The new Unicode string (UCS-2).
+ */
+ function ucs2encode(array) {
+ return map(array, function(value) {
+ var output = '';
+ if (value > 0xFFFF) {
+ value -= 0x10000;
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
+ value = 0xDC00 | value & 0x3FF;
+ }
+ output += stringFromCharCode(value);
+ return output;
+ }).join('');
+ }
+
+ /**
+ * Converts a basic code point into a digit/integer.
+ * @see `digitToBasic()`
+ * @private
+ * @param {Number} codePoint The basic numeric code point value.
+ * @returns {Number} The numeric value of a basic code point (for use in
+ * representing integers) in the range `0` to `base - 1`, or `base` if
+ * the code point does not represent a value.
+ */
+ function basicToDigit(codePoint) {
+ if (codePoint - 48 < 10) {
+ return codePoint - 22;
+ }
+ if (codePoint - 65 < 26) {
+ return codePoint - 65;
+ }
+ if (codePoint - 97 < 26) {
+ return codePoint - 97;
+ }
+ return base;
+ }
+
+ /**
+ * Converts a digit/integer into a basic code point.
+ * @see `basicToDigit()`
+ * @private
+ * @param {Number} digit The numeric value of a basic code point.
+ * @returns {Number} The basic code point whose value (when used for
+ * representing integers) is `digit`, which needs to be in the range
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
+ * used; else, the lowercase form is used. The behavior is undefined
+ * if `flag` is non-zero and `digit` has no uppercase form.
+ */
+ function digitToBasic(digit, flag) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
+ }
+
+ /**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * http://tools.ietf.org/html/rfc3492#section-3.4
+ * @private
+ */
+ function adapt(delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ }
+
+ /**
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
+ * symbols.
+ * @memberOf punycode
+ * @param {String} input The Punycode string of ASCII-only symbols.
+ * @returns {String} The resulting string of Unicode symbols.
+ */
+ function decode(input) {
+ // Don't use UCS-2
+ var output = [],
+ inputLength = input.length,
+ out,
+ i = 0,
+ n = initialN,
+ bias = initialBias,
+ basic,
+ j,
+ index,
+ oldi,
+ w,
+ k,
+ digit,
+ t,
+ length,
+ /** Cached calculation results */
+ baseMinusT;
+
+ // Handle the basic code points: let `basic` be the number of input code
+ // points before the last delimiter, or `0` if there is none, then copy
+ // the first basic code points to the output.
+
+ basic = input.lastIndexOf(delimiter);
+ if (basic < 0) {
+ basic = 0;
+ }
+
+ for (j = 0; j < basic; ++j) {
+ // if it's not a basic code point
+ if (input.charCodeAt(j) >= 0x80) {
+ error('not-basic');
+ }
+ output.push(input.charCodeAt(j));
+ }
+
+ // Main decoding loop: start just after the last delimiter if any basic code
+ // points were copied; start at the beginning otherwise.
+
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
+
+ // `index` is the index of the next character to be consumed.
+ // Decode a generalized variable-length integer into `delta`,
+ // which gets added to `i`. The overflow checking is easier
+ // if we increase `i` as we go, then subtract off its starting
+ // value at the end to obtain `delta`.
+ for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
+
+ if (index >= inputLength) {
+ error('invalid-input');
+ }
+
+ digit = basicToDigit(input.charCodeAt(index++));
+
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
+ error('overflow');
+ }
+
+ i += digit * w;
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+
+ if (digit < t) {
+ break;
+ }
+
+ baseMinusT = base - t;
+ if (w > floor(maxInt / baseMinusT)) {
+ error('overflow');
+ }
+
+ w *= baseMinusT;
+
+ }
+
+ out = output.length + 1;
+ bias = adapt(i - oldi, out, oldi == 0);
+
+ // `i` was supposed to wrap around from `out` to `0`,
+ // incrementing `n` each time, so we'll fix that now:
+ if (floor(i / out) > maxInt - n) {
+ error('overflow');
+ }
+
+ n += floor(i / out);
+ i %= out;
+
+ // Insert `n` at position `i` of the output
+ output.splice(i++, 0, n);
+
+ }
+
+ return ucs2encode(output);
+ }
+
+ /**
+ * Converts a string of Unicode symbols to a Punycode string of ASCII-only
+ * symbols.
+ * @memberOf punycode
+ * @param {String} input The string of Unicode symbols.
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
+ */
+ function encode(input) {
+ var n,
+ delta,
+ handledCPCount,
+ basicLength,
+ bias,
+ j,
+ m,
+ q,
+ k,
+ t,
+ currentValue,
+ output = [],
+ /** `inputLength` will hold the number of code points in `input`. */
+ inputLength,
+ /** Cached calculation results */
+ handledCPCountPlusOne,
+ baseMinusT,
+ qMinusT;
+
+ // Convert the input in UCS-2 to Unicode
+ input = ucs2decode(input);
+
+ // Cache the length
+ inputLength = input.length;
+
+ // Initialize the state
+ n = initialN;
+ delta = 0;
+ bias = initialBias;
+
+ // Handle the basic code points
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ handledCPCount = basicLength = output.length;
+
+ // `handledCPCount` is the number of code points that have been handled;
+ // `basicLength` is the number of basic code points.
+
+ // Finish the basic string - if it is not empty - with a delimiter
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+
+ // All non-basic code points < n have been handled already. Find the next
+ // larger one:
+ for (m = maxInt, j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
+ // but guard against overflow
+ handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ error('overflow');
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+
+ if (currentValue < n && ++delta > maxInt) {
+ error('overflow');
+ }
+
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer
+ for (q = delta, k = base; /* no condition */; k += base) {
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) {
+ break;
+ }
+ qMinusT = q - t;
+ baseMinusT = base - t;
+ output.push(
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
+ );
+ q = floor(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+
+ }
+ return output.join('');
+ }
+
+ /**
+ * Converts a Punycode string representing a domain name to Unicode. Only the
+ * Punycoded parts of the domain name will be converted, i.e. it doesn't
+ * matter if you call it on a string that has already been converted to
+ * Unicode.
+ * @memberOf punycode
+ * @param {String} domain The Punycode domain name to convert to Unicode.
+ * @returns {String} The Unicode representation of the given Punycode
+ * string.
+ */
+ function toUnicode(domain) {
+ return mapDomain(domain, function(string) {
+ return regexPunycode.test(string)
+ ? decode(string.slice(4).toLowerCase())
+ : string;
+ });
+ }
+
+ /**
+ * Converts a Unicode string representing a domain name to Punycode. Only the
+ * non-ASCII parts of the domain name will be converted, i.e. it doesn't
+ * matter if you call it with a domain that's already in ASCII.
+ * @memberOf punycode
+ * @param {String} domain The domain name to convert, as a Unicode string.
+ * @returns {String} The Punycode representation of the given domain name.
+ */
+ function toASCII(domain) {
+ return mapDomain(domain, function(string) {
+ return regexNonASCII.test(string)
+ ? 'xn--' + encode(string)
+ : string;
+ });
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /** Define the public API */
+ punycode = {
+ /**
+ * A string representing the current Punycode.js version number.
+ * @memberOf punycode
+ * @type String
+ */
+ 'version': '1.2.3',
+ /**
+ * An object of methods to convert from JavaScript's internal character
+ * representation (UCS-2) to Unicode code points, and back.
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
+ * @memberOf punycode
+ * @type Object
+ */
+ 'ucs2': {
+ 'decode': ucs2decode,
+ 'encode': ucs2encode
+ },
+ 'decode': decode,
+ 'encode': encode,
+ 'toASCII': toASCII,
+ 'toUnicode': toUnicode
+ };
+
+ /** Expose `punycode` */
+ // Some AMD build optimizers, like r.js, check for specific condition patterns
+ // like the following:
+ if (
+ typeof define == 'function' &&
+ typeof define.amd == 'object' &&
+ define.amd
+ ) {
+ define(function() {
+ return punycode;
+ });
+ } else if (freeExports && !freeExports.nodeType) {
+ if (freeModule) { // in Node.js or RingoJS v0.8.0+
+ freeModule.exports = punycode;
+ } else { // in Narwhal or RingoJS v0.7.0-
+ for (key in punycode) {
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
+ }
+ }
+ } else { // in Rhino or a web browser
+ root.punycode = punycode;
+ }
+
+}(this));
--- /dev/null
+/*! http://mths.be/punycode v1.2.3 by @mathias */
+(function(o){function e(o){throw RangeError(L[o])}function n(o,e){for(var n=o.length;n--;)o[n]=e(o[n]);return o}function t(o,e){return n(o.split(S),e).join(".")}function r(o){for(var e,n,t=[],r=0,u=o.length;u>r;)e=o.charCodeAt(r++),e>=55296&&56319>=e&&u>r?(n=o.charCodeAt(r++),56320==(64512&n)?t.push(((1023&e)<<10)+(1023&n)+65536):(t.push(e),r--)):t.push(e);return t}function u(o){return n(o,function(o){var e="";return o>65535&&(o-=65536,e+=R(55296|1023&o>>>10),o=56320|1023&o),e+=R(o)}).join("")}function i(o){return 10>o-48?o-22:26>o-65?o-65:26>o-97?o-97:x}function f(o,e){return o+22+75*(26>o)-((0!=e)<<5)}function c(o,e,n){var t=0;for(o=n?P(o/m):o>>1,o+=P(o/e);o>M*y>>1;t+=x)o=P(o/M);return P(t+(M+1)*o/(o+j))}function l(o){var n,t,r,f,l,d,s,a,p,h,v=[],g=o.length,w=0,j=I,m=A;for(t=o.lastIndexOf(F),0>t&&(t=0),r=0;t>r;++r)o.charCodeAt(r)>=128&&e("not-basic"),v.push(o.charCodeAt(r));for(f=t>0?t+1:0;g>f;){for(l=w,d=1,s=x;f>=g&&e("invalid-input"),a=i(o.charCodeAt(f++)),(a>=x||a>P((b-w)/d))&&e("overflow"),w+=a*d,p=m>=s?C:s>=m+y?y:s-m,!(p>a);s+=x)h=x-p,d>P(b/h)&&e("overflow"),d*=h;n=v.length+1,m=c(w-l,n,0==l),P(w/n)>b-j&&e("overflow"),j+=P(w/n),w%=n,v.splice(w++,0,j)}return u(v)}function d(o){var n,t,u,i,l,d,s,a,p,h,v,g,w,j,m,E=[];for(o=r(o),g=o.length,n=I,t=0,l=A,d=0;g>d;++d)v=o[d],128>v&&E.push(R(v));for(u=i=E.length,i&&E.push(F);g>u;){for(s=b,d=0;g>d;++d)v=o[d],v>=n&&s>v&&(s=v);for(w=u+1,s-n>P((b-t)/w)&&e("overflow"),t+=(s-n)*w,n=s,d=0;g>d;++d)if(v=o[d],n>v&&++t>b&&e("overflow"),v==n){for(a=t,p=x;h=l>=p?C:p>=l+y?y:p-l,!(h>a);p+=x)m=a-h,j=x-h,E.push(R(f(h+m%j,0))),a=P(m/j);E.push(R(f(a,0))),l=c(t,w,u==i),t=0,++u}++t,++n}return E.join("")}function s(o){return t(o,function(o){return E.test(o)?l(o.slice(4).toLowerCase()):o})}function a(o){return t(o,function(o){return O.test(o)?"xn--"+d(o):o})}var p="object"==typeof exports&&exports,h="object"==typeof module&&module&&module.exports==p&&module,v="object"==typeof global&&global;(v.global===v||v.window===v)&&(o=v);var g,w,b=2147483647,x=36,C=1,y=26,j=38,m=700,A=72,I=128,F="-",E=/^xn--/,O=/[^ -~]/,S=/\x2E|\u3002|\uFF0E|\uFF61/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=x-C,P=Math.floor,R=String.fromCharCode;if(g={version:"1.2.3",ucs2:{decode:r,encode:u},decode:l,encode:d,toASCII:a,toUnicode:s},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return g});else if(p&&!p.nodeType)if(h)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else o.punycode=g})(this);
\ No newline at end of file
--- /dev/null
+Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
--- /dev/null
+# Docdown <sup>v1.0.0</sup>
+
+A simple JSDoc to Markdown documentation generator.
+
+## Documentation
+
+The documentation for Docdown can be viewed here: [/doc/README.md](https://github.com/jdalton/docdown/blob/master/doc/README.md#readme)
+
+For a list of upcoming features, check out our [roadmap](https://github.com/jdalton/docdown/wiki/Roadmap).
+
+## Installation and usage
+
+Usage example:
+
+```php
+require("docdown.php");
+
+// generate Markdown
+$markdown = docdown(array(
+ "path" => $filepath,
+ "url" => "https://github.com/username/project/blob/master/my.js"
+));
+```
+
+## Author
+
+| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
+|---|
+| [John-David Dalton](http://allyoucanleet.com/) |
+
+## Contributors
+
+| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
+|---|
+| [Mathias Bynens](http://mathiasbynens.be/) |
--- /dev/null
+# Docdown <sup>v1.0.0</sup>
+
+<!-- div -->
+
+
+<!-- div -->
+
+## <a id="docdown"></a>`docdown`
+* [`docdown`](#docdown$optionsarray)
+
+<!-- /div -->
+
+
+<!-- /div -->
+
+
+<!-- div -->
+
+
+<!-- div -->
+
+## `docdown`
+
+<!-- div -->
+
+### <a id="docdown$optionsarray"></a>`docdown([$options=array()])`
+<a href="#docdown$optionsarray">#</a> [Ⓢ](https://github.com/jdalton/docdown/blob/master/docdown.php#L34 "View in source") [Ⓣ][1]
+
+Generates Markdown from JSDoc entries in a given file.
+
+#### Arguments
+1. `[$options=array()]` *(Array)*: The options array.
+
+#### Returns
+*(String)*: The generated Markdown.
+
+#### Example
+```php
+// specify a file path
+$markdown = docdown(array(
+ // path to js file
+ 'path' => $filepath,
+ // url used to reference line numbers in code
+ 'url' => 'https://github.com/username/project/blob/master/my.js'
+));
+
+// or pass raw js
+$markdown = docdown(array(
+ // raw JavaScript source
+ 'source' => $rawJS,
+ // documentation title
+ 'title' => 'My API Documentation',
+ // url used to reference line numbers in code
+ 'url' => 'https://github.com/username/project/blob/master/my.js'
+));
+```
+
+* * *
+
+<!-- /div -->
+
+
+<!-- /div -->
+
+
+<!-- /div -->
+
+
+ [1]: #docdown "Jump back to the TOC."
\ No newline at end of file
--- /dev/null
+<?php
+
+ // cleanup requested filepath
+ $file = isset($_GET['f']) ? $_GET['f'] : 'docdown';
+ $file = preg_replace('#(\.*[\/])+#', '', $file);
+ $file .= preg_match('/\.[a-z]+$/', $file) ? '' : '.php';
+
+ // output filename
+ if (isset($_GET['o'])) {
+ $output = $_GET['o'];
+ } else if (isset($_SERVER['argv'][1])) {
+ $output = $_SERVER['argv'][1];
+ } else {
+ $output = basename($file);
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ require('../docdown.php');
+
+ // generate Markdown
+ $markdown = docdown(array(
+ 'path' => '../' . $file,
+ 'title' => 'Docdown <sup>v1.0.0</sup>',
+ 'url' => 'https://github.com/jdalton/docdown/blob/master/docdown.php'
+ ));
+
+ // save to a .md file
+ file_put_contents($output . '.md', $markdown);
+
+ // print
+ header('Content-Type: text/plain;charset=utf-8');
+ echo $markdown . PHP_EOL;
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/*!
+ * Docdown v1.0.0-pre
+ * Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
+ * Available under MIT license <http://mths.be/mit>
+ */
+require(dirname(__FILE__) . '/src/DocDown/Generator.php');
+
+/**
+ * Generates Markdown from JSDoc entries in a given file.
+ *
+ * @param {Array} [$options=array()] The options array.
+ * @returns {String} The generated Markdown.
+ * @example
+ *
+ * // specify a file path
+ * $markdown = docdown(array(
+ * // path to js file
+ * 'path' => $filepath,
+ * // url used to reference line numbers in code
+ * 'url' => 'https://github.com/username/project/blob/master/my.js'
+ * ));
+ *
+ * // or pass raw js
+ * $markdown = docdown(array(
+ * // raw JavaScript source
+ * 'source' => $rawJS,
+ * // documentation title
+ * 'title' => 'My API Documentation',
+ * // url used to reference line numbers in code
+ * 'url' => 'https://github.com/username/project/blob/master/my.js'
+ * ));
+ */
+function docdown( $options = array() ) {
+ $gen = new Generator($options);
+ return $gen->generate();
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * A class to represent a JSDoc entry alias.
+ */
+class Alias {
+
+ /**
+ * The alias owner.
+ *
+ * @memberOf Alias
+ * @type Object
+ */
+ public $owner;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The Alias constructor.
+ *
+ * @constructor
+ * @param {String} $name The alias name.
+ * @param {Object} $owner The alias owner.
+ */
+ public function __construct( $name, $owner ) {
+ $this->owner = $owner;
+ $this->_name = $name;
+ $this->_call = $owner->getCall();
+ $this->_category = $owner->getCategory();
+ $this->_desc = $owner->getDesc();
+ $this->_example = $owner->getExample();
+ $this->_isCtor = $owner->isCtor();
+ $this->_isLicense = $owner->isLicense();
+ $this->_isPlugin = $owner->isPlugin();
+ $this->_isPrivate = $owner->isPrivate();
+ $this->_isStatic = $owner->isStatic();
+ $this->_lineNumber = $owner->getLineNumber();
+ $this->_members = $owner->getMembers();
+ $this->_params = $owner->getParams();
+ $this->_returns = $owner->getReturns();
+ $this->_type = $owner->getType();
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Extracts the entry's `alias` objects.
+ *
+ * @memberOf Alias
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array|String} The entry's `alias` objects.
+ */
+ public function getAliases( $index = null ) {
+ $result = array();
+ return $index !== null
+ ? @$result[$index]
+ : $result;
+ }
+
+ /**
+ * Extracts the function call from the owner entry.
+ *
+ * @memberOf Alias
+ * @returns {String} The function call.
+ */
+ public function getCall() {
+ return $this->_call;
+ }
+
+ /**
+ * Extracts the owner entry's `category` data.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's `category` data.
+ */
+ public function getCategory() {
+ return $this->_category;
+ }
+
+ /**
+ * Extracts the owner entry's description.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's description.
+ */
+ public function getDesc() {
+ return $this->_desc;
+ }
+
+ /**
+ * Extracts the owner entry's `example` data.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's `example` data.
+ */
+ public function getExample() {
+ return $this->_example;
+ }
+
+ /**
+ * Checks if the entry is an alias.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true`.
+ */
+ public function isAlias() {
+ return true;
+ }
+
+ /**
+ * Checks if the owner entry is a constructor.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true` if a constructor, else `false`.
+ */
+ public function isCtor() {
+ return $this->_isCtor;
+ }
+
+ /**
+ * Checks if the owner entry is a license.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true` if a license, else `false`.
+ */
+ public function isLicense() {
+ return $this->_isLicense;
+ }
+
+ /**
+ * Checks if the owner entry *is* assigned to a prototype.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true` if assigned to a prototype, else `false`.
+ */
+ public function isPlugin() {
+ return $this->_isPlugin;
+ }
+
+ /**
+ * Checks if the owner entry is private.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true` if private, else `false`.
+ */
+ public function isPrivate() {
+ return $this->_isPrivate;
+ }
+
+ /**
+ * Checks if the owner entry is *not* assigned to a prototype.
+ *
+ * @memberOf Alias
+ * @returns {Boolean} Returns `true` if not assigned to a prototype, else `false`.
+ */
+ public function isStatic() {
+ return $this->_isStatic;
+ }
+
+ /**
+ * Resolves the owner entry's line number.
+ *
+ * @memberOf Alias
+ * @returns {Number} The owner entry's line number.
+ */
+ public function getLineNumber() {
+ return $this->_lineNumber;
+ }
+
+ /**
+ * Extracts the owner entry's `member` data.
+ *
+ * @memberOf Alias
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array|String} The owner entry's `member` data.
+ */
+ public function getMembers( $index = null ) {
+ return $index !== null
+ ? @$this->_members[$index]
+ : $this->_members;
+ }
+
+ /**
+ * Extracts the owner entry's `name` data.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's `name` data.
+ */
+ public function getName() {
+ return $this->_name;
+ }
+
+ /**
+ * Extracts the owner entry's `param` data.
+ *
+ * @memberOf Alias
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array} The owner entry's `param` data.
+ */
+ public function getParams( $index = null ) {
+ return $index !== null
+ ? @$this->_params[$index]
+ : $this->_params;
+ }
+
+ /**
+ * Extracts the owner entry's `returns` data.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's `returns` data.
+ */
+ public function getReturns() {
+ return $this->_returns;
+ }
+
+ /**
+ * Extracts the owner entry's `type` data.
+ *
+ * @memberOf Alias
+ * @returns {String} The owner entry's `type` data.
+ */
+ public function getType() {
+ return $this->_type;
+ }
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+require(dirname(__FILE__) . "/Alias.php");
+
+/**
+ * A class to simplify parsing a single JSDoc entry.
+ */
+class Entry {
+
+ /**
+ * The documentation entry.
+ *
+ * @memberOf Entry
+ * @type String
+ */
+ public $entry = '';
+
+ /**
+ * The language highlighter used for code examples.
+ *
+ * @memberOf Entry
+ * @type String
+ */
+ public $lang = '';
+
+ /**
+ * The source code.
+ *
+ * @memberOf Entry
+ * @type String
+ */
+ public $source = '';
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The Entry constructor.
+ *
+ * @constructor
+ * @param {String} $entry The documentation entry to analyse.
+ * @param {String} $source The source code.
+ * @param {String} [$lang ='js'] The language highlighter used for code examples.
+ */
+ public function __construct( $entry, $source, $lang = 'js' ) {
+ $this->entry = $entry;
+ $this->lang = $lang;
+ $this->source = str_replace(PHP_EOL, "\n", $source);
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Extracts the documentation entries from source code.
+ *
+ * @static
+ * @memberOf Entry
+ * @param {String} $source The source code.
+ * @returns {Array} The array of entries.
+ */
+ public static function getEntries( $source ) {
+ preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*.+#', $source, $result);
+ return array_pop($result);
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Checks if the entry is a function reference.
+ *
+ * @private
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if the entry is a function reference, else `false`.
+ */
+ private function isFunction() {
+ if (!isset($this->_isFunction)) {
+ $this->_isFunction = !!(
+ $this->isCtor() ||
+ count($this->getParams()) ||
+ count($this->getReturns()) ||
+ preg_match('/\*[\t ]*@function\b/', $this->entry)
+ );
+ }
+ return $this->_isFunction;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Extracts the entry's `alias` objects.
+ *
+ * @memberOf Entry
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array|String} The entry's `alias` objects.
+ */
+ public function getAliases( $index = null ) {
+ if (!isset($this->_aliases)) {
+ preg_match('#\*[\t ]*@alias\s+(.+)#', $this->entry, $result);
+
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
+ $result = preg_split('/,\s*/', $result);
+ natsort($result);
+
+ foreach ($result as $resultIndex => $value) {
+ $result[$resultIndex] = new Alias($value, $this);
+ }
+ }
+ $this->_aliases = $result;
+ }
+ return $index !== null
+ ? @$this->_aliases[$index]
+ : $this->_aliases;
+ }
+
+ /**
+ * Extracts the function call from the entry.
+ *
+ * @memberOf Entry
+ * @returns {String} The function call.
+ */
+ public function getCall() {
+ if (isset($this->_call)) {
+ return $this->_call;
+ }
+
+ preg_match('#\*/\s*(?:function ([^(]*)|(.*?)(?=[:=,]|return\b))#', $this->entry, $result);
+ if ($result = array_pop($result)) {
+ $result = array_pop(explode('var ', trim(trim(array_pop(explode('.', $result))), "'")));
+ }
+ // resolve name
+ // avoid $this->getName() because it calls $this->getCall()
+ preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $name);
+ if (count($name)) {
+ $name = trim($name[1]);
+ } else {
+ $name = $result;
+ }
+ // compile function call syntax
+ if ($this->isFunction()) {
+ // compose parts
+ $result = array($result);
+ $params = $this->getParams();
+ foreach ($params as $param) {
+ $result[] = $param[1];
+ }
+ // format
+ $result = $name .'('. implode(array_slice($result, 1), ', ') .')';
+ $result = str_replace(', [', ' [, ', str_replace('], [', ', ', $result));
+ }
+
+ $this->_call = $result ? $result : $name;
+ return $this->_call;
+ }
+
+ /**
+ * Extracts the entry's `category` data.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's `category` data.
+ */
+ public function getCategory() {
+ if (isset($this->_category)) {
+ return $this->_category;
+ }
+
+ preg_match('#\*[\t ]*@category\s+(.+)#', $this->entry, $result);
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
+ } else {
+ $result = $this->getType() == 'Function' ? 'Methods' : 'Properties';
+ }
+ $this->_category = $result;
+ return $result;
+ }
+
+ /**
+ * Extracts the entry's description.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's description.
+ */
+ public function getDesc() {
+ if (isset($this->_desc)) {
+ return $this->_desc;
+ }
+
+ preg_match('#/\*\*(?:\s*\*)?([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
+ if (count($result)) {
+ $type = $this->getType();
+ $result = preg_replace('/:\n[\t ]*\*[\t ]*/', ":<br>\n", $result[1]);
+ $result = preg_replace('/(?:^|\n)[\t ]*\*\n[\t ]*\*[\t ]*/', "\n\n", $result);
+ $result = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result);
+ $result = trim($result);
+ $result = ($type == 'Function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result;
+ }
+ $this->_desc = $result;
+ return $result;
+ }
+
+ /**
+ * Extracts the entry's `example` data.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's `example` data.
+ */
+ public function getExample() {
+ if (isset($this->_example)) {
+ return $this->_example;
+ }
+
+ preg_match('#\*[\t ]*@example\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', "\n", $result[1]));
+ $result = '```' . $this->lang . "\n" . $result . "\n```";
+ }
+ $this->_example = $result;
+ return $result;
+ }
+
+ /**
+ * Checks if the entry is an alias.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `false`.
+ */
+ public function isAlias() {
+ return false;
+ }
+
+ /**
+ * Checks if the entry is a constructor.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if a constructor, else `false`.
+ */
+ public function isCtor() {
+ if (!isset($this->_isCtor)) {
+ $this->_isCtor = !!preg_match('/\*[\t ]*@constructor\b/', $this->entry);
+ }
+ return $this->_isCtor;
+ }
+
+ /**
+ * Checks if the entry is a license.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if a license, else `false`.
+ */
+ public function isLicense() {
+ if (!isset($this->_isLicense)) {
+ $this->_isLicense = !!preg_match('/\*[\t ]*@license\b/', $this->entry);
+ }
+ return $this->_isLicense;
+ }
+
+ /**
+ * Checks if the entry *is* assigned to a prototype.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if assigned to a prototype, else `false`.
+ */
+ public function isPlugin() {
+ if (!isset($this->_isPlugin)) {
+ $this->_isPlugin = !$this->isCtor() && !$this->isPrivate() && !$this->isStatic();
+ }
+ return $this->_isPlugin;
+ }
+
+ /**
+ * Checks if the entry is private.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if private, else `false`.
+ */
+ public function isPrivate() {
+ if (!isset($this->_isPrivate)) {
+ $this->_isPrivate = $this->isLicense() || !!preg_match('/\*[\t ]*@private\b/', $this->entry) || !preg_match('/\*[\t ]*@[a-z]+\b/', $this->entry);
+ }
+ return $this->_isPrivate;
+ }
+
+ /**
+ * Checks if the entry is *not* assigned to a prototype.
+ *
+ * @memberOf Entry
+ * @returns {Boolean} Returns `true` if not assigned to a prototype, else `false`.
+ */
+ public function isStatic() {
+ if (isset($this->_isStatic)) {
+ return $this->_isStatic;
+ }
+
+ $public = !$this->isPrivate();
+ $result = $public && !!preg_match('/\*[\t ]*@static\b/', $this->entry);
+
+ // set in cases where it isn't explicitly stated
+ if ($public && !$result) {
+ if ($parent = array_pop(preg_split('/[#.]/', $this->getMembers(0)))) {
+ foreach (Entry::getEntries($this->source) as $entry) {
+ $entry = new Entry($entry, $this->source);
+ if ($entry->getName() == $parent) {
+ $result = !$entry->isCtor();
+ break;
+ }
+ }
+ } else {
+ $result = true;
+ }
+ }
+ $this->_isStatic = $result;
+ return $result;
+ }
+
+ /**
+ * Resolves the entry's line number.
+ *
+ * @memberOf Entry
+ * @returns {Number} The entry's line number.
+ */
+ public function getLineNumber() {
+ if (!isset($this->_lineNumber)) {
+ preg_match_all('/\n/', substr($this->source, 0, strrpos($this->source, $this->entry) + strlen($this->entry)), $lines);
+ $this->_lineNumber = count(array_pop($lines)) + 1;
+ }
+ return $this->_lineNumber;
+ }
+
+ /**
+ * Extracts the entry's `member` data.
+ *
+ * @memberOf Entry
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array|String} The entry's `member` data.
+ */
+ public function getMembers( $index = null ) {
+ if (!isset($this->_members)) {
+ preg_match('#\*[\t ]*@member(?:Of)?\s+(.+)#', $this->entry, $result);
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
+ $result = preg_split('/,\s*/', $result);
+ natsort($result);
+ }
+ $this->_members = $result;
+ }
+ return $index !== null
+ ? @$this->_members[$index]
+ : $this->_members;
+ }
+
+ /**
+ * Extracts the entry's `name` data.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's `name` data.
+ */
+ public function getName() {
+ if (isset($this->_name)) {
+ return $this->_name;
+ }
+
+ preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $result);
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
+ } else {
+ $result = array_shift(explode('(', $this->getCall()));
+ }
+ $this->_name = $result;
+ return $result;
+ }
+
+ /**
+ * Extracts the entry's `param` data.
+ *
+ * @memberOf Entry
+ * @param {Number} $index The index of the array value to return.
+ * @returns {Array} The entry's `param` data.
+ */
+ public function getParams( $index = null ) {
+ if (!isset($this->_params)) {
+ preg_match_all('#\*[\t ]*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
+ if (count($result = array_filter(array_slice($result, 1)))) {
+ // repurpose array
+ foreach ($result as $param) {
+ foreach ($param as $key => $value) {
+ if (!is_array($result[0][$key])) {
+ $result[0][$key] = array();
+ }
+ $result[0][$key][] = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]*/', ' ', $value));
+ }
+ }
+ $result = $result[0];
+ }
+ $this->_params = $result;
+ }
+ return $index !== null
+ ? @$this->_params[$index]
+ : $this->_params;
+ }
+
+ /**
+ * Extracts the entry's `returns` data.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's `returns` data.
+ */
+ public function getReturns() {
+ if (isset($this->_returns)) {
+ return $this->_returns;
+ }
+
+ preg_match('#\*[\t ]*@returns\s+\{([^}]+)\}\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
+ if (count($result)) {
+ $result = array_map('trim', array_slice($result, 1));
+ $result[0] = str_replace('|', ', ', $result[0]);
+ $result[1] = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]);
+ }
+ $this->_returns = $result;
+ return $result;
+ }
+
+ /**
+ * Extracts the entry's `type` data.
+ *
+ * @memberOf Entry
+ * @returns {String} The entry's `type` data.
+ */
+ public function getType() {
+ if (isset($this->_type)) {
+ return $this->_type;
+ }
+
+ preg_match('#\*[\t ]*@type\s+(.+)#', $this->entry, $result);
+ if (count($result)) {
+ $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
+ } else {
+ $result = $this->isFunction() ? 'Function' : 'Unknown';
+ }
+ $this->_type = $result;
+ return $result;
+ }
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+require(dirname(__FILE__) . "/Entry.php");
+
+/**
+ * Generates Markdown from JSDoc entries.
+ */
+class Generator {
+
+ /**
+ * The HTML for the close tag.
+ *
+ * @static
+ * @memberOf Generator
+ * @type String
+ */
+ public $closeTag = "\n<!-- /div -->\n";
+
+ /**
+ * An array of JSDoc entries.
+ *
+ * @memberOf Generator
+ * @type Array
+ */
+ public $entries = array();
+
+ /**
+ * The HTML for the open tag.
+ *
+ * @static
+ * @memberOf Generator
+ * @type String
+ */
+ public $openTag = "\n<!-- div -->\n";
+
+ /**
+ * An options array used to configure the generator.
+ *
+ * @memberOf Generator
+ * @type Array
+ */
+ public $options = array();
+
+ /**
+ * The file's source code.
+ *
+ * @memberOf Generator
+ * @type String
+ */
+ public $source = '';
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The Generator constructor.
+ *
+ * @constructor
+ * @param {String} $source The source code to parse.
+ * @param {Array} $options The options array.
+ */
+ public function __construct( $source, $options = array() ) {
+ // juggle arguments
+ if (is_array($source)) {
+ $options = $source;
+ } else {
+ $options['source'] = $source;
+ }
+ if (isset($options['source']) && realpath($options['source'])) {
+ $options['path'] = $options['source'];
+ }
+ if (isset($options['path'])) {
+ preg_match('/(?<=\.)[a-z]+$/', $options['path'], $ext);
+ $options['source'] = file_get_contents($options['path']);
+ $ext = array_pop($ext);
+
+ if (!isset($options['lang']) && $ext) {
+ $options['lang'] = $ext;
+ }
+ if (!isset($options['title'])) {
+ $options['title'] = ucfirst(basename($options['path'])) . ' API documentation';
+ }
+ }
+ if (!isset($options['lang'])) {
+ $options['lang'] = 'js';
+ }
+ if (!isset($options['toc'])) {
+ $options['toc'] = 'properties';
+ }
+
+ $this->options = $options;
+ $this->source = str_replace(PHP_EOL, "\n", $options['source']);
+ $this->entries = Entry::getEntries($this->source);
+
+ foreach ($this->entries as $index => $value) {
+ $this->entries[$index] = new Entry($value, $this->source, $options['lang']);
+ }
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Performs common string formatting operations.
+ *
+ * @private
+ * @static
+ * @memberOf Generator
+ * @param {String} $string The string to format.
+ * @returns {String} The formatted string.
+ */
+ private static function format( $string ) {
+ $counter = 0;
+
+ // tokenize inline code snippets
+ preg_match_all('/`[^`]+`/', $string, $tokenized);
+ $tokenized = $tokenized[0];
+ foreach ($tokenized as $snippet) {
+ $string = str_replace($snippet, '__token' . ($counter++) .'__', $string);
+ }
+
+ // italicize parentheses
+ $string = preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*', $string);
+
+ // mark numbers as inline code
+ $string = preg_replace('/[\t ](-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string);
+
+ // detokenize inline code snippets
+ $counter = 0;
+ foreach ($tokenized as $snippet) {
+ $string = str_replace('__token' . ($counter++) . '__', $snippet, $string);
+ }
+
+ return trim($string);
+ }
+
+ /**
+ * Modify a string by replacing named tokens with matching assoc. array values.
+ *
+ * @private
+ * @static
+ * @memberOf Generator
+ * @param {String} $string The string to modify.
+ * @param {Array|Object} $object The template object.
+ * @returns {String} The modified string.
+ */
+ private static function interpolate( $string, $object ) {
+ preg_match_all('/#\{([^}]+)\}/', $string, $tokens);
+ $tokens = array_unique(array_pop($tokens));
+
+ foreach ($tokens as $token) {
+ $pattern = '/#\{' . $token . '\}/';
+ $replacement = '';
+
+ if (is_object($object)) {
+ preg_match('/\(([^)]+?)\)$/', $token, $args);
+ $args = preg_split('/,\s*/', array_pop($args));
+ $method = 'get' . ucfirst(str_replace('/\([^)]+?\)$/', '', $token));
+
+ if (method_exists($object, $method)) {
+ $replacement = (string) call_user_func_array(array($object, $method), $args);
+ } else if (isset($object->{$token})) {
+ $replacement = (string) $object->{$token};
+ }
+ } else if (isset($object[$token])) {
+ $replacement = (string) $object[$token];
+ }
+ $string = preg_replace($pattern, trim($replacement), $string);
+ }
+ return Generator::format($string);
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Adds the given `$entries` to the `$result` array.
+ *
+ * @private
+ * @memberOf Generator
+ * @param {Array} $result The result array to modify.
+ * @param {Array} $entries The entries to add to the `$result`.
+ */
+ private function addEntries( &$result, $entries ) {
+ foreach ($entries as $entry) {
+ // skip aliases
+ if ($entry->isAlias()) {
+ continue;
+ }
+ // name and description
+ array_push(
+ $result,
+ $this->openTag,
+ Generator::interpolate("### <a id=\"#{hash}\"></a>`#{member}#{separator}#{call}`\n<a href=\"##{hash}\">#</a> [Ⓢ](#{href} \"View in source\") [Ⓣ][1]\n\n#{desc}", $entry)
+ );
+
+ // @alias
+ if (count($aliases = $entry->getAliases())) {
+ array_push($result, '', '#### Aliases');
+ foreach ($aliases as $index => $alias) {
+ $aliases[$index] = $alias->getName();
+ }
+ $result[] = '*' . implode(', ', $aliases) . '*';
+ }
+ // @param
+ if (count($params = $entry->getParams())) {
+ array_push($result, '', '#### Arguments');
+ foreach ($params as $index => $param) {
+ $result[] = Generator::interpolate('#{num}. `#{name}` (#{type}): #{desc}', array(
+ 'desc' => $param[2],
+ 'name' => $param[1],
+ 'num' => $index + 1,
+ 'type' => $param[0]
+ ));
+ }
+ }
+ // @returns
+ if (count($returns = $entry->getReturns())) {
+ array_push(
+ $result, '',
+ '#### Returns',
+ Generator::interpolate('(#{type}): #{desc}', array('desc' => $returns[1], 'type' => $returns[0]))
+ );
+ }
+ // @example
+ if ($example = $entry->getExample()) {
+ array_push($result, '', '#### Example', $example);
+ }
+ array_push($result, "\n* * *", $this->closeTag);
+ }
+ }
+
+ /**
+ * Resolves the entry's hash used to navigate the documentation.
+ *
+ * @private
+ * @memberOf Generator
+ * @param {Number|Object} $entry The entry object.
+ * @param {String} $member The name of the member.
+ * @returns {String} The url hash.
+ */
+ private function getHash( $entry, $member = '' ) {
+ $entry = is_numeric($entry) ? $this->entries[$entry] : $entry;
+ $member = !$member ? $entry->getMembers(0) : $member;
+ $result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall();
+ $result = preg_replace('/\(\[|\[\]/', '', $result);
+ $result = preg_replace('/[ =|\'"{}.()\]]/', '', $result);
+ $result = preg_replace('/[[#,]/', '-', $result);
+ return strtolower($result);
+ }
+
+ /**
+ * Resolves the entry's url for the specific line number.
+ *
+ * @private
+ * @memberOf Generator
+ * @param {Number|Object} $entry The entry object.
+ * @returns {String} The url.
+ */
+ private function getLineUrl( $entry ) {
+ $entry = is_numeric($entry) ? $this->entries($entry) : $entry;
+ return $this->options['url'] . '#L' . $entry->getLineNumber();
+ }
+
+ /**
+ * Extracts the character used to separate the entry's name from its member.
+ *
+ * @private
+ * @memberOf Generator
+ * @param {Number|Object} $entry The entry object.
+ * @returns {String} The separator.
+ */
+ private function getSeparator( $entry ) {
+ $entry = is_numeric($entry) ? $this->entries($entry) : $entry;
+ return $entry->isPlugin() ? '.prototype.' : '.';
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Generates Markdown from JSDoc entries.
+ *
+ * @memberOf Generator
+ * @returns {String} The rendered Markdown.
+ */
+ public function generate() {
+ $api = array();
+ $byCategory = $this->options['toc'] == 'categories';
+ $categories = array();
+ $closeTag = $this->closeTag;
+ $compiling = false;
+ $openTag = $this->openTag;
+ $result = array('# ' . $this->options['title']);
+ $toc = 'toc';
+
+ // initialize $api array
+ foreach ($this->entries as $entry) {
+ // skip invalid or private entries
+ $name = $entry->getName();
+ if (!$name || $entry->isPrivate()) {
+ continue;
+ }
+
+ $members = $entry->getMembers();
+ $members = count($members) ? $members : array('');
+
+ foreach ($members as $member) {
+ // create api category arrays
+ if ($member && !isset($api[$member])) {
+ // create temporary entry to be replaced later
+ $api[$member] = new stdClass;
+ $api[$member]->static = array();
+ $api[$member]->plugin = array();
+ }
+
+ // append entry to api member
+ if (!$member || $entry->isCtor() || ($entry->getType() == 'Object' &&
+ !preg_match('/[=:]\s*(?:null|undefined)\s*[,;]?$/', $entry->entry))) {
+
+ // assign the real entry, replacing the temporary entry if it exist
+ $member = ($member ? $member . ($entry->isPlugin() ? '#' : '.') : '') . $name;
+ $entry->static = @$api[$member] ? $api[$member]->static : array();
+ $entry->plugin = @$api[$member] ? $api[$member]->plugin : array();
+
+ $api[$member] = $entry;
+ foreach ($entry->getAliases() as $alias) {
+ $api[$member]->static[] = $alias;
+ }
+ }
+ else if ($entry->isStatic()) {
+ $api[$member]->static[] = $entry;
+ foreach ($entry->getAliases() as $alias) {
+ $api[$member]->static[] = $alias;
+ }
+ }
+ else if (!$entry->isCtor()) {
+ $api[$member]->plugin[] = $entry;
+ foreach ($entry->getAliases() as $alias) {
+ $api[$member]->plugin[] = $alias;
+ }
+ }
+ }
+ }
+
+ // add properties to each entry
+ foreach ($api as $entry) {
+ $entry->hash = $this->getHash($entry);
+ $entry->href = $this->getLineUrl($entry);
+
+ $member = $entry->getMembers(0);
+ $member = ($member ? $member . ($entry->isPlugin() ? '.prototype.' : '.') : '') . $entry->getName();
+ $entry->member = preg_replace('/' . $entry->getName() . '$/', '', $member);
+
+ // add properties to static and plugin sub-entries
+ foreach (array('static', 'plugin') as $kind) {
+ foreach ($entry->{$kind} as $subentry) {
+ $subentry->hash = $this->getHash($subentry);
+ $subentry->href = $this->getLineUrl($subentry);
+ $subentry->member = $member;
+ $subentry->separator = $this->getSeparator($subentry);
+ }
+ }
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ // custom sort for root level entries
+ // TODO: see how well it handles deeper namespace traversal
+ function sortCompare($a, $b) {
+ $score = array( 'a' => 0, 'b' => 0);
+ foreach (array( 'a' => $a, 'b' => $b) as $key => $value) {
+ // capitalized properties are last
+ if (preg_match('/[#.][A-Z]/', $value)) {
+ $score[$key] = 0;
+ }
+ // lowercase prototype properties are next to last
+ else if (preg_match('/#[a-z]/', $value)) {
+ $score[$key] = 1;
+ }
+ // lowercase static properties next to first
+ else if (preg_match('/\.[a-z]/', $value)) {
+ $score[$key] = 2;
+ }
+ // root properties are first
+ else if (preg_match('/^[^#.]+$/', $value)) {
+ $score[$key] = 3;
+ }
+ }
+ $score = $score['b'] - $score['a'];
+ return $score ? $score : strcasecmp($a, $b);
+ }
+
+ uksort($api, 'sortCompare');
+
+ // sort static and plugin sub-entries
+ foreach ($api as $entry) {
+ foreach (array('static', 'plugin') as $kind) {
+ $sortBy = array( 'a' => array(), 'b' => array(), 'c' => array() );
+ foreach ($entry->{$kind} as $subentry) {
+ $name = $subentry->getName();
+ // functions w/o ALL-CAPs names are last
+ $sortBy['a'][] = $subentry->getType() == 'Function' && !preg_match('/^[A-Z_]+$/', $name);
+ // ALL-CAPs properties first
+ $sortBy['b'][] = preg_match('/^[A-Z_]+$/', $name);
+ // lowercase alphanumeric sort
+ $sortBy['c'][] = strtolower($name);
+ }
+ array_multisort($sortBy['a'], SORT_ASC, $sortBy['b'], SORT_DESC, $sortBy['c'], SORT_ASC, $entry->{$kind});
+ }
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ // add categories
+ foreach ($api as $entry) {
+ $categories[$entry->getCategory()][] = $entry;
+ foreach (array('static', 'plugin') as $kind) {
+ foreach ($entry->{$kind} as $subentry) {
+ $categories[$subentry->getCategory()][] = $subentry;
+ }
+ }
+ }
+
+ // sort categories
+ ksort($categories);
+
+ foreach(array('Methods', 'Properties') as $category) {
+ if (isset($categories[$category])) {
+ $entries = $categories[$category];
+ unset($categories[$category]);
+ $categories[$category] = $entries;
+ }
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ // compile TOC
+ $result[] = $openTag;
+
+ // compile TOC by categories
+ if ($byCategory) {
+ foreach ($categories as $category => $entries) {
+ if ($compiling) {
+ $result[] = $closeTag;
+ } else {
+ $compiling = true;
+ }
+ // assign TOC hash
+ if (count($result) == 2) {
+ $toc = $category;
+ }
+ // add category
+ array_push(
+ $result,
+ $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $category . '`'
+ );
+ // add entries
+ foreach ($entries as $entry) {
+ $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $entry);
+ }
+ }
+ }
+ // compile TOC by namespace
+ else {
+ foreach ($api as $entry) {
+ if ($compiling) {
+ $result[] = $closeTag;
+ } else {
+ $compiling = true;
+ }
+ $member = $entry->member . $entry->getName();
+
+ // assign TOC hash
+ if (count($result) == 2) {
+ $toc = $member;
+ }
+ // add root entry
+ array_push(
+ $result,
+ $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`',
+ Generator::interpolate('* [`' . $member . '`](##{hash})', $entry)
+ );
+
+ // add static and plugin sub-entries
+ foreach (array('static', 'plugin') as $kind) {
+ if ($kind == 'plugin' && count($entry->plugin)) {
+ array_push(
+ $result,
+ $closeTag,
+ $openTag,
+ '## `' . $member . ($entry->isCtor() ? '.prototype`' : '`')
+ );
+ }
+ foreach ($entry->{$kind} as $subentry) {
+ $subentry->member = $member;
+ $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $subentry);
+ }
+ }
+ }
+ }
+
+ array_push($result, $closeTag, $closeTag);
+
+ /*------------------------------------------------------------------------*/
+
+ // compile content
+ $compiling = false;
+ $result[] = $openTag;
+
+ if ($byCategory) {
+ foreach ($categories as $category => $entries) {
+ if ($compiling) {
+ $result[] = $closeTag;
+ } else {
+ $compiling = true;
+ }
+ if ($category != 'Methods' && $category != 'Properties') {
+ $category = '“' . $category . '” Methods';
+ }
+ array_push($result, $openTag, '## `' . $category . '`');
+ $this->addEntries($result, $entries);
+ }
+ }
+ else {
+ foreach ($api as $entry) {
+ // skip aliases
+ if ($entry->isAlias()) {
+ continue;
+ }
+ if ($compiling) {
+ $result[] = $closeTag;
+ } else {
+ $compiling = true;
+ }
+ // add root entry name
+ $member = $entry->member . $entry->getName();
+ array_push($result, $openTag, '## `' . $member . '`');
+
+ foreach (array($entry, 'static', 'plugin') as $kind) {
+ $subentries = is_string($kind) ? $entry->{$kind} : array($kind);
+
+ // add sub-entry name
+ if ($kind != 'static' && $entry->getType() != 'Object' &&
+ count($subentries) && $subentries[0] != $kind) {
+ if ($kind == 'plugin') {
+ $result[] = $closeTag;
+ }
+ array_push(
+ $result,
+ $openTag,
+ '## `' . $member . ($kind == 'plugin' ? '.prototype`' : '`')
+ );
+ }
+ $this->addEntries($result, $subentries);
+ }
+ }
+ }
+
+ // close tags add TOC link reference
+ array_push($result, $closeTag, $closeTag, '', ' [1]: #' . $toc . ' "Jump back to the TOC."');
+
+ // cleanup whitespace
+ return trim(preg_replace('/[\t ]+\n/', "\n", join($result, "\n")));
+ }
+}
+?>
--- /dev/null
+{
+ "author": {
+ "name": "Jeremy Stashewsky",
+ "email": "jeremy@goinstant.com",
+ "url": "https://github.com/stash"
+ },
+ "name": "tough-cookie",
+ "description": "RFC6265 Cookies and Cookie Jar for node.js",
+ "keywords": [
+ "HTTP",
+ "cookie",
+ "cookies",
+ "set-cookie",
+ "cookiejar",
+ "jar",
+ "RFC6265",
+ "RFC2965"
+ ],
+ "version": "0.9.15",
+ "homepage": "https://github.com/goinstant/node-cookie",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/goinstant/node-cookie.git"
+ },
+ "bugs": {
+ "url": "https://github.com/goinstant/node-cookie/issues"
+ },
+ "main": "./lib/cookie",
+ "scripts": {
+ "test": "vows test.js"
+ },
+ "engines": {
+ "node": ">=0.4.12"
+ },
+ "dependencies": {
+ "punycode": ">=0.2.0"
+ },
+ "devDependencies": {
+ "vows": ">=0.6.0",
+ "async": ">=0.1.12"
+ },
+ "readme": "[RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)\n\n# Synopsis\n\n``` javascript\nvar cookies = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'\nvar Cookie = cookies.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new cookies.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nRequires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n# API\n\ncookies\n=======\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\nparseDate(string[,strict])\n-----------------\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. If strict is set to true then leading/trailing non-seperator characters around the time part will cause the parsing to fail (e.g. \"Thu, 01 Jan 1970 00:00:010 GMT\" has an extra trailing zero but Chrome, an assumedly RFC-compliant browser, treats this as valid).\n\nformatDate(date)\n----------------\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\ncanonicalDomain(str)\n--------------------\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\ndomainMatch(str,domStr[,canonicalize=true])\n-------------------------------------------\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not.\n\ndefaultPath(path)\n-----------------\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\npathMatch(reqPath,cookiePath)\n-----------------------------\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\nparse(header[,strict=false])\n----------------------------\n\nalias for `Cookie.parse(header[,strict])`\n\nfromJSON(string)\n----------------\n\nalias for `Cookie.fromJSON(string)`\n\ngetPublicSuffix(hostname)\n-------------------------\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site.\n\ncookieCompare(a,b)\n------------------\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). Longest `.path`s go first, then sorted oldest to youngest.\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\npermuteDomain(domain)\n---------------------\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n\npermutePath(path)\n-----------------\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\nCookie\n======\n\nCookie.parse(header[,strict=false])\n-----------------------------------\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. If in strict mode, returns `undefined` if the cookie doesn't follow the guidelines in section 4 of RFC6265. Generally speaking, strict mode can be used to validate your own generated Set-Cookie headers, but acting as a client you want to be lenient and leave strict mode off.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\nCookie.fromJSON(string)\n-----------------------\n\nConvert a JSON string to a `Cookie` object. Does a `JSON.parse()` and converts the `.created`, `.lastAccessed` and `.expires` properties into `Date` objects.\n\nProperties\n==========\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n \nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _created_ - `Date` - when this cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\nConstruction([{options}])\n------------\n\nReceives an options object that can contain any Cookie properties, uses the default for unspecified properties.\n\n.toString()\n-----------\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n.cookieString()\n---------------\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n.setExpires(String)\n-------------------\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n.setMaxAge(number)\n-------------------\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n.expiryTime([now=Date.now()])\n-----------------------------\n\n.expiryDate([now=Date.now()])\n-----------------------------\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.created` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n.TTL([now=Date.now()])\n---------\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n.canonicalizedDoman()\n---------------------\n\n.cdomain()\n----------\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n.validate()\n-----------\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\nCookieJar\n=========\n\nConstruction([store = new MemoryCookieStore()][, rejectPublicSuffixes])\n------------\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\n\nAttributes\n----------\n\n * _rejectPublicSuffixes_ - boolean - reject cookies with domains like \"com\" and \"co.uk\" (default: `true`)\n \nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))\n-------------------------------------------------------------------\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.created`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _strict_ - boolean - default `false` - perform extra checks\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. CookieStore errors aren't ignored by this option.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n.storeCookie(cookie, [{options},] cb(err,cookie))\n-------------------------------------------------\n\n__REMOVED__ removed in lieu of the CookieStore API below\n \n.getCookies(currentUrl, [{options},] cb(err,cookies))\n-----------------------------------------------------\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the CookieStore `fetchCookies` function (the default MemoryCookieStore supports it).\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n.getCookieString(...)\n---------------------\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n.getSetCookieStrings(...)\n-------------------------\n\nAccepts the same options as `.getCookies()` but passes an array of strings suitable for Set-Cookie headers (rather than an array of `Cookie`s) to the callback. Simply maps the cookie array via `.toString()`.\n\n# CookieStore API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\nstore.findCookie(domain, path, key, cb(err,cookie))\n---------------------------------------------------\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\nstore.findCookies(domain, path, cb(err,cookies))\n------------------------------------------------\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\nstore.putCookie(cookie, cb(err))\n--------------------------------\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\nstore.updateCookie(oldCookie, newCookie, cb(err))\n-------------------------------------------------\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects and `.created` will always be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are sorted (or selected for deletion).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\nstore.removeCookie(domain, path, key, cb(err))\n----------------------------------------------\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\nstore.removeCookies(domain, path, cb(err))\n------------------------------------------\n\nRemoves matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n# TODO\n\n * _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`\n * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891\n * better tests for `validate()`?\n\n# Copyright and License\n\n(tl;dr: MIT with some MPL/1.1)\n\nCopyright GoInstant, Inc. and other contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\nPortions may be licensed under different licenses (in particular public-suffix.txt is MPL/1.1); please read the LICENSE file for full details.\n",
+ "readmeFilename": "README.md",
+ "_id": "tough-cookie@0.9.15",
+ "dist": {
+ "shasum": "c25ddc45f36a712a716b9c31af1c0dcc6b2b0091"
+ },
+ "_from": "tough-cookie@~0.9.15",
+ "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-0.9.15.tgz"
+}
--- /dev/null
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.1 (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.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+//
+// The Original Code is the Public Suffix List.
+//
+// The Initial Developer of the Original Code is
+// Jo Hermans <jo.hermans@gmail.com>.
+// Portions created by the Initial Developer are Copyright (C) 2007
+// the Initial Developer. All Rights Reserved.
+//
+// Contributor(s):
+// Ruben Arakelyan <ruben@rubenarakelyan.com>
+// Gervase Markham <gerv@gerv.net>
+// Pamela Greene <pamg.bugs@gmail.com>
+// David Triendl <david@triendl.name>
+// Jothan Frakes <jothan@gmail.com>
+// The kind representatives of many TLD registries
+//
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+//
+// ***** END LICENSE BLOCK *****
+
+// ===BEGIN ICANN DOMAINS===
+
+// ac : http://en.wikipedia.org/wiki/.ac
+ac
+com.ac
+edu.ac
+gov.ac
+net.ac
+mil.ac
+org.ac
+
+// ad : http://en.wikipedia.org/wiki/.ad
+ad
+nom.ad
+
+// ae : http://en.wikipedia.org/wiki/.ae
+// see also: "Domain Name Eligibility Policy" at http://www.aeda.ae/eng/aepolicy.php
+ae
+co.ae
+net.ae
+org.ae
+sch.ae
+ac.ae
+gov.ae
+mil.ae
+
+// aero : see http://www.information.aero/index.php?id=66
+aero
+accident-investigation.aero
+accident-prevention.aero
+aerobatic.aero
+aeroclub.aero
+aerodrome.aero
+agents.aero
+aircraft.aero
+airline.aero
+airport.aero
+air-surveillance.aero
+airtraffic.aero
+air-traffic-control.aero
+ambulance.aero
+amusement.aero
+association.aero
+author.aero
+ballooning.aero
+broker.aero
+caa.aero
+cargo.aero
+catering.aero
+certification.aero
+championship.aero
+charter.aero
+civilaviation.aero
+club.aero
+conference.aero
+consultant.aero
+consulting.aero
+control.aero
+council.aero
+crew.aero
+design.aero
+dgca.aero
+educator.aero
+emergency.aero
+engine.aero
+engineer.aero
+entertainment.aero
+equipment.aero
+exchange.aero
+express.aero
+federation.aero
+flight.aero
+freight.aero
+fuel.aero
+gliding.aero
+government.aero
+groundhandling.aero
+group.aero
+hanggliding.aero
+homebuilt.aero
+insurance.aero
+journal.aero
+journalist.aero
+leasing.aero
+logistics.aero
+magazine.aero
+maintenance.aero
+marketplace.aero
+media.aero
+microlight.aero
+modelling.aero
+navigation.aero
+parachuting.aero
+paragliding.aero
+passenger-association.aero
+pilot.aero
+press.aero
+production.aero
+recreation.aero
+repbody.aero
+res.aero
+research.aero
+rotorcraft.aero
+safety.aero
+scientist.aero
+services.aero
+show.aero
+skydiving.aero
+software.aero
+student.aero
+taxi.aero
+trader.aero
+trading.aero
+trainer.aero
+union.aero
+workinggroup.aero
+works.aero
+
+// af : http://www.nic.af/help.jsp
+af
+gov.af
+com.af
+org.af
+net.af
+edu.af
+
+// ag : http://www.nic.ag/prices.htm
+ag
+com.ag
+org.ag
+net.ag
+co.ag
+nom.ag
+
+// ai : http://nic.com.ai/
+ai
+off.ai
+com.ai
+net.ai
+org.ai
+
+// al : http://www.ert.gov.al/ert_alb/faq_det.html?Id=31
+al
+com.al
+edu.al
+gov.al
+mil.al
+net.al
+org.al
+
+// am : http://en.wikipedia.org/wiki/.am
+am
+
+// an : http://www.una.an/an_domreg/default.asp
+an
+com.an
+net.an
+org.an
+edu.an
+
+// ao : http://en.wikipedia.org/wiki/.ao
+// http://www.dns.ao/REGISTR.DOC
+ao
+ed.ao
+gv.ao
+og.ao
+co.ao
+pb.ao
+it.ao
+
+// aq : http://en.wikipedia.org/wiki/.aq
+aq
+
+// ar : http://en.wikipedia.org/wiki/.ar
+*.ar
+!congresodelalengua3.ar
+!educ.ar
+!gobiernoelectronico.ar
+!mecon.ar
+!nacion.ar
+!nic.ar
+!promocion.ar
+!retina.ar
+!uba.ar
+
+// arpa : http://en.wikipedia.org/wiki/.arpa
+// Confirmed by registry <iana-questions@icann.org> 2008-06-18
+e164.arpa
+in-addr.arpa
+ip6.arpa
+iris.arpa
+uri.arpa
+urn.arpa
+
+// as : http://en.wikipedia.org/wiki/.as
+as
+gov.as
+
+// asia : http://en.wikipedia.org/wiki/.asia
+asia
+
+// at : http://en.wikipedia.org/wiki/.at
+// Confirmed by registry <it@nic.at> 2008-06-17
+at
+ac.at
+co.at
+gv.at
+or.at
+
+// au : http://en.wikipedia.org/wiki/.au
+// http://www.auda.org.au/
+// 2LDs
+com.au
+net.au
+org.au
+edu.au
+gov.au
+csiro.au
+asn.au
+id.au
+// Historic 2LDs (closed to new registration, but sites still exist)
+info.au
+conf.au
+oz.au
+// CGDNs - http://www.cgdn.org.au/
+act.au
+nsw.au
+nt.au
+qld.au
+sa.au
+tas.au
+vic.au
+wa.au
+// 3LDs
+act.edu.au
+nsw.edu.au
+nt.edu.au
+qld.edu.au
+sa.edu.au
+tas.edu.au
+vic.edu.au
+wa.edu.au
+act.gov.au
+// Removed at request of Shae.Donelan@services.nsw.gov.au, 2010-03-04
+// nsw.gov.au
+nt.gov.au
+qld.gov.au
+sa.gov.au
+tas.gov.au
+vic.gov.au
+wa.gov.au
+
+// aw : http://en.wikipedia.org/wiki/.aw
+aw
+com.aw
+
+// ax : http://en.wikipedia.org/wiki/.ax
+ax
+
+// az : http://en.wikipedia.org/wiki/.az
+az
+com.az
+net.az
+int.az
+gov.az
+org.az
+edu.az
+info.az
+pp.az
+mil.az
+name.az
+pro.az
+biz.az
+
+// ba : http://en.wikipedia.org/wiki/.ba
+ba
+org.ba
+net.ba
+edu.ba
+gov.ba
+mil.ba
+unsa.ba
+unbi.ba
+co.ba
+com.ba
+rs.ba
+
+// bb : http://en.wikipedia.org/wiki/.bb
+bb
+biz.bb
+com.bb
+edu.bb
+gov.bb
+info.bb
+net.bb
+org.bb
+store.bb
+
+// bd : http://en.wikipedia.org/wiki/.bd
+*.bd
+
+// be : http://en.wikipedia.org/wiki/.be
+// Confirmed by registry <tech@dns.be> 2008-06-08
+be
+ac.be
+
+// bf : http://en.wikipedia.org/wiki/.bf
+bf
+gov.bf
+
+// bg : http://en.wikipedia.org/wiki/.bg
+// https://www.register.bg/user/static/rules/en/index.html
+bg
+a.bg
+b.bg
+c.bg
+d.bg
+e.bg
+f.bg
+g.bg
+h.bg
+i.bg
+j.bg
+k.bg
+l.bg
+m.bg
+n.bg
+o.bg
+p.bg
+q.bg
+r.bg
+s.bg
+t.bg
+u.bg
+v.bg
+w.bg
+x.bg
+y.bg
+z.bg
+0.bg
+1.bg
+2.bg
+3.bg
+4.bg
+5.bg
+6.bg
+7.bg
+8.bg
+9.bg
+
+// bh : http://en.wikipedia.org/wiki/.bh
+bh
+com.bh
+edu.bh
+net.bh
+org.bh
+gov.bh
+
+// bi : http://en.wikipedia.org/wiki/.bi
+// http://whois.nic.bi/
+bi
+co.bi
+com.bi
+edu.bi
+or.bi
+org.bi
+
+// biz : http://en.wikipedia.org/wiki/.biz
+biz
+
+// bj : http://en.wikipedia.org/wiki/.bj
+bj
+asso.bj
+barreau.bj
+gouv.bj
+
+// bm : http://www.bermudanic.bm/dnr-text.txt
+bm
+com.bm
+edu.bm
+gov.bm
+net.bm
+org.bm
+
+// bn : http://en.wikipedia.org/wiki/.bn
+*.bn
+
+// bo : http://www.nic.bo/
+bo
+com.bo
+edu.bo
+gov.bo
+gob.bo
+int.bo
+org.bo
+net.bo
+mil.bo
+tv.bo
+
+// br : http://registro.br/dominio/dpn.html
+// Updated by registry <fneves@registro.br> 2011-03-01
+br
+adm.br
+adv.br
+agr.br
+am.br
+arq.br
+art.br
+ato.br
+b.br
+bio.br
+blog.br
+bmd.br
+can.br
+cim.br
+cng.br
+cnt.br
+com.br
+coop.br
+ecn.br
+edu.br
+emp.br
+eng.br
+esp.br
+etc.br
+eti.br
+far.br
+flog.br
+fm.br
+fnd.br
+fot.br
+fst.br
+g12.br
+ggf.br
+gov.br
+imb.br
+ind.br
+inf.br
+jor.br
+jus.br
+lel.br
+mat.br
+med.br
+mil.br
+mus.br
+net.br
+nom.br
+not.br
+ntr.br
+odo.br
+org.br
+ppg.br
+pro.br
+psc.br
+psi.br
+qsl.br
+radio.br
+rec.br
+slg.br
+srv.br
+taxi.br
+teo.br
+tmp.br
+trd.br
+tur.br
+tv.br
+vet.br
+vlog.br
+wiki.br
+zlg.br
+
+// bs : http://www.nic.bs/rules.html
+bs
+com.bs
+net.bs
+org.bs
+edu.bs
+gov.bs
+
+// bt : http://en.wikipedia.org/wiki/.bt
+bt
+com.bt
+edu.bt
+gov.bt
+net.bt
+org.bt
+
+// bv : No registrations at this time.
+// Submitted by registry <jarle@uninett.no> 2006-06-16
+
+// bw : http://en.wikipedia.org/wiki/.bw
+// http://www.gobin.info/domainname/bw.doc
+// list of other 2nd level tlds ?
+bw
+co.bw
+org.bw
+
+// by : http://en.wikipedia.org/wiki/.by
+// http://tld.by/rules_2006_en.html
+// list of other 2nd level tlds ?
+by
+gov.by
+mil.by
+// Official information does not indicate that com.by is a reserved
+// second-level domain, but it's being used as one (see www.google.com.by and
+// www.yahoo.com.by, for example), so we list it here for safety's sake.
+com.by
+
+// http://hoster.by/
+of.by
+
+// bz : http://en.wikipedia.org/wiki/.bz
+// http://www.belizenic.bz/
+bz
+com.bz
+net.bz
+org.bz
+edu.bz
+gov.bz
+
+// ca : http://en.wikipedia.org/wiki/.ca
+ca
+// ca geographical names
+ab.ca
+bc.ca
+mb.ca
+nb.ca
+nf.ca
+nl.ca
+ns.ca
+nt.ca
+nu.ca
+on.ca
+pe.ca
+qc.ca
+sk.ca
+yk.ca
+// gc.ca: http://en.wikipedia.org/wiki/.gc.ca
+// see also: http://registry.gc.ca/en/SubdomainFAQ
+gc.ca
+
+// cat : http://en.wikipedia.org/wiki/.cat
+cat
+
+// cc : http://en.wikipedia.org/wiki/.cc
+cc
+
+// cd : http://en.wikipedia.org/wiki/.cd
+// see also: https://www.nic.cd/domain/insertDomain_2.jsp?act=1
+cd
+gov.cd
+
+// cf : http://en.wikipedia.org/wiki/.cf
+cf
+
+// cg : http://en.wikipedia.org/wiki/.cg
+cg
+
+// ch : http://en.wikipedia.org/wiki/.ch
+ch
+
+// ci : http://en.wikipedia.org/wiki/.ci
+// http://www.nic.ci/index.php?page=charte
+ci
+org.ci
+or.ci
+com.ci
+co.ci
+edu.ci
+ed.ci
+ac.ci
+net.ci
+go.ci
+asso.ci
+aéroport.ci
+int.ci
+presse.ci
+md.ci
+gouv.ci
+
+// ck : http://en.wikipedia.org/wiki/.ck
+*.ck
+!www.ck
+
+// cl : http://en.wikipedia.org/wiki/.cl
+cl
+gov.cl
+gob.cl
+co.cl
+mil.cl
+
+// cm : http://en.wikipedia.org/wiki/.cm
+cm
+gov.cm
+
+// cn : http://en.wikipedia.org/wiki/.cn
+// Submitted by registry <tanyaling@cnnic.cn> 2008-06-11
+cn
+ac.cn
+com.cn
+edu.cn
+gov.cn
+net.cn
+org.cn
+mil.cn
+公司.cn
+网络.cn
+網絡.cn
+// cn geographic names
+ah.cn
+bj.cn
+cq.cn
+fj.cn
+gd.cn
+gs.cn
+gz.cn
+gx.cn
+ha.cn
+hb.cn
+he.cn
+hi.cn
+hl.cn
+hn.cn
+jl.cn
+js.cn
+jx.cn
+ln.cn
+nm.cn
+nx.cn
+qh.cn
+sc.cn
+sd.cn
+sh.cn
+sn.cn
+sx.cn
+tj.cn
+xj.cn
+xz.cn
+yn.cn
+zj.cn
+hk.cn
+mo.cn
+tw.cn
+
+// co : http://en.wikipedia.org/wiki/.co
+// Submitted by registry <tecnico@uniandes.edu.co> 2008-06-11
+co
+arts.co
+com.co
+edu.co
+firm.co
+gov.co
+info.co
+int.co
+mil.co
+net.co
+nom.co
+org.co
+rec.co
+web.co
+
+// com : http://en.wikipedia.org/wiki/.com
+com
+
+// coop : http://en.wikipedia.org/wiki/.coop
+coop
+
+// cr : http://www.nic.cr/niccr_publico/showRegistroDominiosScreen.do
+cr
+ac.cr
+co.cr
+ed.cr
+fi.cr
+go.cr
+or.cr
+sa.cr
+
+// cu : http://en.wikipedia.org/wiki/.cu
+cu
+com.cu
+edu.cu
+org.cu
+net.cu
+gov.cu
+inf.cu
+
+// cv : http://en.wikipedia.org/wiki/.cv
+cv
+
+// cx : http://en.wikipedia.org/wiki/.cx
+// list of other 2nd level tlds ?
+cx
+gov.cx
+
+// cy : http://en.wikipedia.org/wiki/.cy
+*.cy
+
+// cz : http://en.wikipedia.org/wiki/.cz
+cz
+
+// de : http://en.wikipedia.org/wiki/.de
+// Confirmed by registry <ops@denic.de> (with technical
+// reservations) 2008-07-01
+de
+
+// dj : http://en.wikipedia.org/wiki/.dj
+dj
+
+// dk : http://en.wikipedia.org/wiki/.dk
+// Confirmed by registry <robert@dk-hostmaster.dk> 2008-06-17
+dk
+
+// dm : http://en.wikipedia.org/wiki/.dm
+dm
+com.dm
+net.dm
+org.dm
+edu.dm
+gov.dm
+
+// do : http://en.wikipedia.org/wiki/.do
+do
+art.do
+com.do
+edu.do
+gob.do
+gov.do
+mil.do
+net.do
+org.do
+sld.do
+web.do
+
+// dz : http://en.wikipedia.org/wiki/.dz
+dz
+com.dz
+org.dz
+net.dz
+gov.dz
+edu.dz
+asso.dz
+pol.dz
+art.dz
+
+// ec : http://www.nic.ec/reg/paso1.asp
+// Submitted by registry <vabboud@nic.ec> 2008-07-04
+ec
+com.ec
+info.ec
+net.ec
+fin.ec
+k12.ec
+med.ec
+pro.ec
+org.ec
+edu.ec
+gov.ec
+gob.ec
+mil.ec
+
+// edu : http://en.wikipedia.org/wiki/.edu
+edu
+
+// ee : http://www.eenet.ee/EENet/dom_reeglid.html#lisa_B
+ee
+edu.ee
+gov.ee
+riik.ee
+lib.ee
+med.ee
+com.ee
+pri.ee
+aip.ee
+org.ee
+fie.ee
+
+// eg : http://en.wikipedia.org/wiki/.eg
+eg
+com.eg
+edu.eg
+eun.eg
+gov.eg
+mil.eg
+name.eg
+net.eg
+org.eg
+sci.eg
+
+// er : http://en.wikipedia.org/wiki/.er
+*.er
+
+// es : https://www.nic.es/site_ingles/ingles/dominios/index.html
+es
+com.es
+nom.es
+org.es
+gob.es
+edu.es
+
+// et : http://en.wikipedia.org/wiki/.et
+*.et
+
+// eu : http://en.wikipedia.org/wiki/.eu
+eu
+
+// fi : http://en.wikipedia.org/wiki/.fi
+fi
+// aland.fi : http://en.wikipedia.org/wiki/.ax
+// This domain is being phased out in favor of .ax. As there are still many
+// domains under aland.fi, we still keep it on the list until aland.fi is
+// completely removed.
+// TODO: Check for updates (expected to be phased out around Q1/2009)
+aland.fi
+
+// fj : http://en.wikipedia.org/wiki/.fj
+*.fj
+
+// fk : http://en.wikipedia.org/wiki/.fk
+*.fk
+
+// fm : http://en.wikipedia.org/wiki/.fm
+fm
+
+// fo : http://en.wikipedia.org/wiki/.fo
+fo
+
+// fr : http://www.afnic.fr/
+// domaines descriptifs : http://www.afnic.fr/obtenir/chartes/nommage-fr/annexe-descriptifs
+fr
+com.fr
+asso.fr
+nom.fr
+prd.fr
+presse.fr
+tm.fr
+// domaines sectoriels : http://www.afnic.fr/obtenir/chartes/nommage-fr/annexe-sectoriels
+aeroport.fr
+assedic.fr
+avocat.fr
+avoues.fr
+cci.fr
+chambagri.fr
+chirurgiens-dentistes.fr
+experts-comptables.fr
+geometre-expert.fr
+gouv.fr
+greta.fr
+huissier-justice.fr
+medecin.fr
+notaires.fr
+pharmacien.fr
+port.fr
+veterinaire.fr
+
+// ga : http://en.wikipedia.org/wiki/.ga
+ga
+
+// gb : This registry is effectively dormant
+// Submitted by registry <Damien.Shaw@ja.net> 2008-06-12
+
+// gd : http://en.wikipedia.org/wiki/.gd
+gd
+
+// ge : http://www.nic.net.ge/policy_en.pdf
+ge
+com.ge
+edu.ge
+gov.ge
+org.ge
+mil.ge
+net.ge
+pvt.ge
+
+// gf : http://en.wikipedia.org/wiki/.gf
+gf
+
+// gg : http://www.channelisles.net/applic/avextn.shtml
+gg
+co.gg
+org.gg
+net.gg
+sch.gg
+gov.gg
+
+// gh : http://en.wikipedia.org/wiki/.gh
+// see also: http://www.nic.gh/reg_now.php
+// Although domains directly at second level are not possible at the moment,
+// they have been possible for some time and may come back.
+gh
+com.gh
+edu.gh
+gov.gh
+org.gh
+mil.gh
+
+// gi : http://www.nic.gi/rules.html
+gi
+com.gi
+ltd.gi
+gov.gi
+mod.gi
+edu.gi
+org.gi
+
+// gl : http://en.wikipedia.org/wiki/.gl
+// http://nic.gl
+gl
+
+// gm : http://www.nic.gm/htmlpages%5Cgm-policy.htm
+gm
+
+// gn : http://psg.com/dns/gn/gn.txt
+// Submitted by registry <randy@psg.com> 2008-06-17
+ac.gn
+com.gn
+edu.gn
+gov.gn
+org.gn
+net.gn
+
+// gov : http://en.wikipedia.org/wiki/.gov
+gov
+
+// gp : http://www.nic.gp/index.php?lang=en
+gp
+com.gp
+net.gp
+mobi.gp
+edu.gp
+org.gp
+asso.gp
+
+// gq : http://en.wikipedia.org/wiki/.gq
+gq
+
+// gr : https://grweb.ics.forth.gr/english/1617-B-2005.html
+// Submitted by registry <segred@ics.forth.gr> 2008-06-09
+gr
+com.gr
+edu.gr
+net.gr
+org.gr
+gov.gr
+
+// gs : http://en.wikipedia.org/wiki/.gs
+gs
+
+// gt : http://www.gt/politicas.html
+*.gt
+!www.gt
+
+// gu : http://gadao.gov.gu/registration.txt
+*.gu
+
+// gw : http://en.wikipedia.org/wiki/.gw
+gw
+
+// gy : http://en.wikipedia.org/wiki/.gy
+// http://registry.gy/
+gy
+co.gy
+com.gy
+net.gy
+
+// hk : https://www.hkdnr.hk
+// Submitted by registry <hk.tech@hkirc.hk> 2008-06-11
+hk
+com.hk
+edu.hk
+gov.hk
+idv.hk
+net.hk
+org.hk
+公司.hk
+教育.hk
+敎育.hk
+政府.hk
+個人.hk
+个人.hk
+箇人.hk
+網络.hk
+网络.hk
+组織.hk
+網絡.hk
+网絡.hk
+组织.hk
+組織.hk
+組织.hk
+
+// hm : http://en.wikipedia.org/wiki/.hm
+hm
+
+// hn : http://www.nic.hn/politicas/ps02,,05.html
+hn
+com.hn
+edu.hn
+org.hn
+net.hn
+mil.hn
+gob.hn
+
+// hr : http://www.dns.hr/documents/pdf/HRTLD-regulations.pdf
+hr
+iz.hr
+from.hr
+name.hr
+com.hr
+
+// ht : http://www.nic.ht/info/charte.cfm
+ht
+com.ht
+shop.ht
+firm.ht
+info.ht
+adult.ht
+net.ht
+pro.ht
+org.ht
+med.ht
+art.ht
+coop.ht
+pol.ht
+asso.ht
+edu.ht
+rel.ht
+gouv.ht
+perso.ht
+
+// hu : http://www.domain.hu/domain/English/sld.html
+// Confirmed by registry <pasztor@iszt.hu> 2008-06-12
+hu
+co.hu
+info.hu
+org.hu
+priv.hu
+sport.hu
+tm.hu
+2000.hu
+agrar.hu
+bolt.hu
+casino.hu
+city.hu
+erotica.hu
+erotika.hu
+film.hu
+forum.hu
+games.hu
+hotel.hu
+ingatlan.hu
+jogasz.hu
+konyvelo.hu
+lakas.hu
+media.hu
+news.hu
+reklam.hu
+sex.hu
+shop.hu
+suli.hu
+szex.hu
+tozsde.hu
+utazas.hu
+video.hu
+
+// id : http://en.wikipedia.org/wiki/.id
+// see also: https://register.pandi.or.id/
+id
+ac.id
+co.id
+go.id
+mil.id
+net.id
+or.id
+sch.id
+web.id
+
+// ie : http://en.wikipedia.org/wiki/.ie
+ie
+gov.ie
+
+// il : http://en.wikipedia.org/wiki/.il
+*.il
+
+// im : https://www.nic.im/pdfs/imfaqs.pdf
+im
+co.im
+ltd.co.im
+plc.co.im
+net.im
+gov.im
+org.im
+nic.im
+ac.im
+
+// in : http://en.wikipedia.org/wiki/.in
+// see also: http://www.inregistry.in/policies/
+// Please note, that nic.in is not an offical eTLD, but used by most
+// government institutions.
+in
+co.in
+firm.in
+net.in
+org.in
+gen.in
+ind.in
+nic.in
+ac.in
+edu.in
+res.in
+gov.in
+mil.in
+
+// info : http://en.wikipedia.org/wiki/.info
+info
+
+// int : http://en.wikipedia.org/wiki/.int
+// Confirmed by registry <iana-questions@icann.org> 2008-06-18
+int
+eu.int
+
+// io : http://www.nic.io/rules.html
+// list of other 2nd level tlds ?
+io
+com.io
+
+// iq : http://www.cmc.iq/english/iq/iqregister1.htm
+iq
+gov.iq
+edu.iq
+mil.iq
+com.iq
+org.iq
+net.iq
+
+// ir : http://www.nic.ir/Terms_and_Conditions_ir,_Appendix_1_Domain_Rules
+// Also see http://www.nic.ir/Internationalized_Domain_Names
+// Two <iran>.ir entries added at request of <tech-team@nic.ir>, 2010-04-16
+ir
+ac.ir
+co.ir
+gov.ir
+id.ir
+net.ir
+org.ir
+sch.ir
+// xn--mgba3a4f16a.ir (<iran>.ir, Persian YEH)
+ایران.ir
+// xn--mgba3a4fra.ir (<iran>.ir, Arabic YEH)
+ايران.ir
+
+// is : http://www.isnic.is/domain/rules.php
+// Confirmed by registry <marius@isgate.is> 2008-12-06
+is
+net.is
+com.is
+edu.is
+gov.is
+org.is
+int.is
+
+// it : http://en.wikipedia.org/wiki/.it
+it
+gov.it
+edu.it
+// list of reserved geo-names :
+// http://www.nic.it/documenti/regolamenti-e-linee-guida/regolamento-assegnazione-versione-6.0.pdf
+// (There is also a list of reserved geo-names corresponding to Italian
+// municipalities : http://www.nic.it/documenti/appendice-c.pdf , but it is
+// not included here.)
+agrigento.it
+ag.it
+alessandria.it
+al.it
+ancona.it
+an.it
+aosta.it
+aoste.it
+ao.it
+arezzo.it
+ar.it
+ascoli-piceno.it
+ascolipiceno.it
+ap.it
+asti.it
+at.it
+avellino.it
+av.it
+bari.it
+ba.it
+andria-barletta-trani.it
+andriabarlettatrani.it
+trani-barletta-andria.it
+tranibarlettaandria.it
+barletta-trani-andria.it
+barlettatraniandria.it
+andria-trani-barletta.it
+andriatranibarletta.it
+trani-andria-barletta.it
+traniandriabarletta.it
+bt.it
+belluno.it
+bl.it
+benevento.it
+bn.it
+bergamo.it
+bg.it
+biella.it
+bi.it
+bologna.it
+bo.it
+bolzano.it
+bozen.it
+balsan.it
+alto-adige.it
+altoadige.it
+suedtirol.it
+bz.it
+brescia.it
+bs.it
+brindisi.it
+br.it
+cagliari.it
+ca.it
+caltanissetta.it
+cl.it
+campobasso.it
+cb.it
+carboniaiglesias.it
+carbonia-iglesias.it
+iglesias-carbonia.it
+iglesiascarbonia.it
+ci.it
+caserta.it
+ce.it
+catania.it
+ct.it
+catanzaro.it
+cz.it
+chieti.it
+ch.it
+como.it
+co.it
+cosenza.it
+cs.it
+cremona.it
+cr.it
+crotone.it
+kr.it
+cuneo.it
+cn.it
+dell-ogliastra.it
+dellogliastra.it
+ogliastra.it
+og.it
+enna.it
+en.it
+ferrara.it
+fe.it
+fermo.it
+fm.it
+firenze.it
+florence.it
+fi.it
+foggia.it
+fg.it
+forli-cesena.it
+forlicesena.it
+cesena-forli.it
+cesenaforli.it
+fc.it
+frosinone.it
+fr.it
+genova.it
+genoa.it
+ge.it
+gorizia.it
+go.it
+grosseto.it
+gr.it
+imperia.it
+im.it
+isernia.it
+is.it
+laquila.it
+aquila.it
+aq.it
+la-spezia.it
+laspezia.it
+sp.it
+latina.it
+lt.it
+lecce.it
+le.it
+lecco.it
+lc.it
+livorno.it
+li.it
+lodi.it
+lo.it
+lucca.it
+lu.it
+macerata.it
+mc.it
+mantova.it
+mn.it
+massa-carrara.it
+massacarrara.it
+carrara-massa.it
+carraramassa.it
+ms.it
+matera.it
+mt.it
+medio-campidano.it
+mediocampidano.it
+campidano-medio.it
+campidanomedio.it
+vs.it
+messina.it
+me.it
+milano.it
+milan.it
+mi.it
+modena.it
+mo.it
+monza.it
+monza-brianza.it
+monzabrianza.it
+monzaebrianza.it
+monzaedellabrianza.it
+monza-e-della-brianza.it
+mb.it
+napoli.it
+naples.it
+na.it
+novara.it
+no.it
+nuoro.it
+nu.it
+oristano.it
+or.it
+padova.it
+padua.it
+pd.it
+palermo.it
+pa.it
+parma.it
+pr.it
+pavia.it
+pv.it
+perugia.it
+pg.it
+pescara.it
+pe.it
+pesaro-urbino.it
+pesarourbino.it
+urbino-pesaro.it
+urbinopesaro.it
+pu.it
+piacenza.it
+pc.it
+pisa.it
+pi.it
+pistoia.it
+pt.it
+pordenone.it
+pn.it
+potenza.it
+pz.it
+prato.it
+po.it
+ragusa.it
+rg.it
+ravenna.it
+ra.it
+reggio-calabria.it
+reggiocalabria.it
+rc.it
+reggio-emilia.it
+reggioemilia.it
+re.it
+rieti.it
+ri.it
+rimini.it
+rn.it
+roma.it
+rome.it
+rm.it
+rovigo.it
+ro.it
+salerno.it
+sa.it
+sassari.it
+ss.it
+savona.it
+sv.it
+siena.it
+si.it
+siracusa.it
+sr.it
+sondrio.it
+so.it
+taranto.it
+ta.it
+tempio-olbia.it
+tempioolbia.it
+olbia-tempio.it
+olbiatempio.it
+ot.it
+teramo.it
+te.it
+terni.it
+tr.it
+torino.it
+turin.it
+to.it
+trapani.it
+tp.it
+trento.it
+trentino.it
+tn.it
+treviso.it
+tv.it
+trieste.it
+ts.it
+udine.it
+ud.it
+varese.it
+va.it
+venezia.it
+venice.it
+ve.it
+verbania.it
+vb.it
+vercelli.it
+vc.it
+verona.it
+vr.it
+vibo-valentia.it
+vibovalentia.it
+vv.it
+vicenza.it
+vi.it
+viterbo.it
+vt.it
+
+// je : http://www.channelisles.net/applic/avextn.shtml
+je
+co.je
+org.je
+net.je
+sch.je
+gov.je
+
+// jm : http://www.com.jm/register.html
+*.jm
+
+// jo : http://www.dns.jo/Registration_policy.aspx
+jo
+com.jo
+org.jo
+net.jo
+edu.jo
+sch.jo
+gov.jo
+mil.jo
+name.jo
+
+// jobs : http://en.wikipedia.org/wiki/.jobs
+jobs
+
+// jp : http://en.wikipedia.org/wiki/.jp
+// http://jprs.co.jp/en/jpdomain.html
+// Submitted by registry <yone@jprs.co.jp> 2008-06-11
+// Updated by registry <yone@jprs.co.jp> 2008-12-04
+jp
+// jp organizational type names
+ac.jp
+ad.jp
+co.jp
+ed.jp
+go.jp
+gr.jp
+lg.jp
+ne.jp
+or.jp
+// jp geographic type names
+// http://jprs.jp/doc/rule/saisoku-1.html
+*.aichi.jp
+*.akita.jp
+*.aomori.jp
+*.chiba.jp
+*.ehime.jp
+*.fukui.jp
+*.fukuoka.jp
+*.fukushima.jp
+*.gifu.jp
+*.gunma.jp
+*.hiroshima.jp
+*.hokkaido.jp
+*.hyogo.jp
+*.ibaraki.jp
+*.ishikawa.jp
+*.iwate.jp
+*.kagawa.jp
+*.kagoshima.jp
+*.kanagawa.jp
+*.kawasaki.jp
+*.kitakyushu.jp
+*.kobe.jp
+*.kochi.jp
+*.kumamoto.jp
+*.kyoto.jp
+*.mie.jp
+*.miyagi.jp
+*.miyazaki.jp
+*.nagano.jp
+*.nagasaki.jp
+*.nagoya.jp
+*.nara.jp
+*.niigata.jp
+*.oita.jp
+*.okayama.jp
+*.okinawa.jp
+*.osaka.jp
+*.saga.jp
+*.saitama.jp
+*.sapporo.jp
+*.sendai.jp
+*.shiga.jp
+*.shimane.jp
+*.shizuoka.jp
+*.tochigi.jp
+*.tokushima.jp
+*.tokyo.jp
+*.tottori.jp
+*.toyama.jp
+*.wakayama.jp
+*.yamagata.jp
+*.yamaguchi.jp
+*.yamanashi.jp
+*.yokohama.jp
+!metro.tokyo.jp
+!pref.aichi.jp
+!pref.akita.jp
+!pref.aomori.jp
+!pref.chiba.jp
+!pref.ehime.jp
+!pref.fukui.jp
+!pref.fukuoka.jp
+!pref.fukushima.jp
+!pref.gifu.jp
+!pref.gunma.jp
+!pref.hiroshima.jp
+!pref.hokkaido.jp
+!pref.hyogo.jp
+!pref.ibaraki.jp
+!pref.ishikawa.jp
+!pref.iwate.jp
+!pref.kagawa.jp
+!pref.kagoshima.jp
+!pref.kanagawa.jp
+!pref.kochi.jp
+!pref.kumamoto.jp
+!pref.kyoto.jp
+!pref.mie.jp
+!pref.miyagi.jp
+!pref.miyazaki.jp
+!pref.nagano.jp
+!pref.nagasaki.jp
+!pref.nara.jp
+!pref.niigata.jp
+!pref.oita.jp
+!pref.okayama.jp
+!pref.okinawa.jp
+!pref.osaka.jp
+!pref.saga.jp
+!pref.saitama.jp
+!pref.shiga.jp
+!pref.shimane.jp
+!pref.shizuoka.jp
+!pref.tochigi.jp
+!pref.tokushima.jp
+!pref.tottori.jp
+!pref.toyama.jp
+!pref.wakayama.jp
+!pref.yamagata.jp
+!pref.yamaguchi.jp
+!pref.yamanashi.jp
+!city.chiba.jp
+!city.fukuoka.jp
+!city.hiroshima.jp
+!city.kawasaki.jp
+!city.kitakyushu.jp
+!city.kobe.jp
+!city.kyoto.jp
+!city.nagoya.jp
+!city.niigata.jp
+!city.okayama.jp
+!city.osaka.jp
+!city.saitama.jp
+!city.sapporo.jp
+!city.sendai.jp
+!city.shizuoka.jp
+!city.yokohama.jp
+
+// ke : http://www.kenic.or.ke/index.php?option=com_content&task=view&id=117&Itemid=145
+*.ke
+
+// kg : http://www.domain.kg/dmn_n.html
+kg
+org.kg
+net.kg
+com.kg
+edu.kg
+gov.kg
+mil.kg
+
+// kh : http://www.mptc.gov.kh/dns_registration.htm
+*.kh
+
+// ki : http://www.ki/dns/index.html
+ki
+edu.ki
+biz.ki
+net.ki
+org.ki
+gov.ki
+info.ki
+com.ki
+
+// km : http://en.wikipedia.org/wiki/.km
+// http://www.domaine.km/documents/charte.doc
+km
+org.km
+nom.km
+gov.km
+prd.km
+tm.km
+edu.km
+mil.km
+ass.km
+com.km
+// These are only mentioned as proposed suggestions at domaine.km, but
+// http://en.wikipedia.org/wiki/.km says they're available for registration:
+coop.km
+asso.km
+presse.km
+medecin.km
+notaires.km
+pharmaciens.km
+veterinaire.km
+gouv.km
+
+// kn : http://en.wikipedia.org/wiki/.kn
+// http://www.dot.kn/domainRules.html
+kn
+net.kn
+org.kn
+edu.kn
+gov.kn
+
+// kp : http://www.kcce.kp/en_index.php
+com.kp
+edu.kp
+gov.kp
+org.kp
+rep.kp
+tra.kp
+
+// kr : http://en.wikipedia.org/wiki/.kr
+// see also: http://domain.nida.or.kr/eng/registration.jsp
+kr
+ac.kr
+co.kr
+es.kr
+go.kr
+hs.kr
+kg.kr
+mil.kr
+ms.kr
+ne.kr
+or.kr
+pe.kr
+re.kr
+sc.kr
+// kr geographical names
+busan.kr
+chungbuk.kr
+chungnam.kr
+daegu.kr
+daejeon.kr
+gangwon.kr
+gwangju.kr
+gyeongbuk.kr
+gyeonggi.kr
+gyeongnam.kr
+incheon.kr
+jeju.kr
+jeonbuk.kr
+jeonnam.kr
+seoul.kr
+ulsan.kr
+
+// kw : http://en.wikipedia.org/wiki/.kw
+*.kw
+
+// ky : http://www.icta.ky/da_ky_reg_dom.php
+// Confirmed by registry <kysupport@perimeterusa.com> 2008-06-17
+ky
+edu.ky
+gov.ky
+com.ky
+org.ky
+net.ky
+
+// kz : http://en.wikipedia.org/wiki/.kz
+// see also: http://www.nic.kz/rules/index.jsp
+kz
+org.kz
+edu.kz
+net.kz
+gov.kz
+mil.kz
+com.kz
+
+// la : http://en.wikipedia.org/wiki/.la
+// Submitted by registry <gavin.brown@nic.la> 2008-06-10
+la
+int.la
+net.la
+info.la
+edu.la
+gov.la
+per.la
+com.la
+org.la
+
+// lb : http://en.wikipedia.org/wiki/.lb
+// Submitted by registry <randy@psg.com> 2008-06-17
+com.lb
+edu.lb
+gov.lb
+net.lb
+org.lb
+
+// lc : http://en.wikipedia.org/wiki/.lc
+// see also: http://www.nic.lc/rules.htm
+lc
+com.lc
+net.lc
+co.lc
+org.lc
+edu.lc
+gov.lc
+
+// li : http://en.wikipedia.org/wiki/.li
+li
+
+// lk : http://www.nic.lk/seclevpr.html
+lk
+gov.lk
+sch.lk
+net.lk
+int.lk
+com.lk
+org.lk
+edu.lk
+ngo.lk
+soc.lk
+web.lk
+ltd.lk
+assn.lk
+grp.lk
+hotel.lk
+
+// lr : http://psg.com/dns/lr/lr.txt
+// Submitted by registry <randy@psg.com> 2008-06-17
+com.lr
+edu.lr
+gov.lr
+org.lr
+net.lr
+
+// ls : http://en.wikipedia.org/wiki/.ls
+ls
+co.ls
+org.ls
+
+// lt : http://en.wikipedia.org/wiki/.lt
+lt
+// gov.lt : http://www.gov.lt/index_en.php
+gov.lt
+
+// lu : http://www.dns.lu/en/
+lu
+
+// lv : http://www.nic.lv/DNS/En/generic.php
+lv
+com.lv
+edu.lv
+gov.lv
+org.lv
+mil.lv
+id.lv
+net.lv
+asn.lv
+conf.lv
+
+// ly : http://www.nic.ly/regulations.php
+ly
+com.ly
+net.ly
+gov.ly
+plc.ly
+edu.ly
+sch.ly
+med.ly
+org.ly
+id.ly
+
+// ma : http://en.wikipedia.org/wiki/.ma
+// http://www.anrt.ma/fr/admin/download/upload/file_fr782.pdf
+ma
+co.ma
+net.ma
+gov.ma
+org.ma
+ac.ma
+press.ma
+
+// mc : http://www.nic.mc/
+mc
+tm.mc
+asso.mc
+
+// md : http://en.wikipedia.org/wiki/.md
+md
+
+// me : http://en.wikipedia.org/wiki/.me
+me
+co.me
+net.me
+org.me
+edu.me
+ac.me
+gov.me
+its.me
+priv.me
+
+// mg : http://www.nic.mg/tarif.htm
+mg
+org.mg
+nom.mg
+gov.mg
+prd.mg
+tm.mg
+edu.mg
+mil.mg
+com.mg
+
+// mh : http://en.wikipedia.org/wiki/.mh
+mh
+
+// mil : http://en.wikipedia.org/wiki/.mil
+mil
+
+// mk : http://en.wikipedia.org/wiki/.mk
+// see also: http://dns.marnet.net.mk/postapka.php
+mk
+com.mk
+org.mk
+net.mk
+edu.mk
+gov.mk
+inf.mk
+name.mk
+
+// ml : http://www.gobin.info/domainname/ml-template.doc
+// see also: http://en.wikipedia.org/wiki/.ml
+ml
+com.ml
+edu.ml
+gouv.ml
+gov.ml
+net.ml
+org.ml
+presse.ml
+
+// mm : http://en.wikipedia.org/wiki/.mm
+*.mm
+
+// mn : http://en.wikipedia.org/wiki/.mn
+mn
+gov.mn
+edu.mn
+org.mn
+
+// mo : http://www.monic.net.mo/
+mo
+com.mo
+net.mo
+org.mo
+edu.mo
+gov.mo
+
+// mobi : http://en.wikipedia.org/wiki/.mobi
+mobi
+
+// mp : http://www.dot.mp/
+// Confirmed by registry <dcamacho@saipan.com> 2008-06-17
+mp
+
+// mq : http://en.wikipedia.org/wiki/.mq
+mq
+
+// mr : http://en.wikipedia.org/wiki/.mr
+mr
+gov.mr
+
+// ms : http://en.wikipedia.org/wiki/.ms
+ms
+
+// mt : https://www.nic.org.mt/dotmt/
+*.mt
+
+// mu : http://en.wikipedia.org/wiki/.mu
+mu
+com.mu
+net.mu
+org.mu
+gov.mu
+ac.mu
+co.mu
+or.mu
+
+// museum : http://about.museum/naming/
+// http://index.museum/
+museum
+academy.museum
+agriculture.museum
+air.museum
+airguard.museum
+alabama.museum
+alaska.museum
+amber.museum
+ambulance.museum
+american.museum
+americana.museum
+americanantiques.museum
+americanart.museum
+amsterdam.museum
+and.museum
+annefrank.museum
+anthro.museum
+anthropology.museum
+antiques.museum
+aquarium.museum
+arboretum.museum
+archaeological.museum
+archaeology.museum
+architecture.museum
+art.museum
+artanddesign.museum
+artcenter.museum
+artdeco.museum
+arteducation.museum
+artgallery.museum
+arts.museum
+artsandcrafts.museum
+asmatart.museum
+assassination.museum
+assisi.museum
+association.museum
+astronomy.museum
+atlanta.museum
+austin.museum
+australia.museum
+automotive.museum
+aviation.museum
+axis.museum
+badajoz.museum
+baghdad.museum
+bahn.museum
+bale.museum
+baltimore.museum
+barcelona.museum
+baseball.museum
+basel.museum
+baths.museum
+bauern.museum
+beauxarts.museum
+beeldengeluid.museum
+bellevue.museum
+bergbau.museum
+berkeley.museum
+berlin.museum
+bern.museum
+bible.museum
+bilbao.museum
+bill.museum
+birdart.museum
+birthplace.museum
+bonn.museum
+boston.museum
+botanical.museum
+botanicalgarden.museum
+botanicgarden.museum
+botany.museum
+brandywinevalley.museum
+brasil.museum
+bristol.museum
+british.museum
+britishcolumbia.museum
+broadcast.museum
+brunel.museum
+brussel.museum
+brussels.museum
+bruxelles.museum
+building.museum
+burghof.museum
+bus.museum
+bushey.museum
+cadaques.museum
+california.museum
+cambridge.museum
+can.museum
+canada.museum
+capebreton.museum
+carrier.museum
+cartoonart.museum
+casadelamoneda.museum
+castle.museum
+castres.museum
+celtic.museum
+center.museum
+chattanooga.museum
+cheltenham.museum
+chesapeakebay.museum
+chicago.museum
+children.museum
+childrens.museum
+childrensgarden.museum
+chiropractic.museum
+chocolate.museum
+christiansburg.museum
+cincinnati.museum
+cinema.museum
+circus.museum
+civilisation.museum
+civilization.museum
+civilwar.museum
+clinton.museum
+clock.museum
+coal.museum
+coastaldefence.museum
+cody.museum
+coldwar.museum
+collection.museum
+colonialwilliamsburg.museum
+coloradoplateau.museum
+columbia.museum
+columbus.museum
+communication.museum
+communications.museum
+community.museum
+computer.museum
+computerhistory.museum
+comunicações.museum
+contemporary.museum
+contemporaryart.museum
+convent.museum
+copenhagen.museum
+corporation.museum
+correios-e-telecomunicações.museum
+corvette.museum
+costume.museum
+countryestate.museum
+county.museum
+crafts.museum
+cranbrook.museum
+creation.museum
+cultural.museum
+culturalcenter.museum
+culture.museum
+cyber.museum
+cymru.museum
+dali.museum
+dallas.museum
+database.museum
+ddr.museum
+decorativearts.museum
+delaware.museum
+delmenhorst.museum
+denmark.museum
+depot.museum
+design.museum
+detroit.museum
+dinosaur.museum
+discovery.museum
+dolls.museum
+donostia.museum
+durham.museum
+eastafrica.museum
+eastcoast.museum
+education.museum
+educational.museum
+egyptian.museum
+eisenbahn.museum
+elburg.museum
+elvendrell.museum
+embroidery.museum
+encyclopedic.museum
+england.museum
+entomology.museum
+environment.museum
+environmentalconservation.museum
+epilepsy.museum
+essex.museum
+estate.museum
+ethnology.museum
+exeter.museum
+exhibition.museum
+family.museum
+farm.museum
+farmequipment.museum
+farmers.museum
+farmstead.museum
+field.museum
+figueres.museum
+filatelia.museum
+film.museum
+fineart.museum
+finearts.museum
+finland.museum
+flanders.museum
+florida.museum
+force.museum
+fortmissoula.museum
+fortworth.museum
+foundation.museum
+francaise.museum
+frankfurt.museum
+franziskaner.museum
+freemasonry.museum
+freiburg.museum
+fribourg.museum
+frog.museum
+fundacio.museum
+furniture.museum
+gallery.museum
+garden.museum
+gateway.museum
+geelvinck.museum
+gemological.museum
+geology.museum
+georgia.museum
+giessen.museum
+glas.museum
+glass.museum
+gorge.museum
+grandrapids.museum
+graz.museum
+guernsey.museum
+halloffame.museum
+hamburg.museum
+handson.museum
+harvestcelebration.museum
+hawaii.museum
+health.museum
+heimatunduhren.museum
+hellas.museum
+helsinki.museum
+hembygdsforbund.museum
+heritage.museum
+histoire.museum
+historical.museum
+historicalsociety.museum
+historichouses.museum
+historisch.museum
+historisches.museum
+history.museum
+historyofscience.museum
+horology.museum
+house.museum
+humanities.museum
+illustration.museum
+imageandsound.museum
+indian.museum
+indiana.museum
+indianapolis.museum
+indianmarket.museum
+intelligence.museum
+interactive.museum
+iraq.museum
+iron.museum
+isleofman.museum
+jamison.museum
+jefferson.museum
+jerusalem.museum
+jewelry.museum
+jewish.museum
+jewishart.museum
+jfk.museum
+journalism.museum
+judaica.museum
+judygarland.museum
+juedisches.museum
+juif.museum
+karate.museum
+karikatur.museum
+kids.museum
+koebenhavn.museum
+koeln.museum
+kunst.museum
+kunstsammlung.museum
+kunstunddesign.museum
+labor.museum
+labour.museum
+lajolla.museum
+lancashire.museum
+landes.museum
+lans.museum
+läns.museum
+larsson.museum
+lewismiller.museum
+lincoln.museum
+linz.museum
+living.museum
+livinghistory.museum
+localhistory.museum
+london.museum
+losangeles.museum
+louvre.museum
+loyalist.museum
+lucerne.museum
+luxembourg.museum
+luzern.museum
+mad.museum
+madrid.museum
+mallorca.museum
+manchester.museum
+mansion.museum
+mansions.museum
+manx.museum
+marburg.museum
+maritime.museum
+maritimo.museum
+maryland.museum
+marylhurst.museum
+media.museum
+medical.museum
+medizinhistorisches.museum
+meeres.museum
+memorial.museum
+mesaverde.museum
+michigan.museum
+midatlantic.museum
+military.museum
+mill.museum
+miners.museum
+mining.museum
+minnesota.museum
+missile.museum
+missoula.museum
+modern.museum
+moma.museum
+money.museum
+monmouth.museum
+monticello.museum
+montreal.museum
+moscow.museum
+motorcycle.museum
+muenchen.museum
+muenster.museum
+mulhouse.museum
+muncie.museum
+museet.museum
+museumcenter.museum
+museumvereniging.museum
+music.museum
+national.museum
+nationalfirearms.museum
+nationalheritage.museum
+nativeamerican.museum
+naturalhistory.museum
+naturalhistorymuseum.museum
+naturalsciences.museum
+nature.museum
+naturhistorisches.museum
+natuurwetenschappen.museum
+naumburg.museum
+naval.museum
+nebraska.museum
+neues.museum
+newhampshire.museum
+newjersey.museum
+newmexico.museum
+newport.museum
+newspaper.museum
+newyork.museum
+niepce.museum
+norfolk.museum
+north.museum
+nrw.museum
+nuernberg.museum
+nuremberg.museum
+nyc.museum
+nyny.museum
+oceanographic.museum
+oceanographique.museum
+omaha.museum
+online.museum
+ontario.museum
+openair.museum
+oregon.museum
+oregontrail.museum
+otago.museum
+oxford.museum
+pacific.museum
+paderborn.museum
+palace.museum
+paleo.museum
+palmsprings.museum
+panama.museum
+paris.museum
+pasadena.museum
+pharmacy.museum
+philadelphia.museum
+philadelphiaarea.museum
+philately.museum
+phoenix.museum
+photography.museum
+pilots.museum
+pittsburgh.museum
+planetarium.museum
+plantation.museum
+plants.museum
+plaza.museum
+portal.museum
+portland.museum
+portlligat.museum
+posts-and-telecommunications.museum
+preservation.museum
+presidio.museum
+press.museum
+project.museum
+public.museum
+pubol.museum
+quebec.museum
+railroad.museum
+railway.museum
+research.museum
+resistance.museum
+riodejaneiro.museum
+rochester.museum
+rockart.museum
+roma.museum
+russia.museum
+saintlouis.museum
+salem.museum
+salvadordali.museum
+salzburg.museum
+sandiego.museum
+sanfrancisco.museum
+santabarbara.museum
+santacruz.museum
+santafe.museum
+saskatchewan.museum
+satx.museum
+savannahga.museum
+schlesisches.museum
+schoenbrunn.museum
+schokoladen.museum
+school.museum
+schweiz.museum
+science.museum
+scienceandhistory.museum
+scienceandindustry.museum
+sciencecenter.museum
+sciencecenters.museum
+science-fiction.museum
+sciencehistory.museum
+sciences.museum
+sciencesnaturelles.museum
+scotland.museum
+seaport.museum
+settlement.museum
+settlers.museum
+shell.museum
+sherbrooke.museum
+sibenik.museum
+silk.museum
+ski.museum
+skole.museum
+society.museum
+sologne.museum
+soundandvision.museum
+southcarolina.museum
+southwest.museum
+space.museum
+spy.museum
+square.museum
+stadt.museum
+stalbans.museum
+starnberg.museum
+state.museum
+stateofdelaware.museum
+station.museum
+steam.museum
+steiermark.museum
+stjohn.museum
+stockholm.museum
+stpetersburg.museum
+stuttgart.museum
+suisse.museum
+surgeonshall.museum
+surrey.museum
+svizzera.museum
+sweden.museum
+sydney.museum
+tank.museum
+tcm.museum
+technology.museum
+telekommunikation.museum
+television.museum
+texas.museum
+textile.museum
+theater.museum
+time.museum
+timekeeping.museum
+topology.museum
+torino.museum
+touch.museum
+town.museum
+transport.museum
+tree.museum
+trolley.museum
+trust.museum
+trustee.museum
+uhren.museum
+ulm.museum
+undersea.museum
+university.museum
+usa.museum
+usantiques.museum
+usarts.museum
+uscountryestate.museum
+usculture.museum
+usdecorativearts.museum
+usgarden.museum
+ushistory.museum
+ushuaia.museum
+uslivinghistory.museum
+utah.museum
+uvic.museum
+valley.museum
+vantaa.museum
+versailles.museum
+viking.museum
+village.museum
+virginia.museum
+virtual.museum
+virtuel.museum
+vlaanderen.museum
+volkenkunde.museum
+wales.museum
+wallonie.museum
+war.museum
+washingtondc.museum
+watchandclock.museum
+watch-and-clock.museum
+western.museum
+westfalen.museum
+whaling.museum
+wildlife.museum
+williamsburg.museum
+windmill.museum
+workshop.museum
+york.museum
+yorkshire.museum
+yosemite.museum
+youth.museum
+zoological.museum
+zoology.museum
+ירושלים.museum
+иком.museum
+
+// mv : http://en.wikipedia.org/wiki/.mv
+// "mv" included because, contra Wikipedia, google.mv exists.
+mv
+aero.mv
+biz.mv
+com.mv
+coop.mv
+edu.mv
+gov.mv
+info.mv
+int.mv
+mil.mv
+museum.mv
+name.mv
+net.mv
+org.mv
+pro.mv
+
+// mw : http://www.registrar.mw/
+mw
+ac.mw
+biz.mw
+co.mw
+com.mw
+coop.mw
+edu.mw
+gov.mw
+int.mw
+museum.mw
+net.mw
+org.mw
+
+// mx : http://www.nic.mx/
+// Submitted by registry <farias@nic.mx> 2008-06-19
+mx
+com.mx
+org.mx
+gob.mx
+edu.mx
+net.mx
+
+// my : http://www.mynic.net.my/
+my
+com.my
+net.my
+org.my
+gov.my
+edu.my
+mil.my
+name.my
+
+// mz : http://www.gobin.info/domainname/mz-template.doc
+*.mz
+
+// na : http://www.na-nic.com.na/
+// http://www.info.na/domain/
+na
+info.na
+pro.na
+name.na
+school.na
+or.na
+dr.na
+us.na
+mx.na
+ca.na
+in.na
+cc.na
+tv.na
+ws.na
+mobi.na
+co.na
+com.na
+org.na
+
+// name : has 2nd-level tlds, but there's no list of them
+name
+
+// nc : http://www.cctld.nc/
+nc
+asso.nc
+
+// ne : http://en.wikipedia.org/wiki/.ne
+ne
+
+// net : http://en.wikipedia.org/wiki/.net
+net
+
+// nf : http://en.wikipedia.org/wiki/.nf
+nf
+com.nf
+net.nf
+per.nf
+rec.nf
+web.nf
+arts.nf
+firm.nf
+info.nf
+other.nf
+store.nf
+
+// ng : http://psg.com/dns/ng/
+// Submitted by registry <randy@psg.com> 2008-06-17
+ac.ng
+com.ng
+edu.ng
+gov.ng
+net.ng
+org.ng
+
+// ni : http://www.nic.ni/dominios.htm
+*.ni
+
+// nl : http://www.domain-registry.nl/ace.php/c,728,122,,,,Home.html
+// Confirmed by registry <Antoin.Verschuren@sidn.nl> (with technical
+// reservations) 2008-06-08
+nl
+
+// BV.nl will be a registry for dutch BV's (besloten vennootschap)
+bv.nl
+
+// no : http://www.norid.no/regelverk/index.en.html
+// The Norwegian registry has declined to notify us of updates. The web pages
+// referenced below are the official source of the data. There is also an
+// announce mailing list:
+// https://postlister.uninett.no/sympa/info/norid-diskusjon
+no
+// Norid generic domains : http://www.norid.no/regelverk/vedlegg-c.en.html
+fhs.no
+vgs.no
+fylkesbibl.no
+folkebibl.no
+museum.no
+idrett.no
+priv.no
+// Non-Norid generic domains : http://www.norid.no/regelverk/vedlegg-d.en.html
+mil.no
+stat.no
+dep.no
+kommune.no
+herad.no
+// no geographical names : http://www.norid.no/regelverk/vedlegg-b.en.html
+// counties
+aa.no
+ah.no
+bu.no
+fm.no
+hl.no
+hm.no
+jan-mayen.no
+mr.no
+nl.no
+nt.no
+of.no
+ol.no
+oslo.no
+rl.no
+sf.no
+st.no
+svalbard.no
+tm.no
+tr.no
+va.no
+vf.no
+// primary and lower secondary schools per county
+gs.aa.no
+gs.ah.no
+gs.bu.no
+gs.fm.no
+gs.hl.no
+gs.hm.no
+gs.jan-mayen.no
+gs.mr.no
+gs.nl.no
+gs.nt.no
+gs.of.no
+gs.ol.no
+gs.oslo.no
+gs.rl.no
+gs.sf.no
+gs.st.no
+gs.svalbard.no
+gs.tm.no
+gs.tr.no
+gs.va.no
+gs.vf.no
+// cities
+akrehamn.no
+åkrehamn.no
+algard.no
+ålgård.no
+arna.no
+brumunddal.no
+bryne.no
+bronnoysund.no
+brønnøysund.no
+drobak.no
+drøbak.no
+egersund.no
+fetsund.no
+floro.no
+florø.no
+fredrikstad.no
+hokksund.no
+honefoss.no
+hønefoss.no
+jessheim.no
+jorpeland.no
+jørpeland.no
+kirkenes.no
+kopervik.no
+krokstadelva.no
+langevag.no
+langevåg.no
+leirvik.no
+mjondalen.no
+mjøndalen.no
+mo-i-rana.no
+mosjoen.no
+mosjøen.no
+nesoddtangen.no
+orkanger.no
+osoyro.no
+osøyro.no
+raholt.no
+råholt.no
+sandnessjoen.no
+sandnessjøen.no
+skedsmokorset.no
+slattum.no
+spjelkavik.no
+stathelle.no
+stavern.no
+stjordalshalsen.no
+stjørdalshalsen.no
+tananger.no
+tranby.no
+vossevangen.no
+// communities
+afjord.no
+åfjord.no
+agdenes.no
+al.no
+ål.no
+alesund.no
+ålesund.no
+alstahaug.no
+alta.no
+áltá.no
+alaheadju.no
+álaheadju.no
+alvdal.no
+amli.no
+åmli.no
+amot.no
+åmot.no
+andebu.no
+andoy.no
+andøy.no
+andasuolo.no
+ardal.no
+årdal.no
+aremark.no
+arendal.no
+ås.no
+aseral.no
+åseral.no
+asker.no
+askim.no
+askvoll.no
+askoy.no
+askøy.no
+asnes.no
+åsnes.no
+audnedaln.no
+aukra.no
+aure.no
+aurland.no
+aurskog-holand.no
+aurskog-høland.no
+austevoll.no
+austrheim.no
+averoy.no
+averøy.no
+balestrand.no
+ballangen.no
+balat.no
+bálát.no
+balsfjord.no
+bahccavuotna.no
+báhccavuotna.no
+bamble.no
+bardu.no
+beardu.no
+beiarn.no
+bajddar.no
+bájddar.no
+baidar.no
+báidár.no
+berg.no
+bergen.no
+berlevag.no
+berlevåg.no
+bearalvahki.no
+bearalváhki.no
+bindal.no
+birkenes.no
+bjarkoy.no
+bjarkøy.no
+bjerkreim.no
+bjugn.no
+bodo.no
+bodø.no
+badaddja.no
+bådåddjå.no
+budejju.no
+bokn.no
+bremanger.no
+bronnoy.no
+brønnøy.no
+bygland.no
+bykle.no
+barum.no
+bærum.no
+bo.telemark.no
+bø.telemark.no
+bo.nordland.no
+bø.nordland.no
+bievat.no
+bievát.no
+bomlo.no
+bømlo.no
+batsfjord.no
+båtsfjord.no
+bahcavuotna.no
+báhcavuotna.no
+dovre.no
+drammen.no
+drangedal.no
+dyroy.no
+dyrøy.no
+donna.no
+dønna.no
+eid.no
+eidfjord.no
+eidsberg.no
+eidskog.no
+eidsvoll.no
+eigersund.no
+elverum.no
+enebakk.no
+engerdal.no
+etne.no
+etnedal.no
+evenes.no
+evenassi.no
+evenášši.no
+evje-og-hornnes.no
+farsund.no
+fauske.no
+fuossko.no
+fuoisku.no
+fedje.no
+fet.no
+finnoy.no
+finnøy.no
+fitjar.no
+fjaler.no
+fjell.no
+flakstad.no
+flatanger.no
+flekkefjord.no
+flesberg.no
+flora.no
+fla.no
+flå.no
+folldal.no
+forsand.no
+fosnes.no
+frei.no
+frogn.no
+froland.no
+frosta.no
+frana.no
+fræna.no
+froya.no
+frøya.no
+fusa.no
+fyresdal.no
+forde.no
+førde.no
+gamvik.no
+gangaviika.no
+gáŋgaviika.no
+gaular.no
+gausdal.no
+gildeskal.no
+gildeskål.no
+giske.no
+gjemnes.no
+gjerdrum.no
+gjerstad.no
+gjesdal.no
+gjovik.no
+gjøvik.no
+gloppen.no
+gol.no
+gran.no
+grane.no
+granvin.no
+gratangen.no
+grimstad.no
+grong.no
+kraanghke.no
+kråanghke.no
+grue.no
+gulen.no
+hadsel.no
+halden.no
+halsa.no
+hamar.no
+hamaroy.no
+habmer.no
+hábmer.no
+hapmir.no
+hápmir.no
+hammerfest.no
+hammarfeasta.no
+hámmárfeasta.no
+haram.no
+hareid.no
+harstad.no
+hasvik.no
+aknoluokta.no
+ákŋoluokta.no
+hattfjelldal.no
+aarborte.no
+haugesund.no
+hemne.no
+hemnes.no
+hemsedal.no
+heroy.more-og-romsdal.no
+herøy.møre-og-romsdal.no
+heroy.nordland.no
+herøy.nordland.no
+hitra.no
+hjartdal.no
+hjelmeland.no
+hobol.no
+hobøl.no
+hof.no
+hol.no
+hole.no
+holmestrand.no
+holtalen.no
+holtålen.no
+hornindal.no
+horten.no
+hurdal.no
+hurum.no
+hvaler.no
+hyllestad.no
+hagebostad.no
+hægebostad.no
+hoyanger.no
+høyanger.no
+hoylandet.no
+høylandet.no
+ha.no
+hå.no
+ibestad.no
+inderoy.no
+inderøy.no
+iveland.no
+jevnaker.no
+jondal.no
+jolster.no
+jølster.no
+karasjok.no
+karasjohka.no
+kárášjohka.no
+karlsoy.no
+galsa.no
+gálsá.no
+karmoy.no
+karmøy.no
+kautokeino.no
+guovdageaidnu.no
+klepp.no
+klabu.no
+klæbu.no
+kongsberg.no
+kongsvinger.no
+kragero.no
+kragerø.no
+kristiansand.no
+kristiansund.no
+krodsherad.no
+krødsherad.no
+kvalsund.no
+rahkkeravju.no
+ráhkkerávju.no
+kvam.no
+kvinesdal.no
+kvinnherad.no
+kviteseid.no
+kvitsoy.no
+kvitsøy.no
+kvafjord.no
+kvæfjord.no
+giehtavuoatna.no
+kvanangen.no
+kvænangen.no
+navuotna.no
+návuotna.no
+kafjord.no
+kåfjord.no
+gaivuotna.no
+gáivuotna.no
+larvik.no
+lavangen.no
+lavagis.no
+loabat.no
+loabát.no
+lebesby.no
+davvesiida.no
+leikanger.no
+leirfjord.no
+leka.no
+leksvik.no
+lenvik.no
+leangaviika.no
+leaŋgaviika.no
+lesja.no
+levanger.no
+lier.no
+lierne.no
+lillehammer.no
+lillesand.no
+lindesnes.no
+lindas.no
+lindås.no
+lom.no
+loppa.no
+lahppi.no
+láhppi.no
+lund.no
+lunner.no
+luroy.no
+lurøy.no
+luster.no
+lyngdal.no
+lyngen.no
+ivgu.no
+lardal.no
+lerdal.no
+lærdal.no
+lodingen.no
+lødingen.no
+lorenskog.no
+lørenskog.no
+loten.no
+løten.no
+malvik.no
+masoy.no
+måsøy.no
+muosat.no
+muosát.no
+mandal.no
+marker.no
+marnardal.no
+masfjorden.no
+meland.no
+meldal.no
+melhus.no
+meloy.no
+meløy.no
+meraker.no
+meråker.no
+moareke.no
+moåreke.no
+midsund.no
+midtre-gauldal.no
+modalen.no
+modum.no
+molde.no
+moskenes.no
+moss.no
+mosvik.no
+malselv.no
+målselv.no
+malatvuopmi.no
+málatvuopmi.no
+namdalseid.no
+aejrie.no
+namsos.no
+namsskogan.no
+naamesjevuemie.no
+nååmesjevuemie.no
+laakesvuemie.no
+nannestad.no
+narvik.no
+narviika.no
+naustdal.no
+nedre-eiker.no
+nes.akershus.no
+nes.buskerud.no
+nesna.no
+nesodden.no
+nesseby.no
+unjarga.no
+unjárga.no
+nesset.no
+nissedal.no
+nittedal.no
+nord-aurdal.no
+nord-fron.no
+nord-odal.no
+norddal.no
+nordkapp.no
+davvenjarga.no
+davvenjárga.no
+nordre-land.no
+nordreisa.no
+raisa.no
+ráisa.no
+nore-og-uvdal.no
+notodden.no
+naroy.no
+nærøy.no
+notteroy.no
+nøtterøy.no
+odda.no
+oksnes.no
+øksnes.no
+oppdal.no
+oppegard.no
+oppegård.no
+orkdal.no
+orland.no
+ørland.no
+orskog.no
+ørskog.no
+orsta.no
+ørsta.no
+os.hedmark.no
+os.hordaland.no
+osen.no
+osteroy.no
+osterøy.no
+ostre-toten.no
+østre-toten.no
+overhalla.no
+ovre-eiker.no
+øvre-eiker.no
+oyer.no
+øyer.no
+oygarden.no
+øygarden.no
+oystre-slidre.no
+øystre-slidre.no
+porsanger.no
+porsangu.no
+porsáŋgu.no
+porsgrunn.no
+radoy.no
+radøy.no
+rakkestad.no
+rana.no
+ruovat.no
+randaberg.no
+rauma.no
+rendalen.no
+rennebu.no
+rennesoy.no
+rennesøy.no
+rindal.no
+ringebu.no
+ringerike.no
+ringsaker.no
+rissa.no
+risor.no
+risør.no
+roan.no
+rollag.no
+rygge.no
+ralingen.no
+rælingen.no
+rodoy.no
+rødøy.no
+romskog.no
+rømskog.no
+roros.no
+røros.no
+rost.no
+røst.no
+royken.no
+røyken.no
+royrvik.no
+røyrvik.no
+rade.no
+råde.no
+salangen.no
+siellak.no
+saltdal.no
+salat.no
+sálát.no
+sálat.no
+samnanger.no
+sande.more-og-romsdal.no
+sande.møre-og-romsdal.no
+sande.vestfold.no
+sandefjord.no
+sandnes.no
+sandoy.no
+sandøy.no
+sarpsborg.no
+sauda.no
+sauherad.no
+sel.no
+selbu.no
+selje.no
+seljord.no
+sigdal.no
+siljan.no
+sirdal.no
+skaun.no
+skedsmo.no
+ski.no
+skien.no
+skiptvet.no
+skjervoy.no
+skjervøy.no
+skierva.no
+skiervá.no
+skjak.no
+skjåk.no
+skodje.no
+skanland.no
+skånland.no
+skanit.no
+skánit.no
+smola.no
+smøla.no
+snillfjord.no
+snasa.no
+snåsa.no
+snoasa.no
+snaase.no
+snåase.no
+sogndal.no
+sokndal.no
+sola.no
+solund.no
+songdalen.no
+sortland.no
+spydeberg.no
+stange.no
+stavanger.no
+steigen.no
+steinkjer.no
+stjordal.no
+stjørdal.no
+stokke.no
+stor-elvdal.no
+stord.no
+stordal.no
+storfjord.no
+omasvuotna.no
+strand.no
+stranda.no
+stryn.no
+sula.no
+suldal.no
+sund.no
+sunndal.no
+surnadal.no
+sveio.no
+svelvik.no
+sykkylven.no
+sogne.no
+søgne.no
+somna.no
+sømna.no
+sondre-land.no
+søndre-land.no
+sor-aurdal.no
+sør-aurdal.no
+sor-fron.no
+sør-fron.no
+sor-odal.no
+sør-odal.no
+sor-varanger.no
+sør-varanger.no
+matta-varjjat.no
+mátta-várjjat.no
+sorfold.no
+sørfold.no
+sorreisa.no
+sørreisa.no
+sorum.no
+sørum.no
+tana.no
+deatnu.no
+time.no
+tingvoll.no
+tinn.no
+tjeldsund.no
+dielddanuorri.no
+tjome.no
+tjøme.no
+tokke.no
+tolga.no
+torsken.no
+tranoy.no
+tranøy.no
+tromso.no
+tromsø.no
+tromsa.no
+romsa.no
+trondheim.no
+troandin.no
+trysil.no
+trana.no
+træna.no
+trogstad.no
+trøgstad.no
+tvedestrand.no
+tydal.no
+tynset.no
+tysfjord.no
+divtasvuodna.no
+divttasvuotna.no
+tysnes.no
+tysvar.no
+tysvær.no
+tonsberg.no
+tønsberg.no
+ullensaker.no
+ullensvang.no
+ulvik.no
+utsira.no
+vadso.no
+vadsø.no
+cahcesuolo.no
+čáhcesuolo.no
+vaksdal.no
+valle.no
+vang.no
+vanylven.no
+vardo.no
+vardø.no
+varggat.no
+várggát.no
+vefsn.no
+vaapste.no
+vega.no
+vegarshei.no
+vegårshei.no
+vennesla.no
+verdal.no
+verran.no
+vestby.no
+vestnes.no
+vestre-slidre.no
+vestre-toten.no
+vestvagoy.no
+vestvågøy.no
+vevelstad.no
+vik.no
+vikna.no
+vindafjord.no
+volda.no
+voss.no
+varoy.no
+værøy.no
+vagan.no
+vågan.no
+voagat.no
+vagsoy.no
+vågsøy.no
+vaga.no
+vågå.no
+valer.ostfold.no
+våler.østfold.no
+valer.hedmark.no
+våler.hedmark.no
+
+// np : http://www.mos.com.np/register.html
+*.np
+
+// nr : http://cenpac.net.nr/dns/index.html
+// Confirmed by registry <technician@cenpac.net.nr> 2008-06-17
+nr
+biz.nr
+info.nr
+gov.nr
+edu.nr
+org.nr
+net.nr
+com.nr
+
+// nu : http://en.wikipedia.org/wiki/.nu
+nu
+
+// nz : http://en.wikipedia.org/wiki/.nz
+*.nz
+
+// om : http://en.wikipedia.org/wiki/.om
+*.om
+!mediaphone.om
+!nawrastelecom.om
+!nawras.om
+!omanmobile.om
+!omanpost.om
+!omantel.om
+!rakpetroleum.om
+!siemens.om
+!songfest.om
+!statecouncil.om
+
+// org : http://en.wikipedia.org/wiki/.org
+org
+
+// pa : http://www.nic.pa/
+// Some additional second level "domains" resolve directly as hostnames, such as
+// pannet.pa, so we add a rule for "pa".
+pa
+ac.pa
+gob.pa
+com.pa
+org.pa
+sld.pa
+edu.pa
+net.pa
+ing.pa
+abo.pa
+med.pa
+nom.pa
+
+// pe : https://www.nic.pe/InformeFinalComision.pdf
+pe
+edu.pe
+gob.pe
+nom.pe
+mil.pe
+org.pe
+com.pe
+net.pe
+
+// pf : http://www.gobin.info/domainname/formulaire-pf.pdf
+pf
+com.pf
+org.pf
+edu.pf
+
+// pg : http://en.wikipedia.org/wiki/.pg
+*.pg
+
+// ph : http://www.domains.ph/FAQ2.asp
+// Submitted by registry <jed@email.com.ph> 2008-06-13
+ph
+com.ph
+net.ph
+org.ph
+gov.ph
+edu.ph
+ngo.ph
+mil.ph
+i.ph
+
+// pk : http://pk5.pknic.net.pk/pk5/msgNamepk.PK
+pk
+com.pk
+net.pk
+edu.pk
+org.pk
+fam.pk
+biz.pk
+web.pk
+gov.pk
+gob.pk
+gok.pk
+gon.pk
+gop.pk
+gos.pk
+info.pk
+
+// pl : http://www.dns.pl/english/
+pl
+// NASK functional domains (nask.pl / dns.pl) : http://www.dns.pl/english/dns-funk.html
+aid.pl
+agro.pl
+atm.pl
+auto.pl
+biz.pl
+com.pl
+edu.pl
+gmina.pl
+gsm.pl
+info.pl
+mail.pl
+miasta.pl
+media.pl
+mil.pl
+net.pl
+nieruchomosci.pl
+nom.pl
+org.pl
+pc.pl
+powiat.pl
+priv.pl
+realestate.pl
+rel.pl
+sex.pl
+shop.pl
+sklep.pl
+sos.pl
+szkola.pl
+targi.pl
+tm.pl
+tourism.pl
+travel.pl
+turystyka.pl
+// ICM functional domains (icm.edu.pl)
+6bone.pl
+art.pl
+mbone.pl
+// Government domains (administred by ippt.gov.pl)
+gov.pl
+uw.gov.pl
+um.gov.pl
+ug.gov.pl
+upow.gov.pl
+starostwo.gov.pl
+so.gov.pl
+sr.gov.pl
+po.gov.pl
+pa.gov.pl
+// other functional domains
+ngo.pl
+irc.pl
+usenet.pl
+// NASK geographical domains : http://www.dns.pl/english/dns-regiony.html
+augustow.pl
+babia-gora.pl
+bedzin.pl
+beskidy.pl
+bialowieza.pl
+bialystok.pl
+bielawa.pl
+bieszczady.pl
+boleslawiec.pl
+bydgoszcz.pl
+bytom.pl
+cieszyn.pl
+czeladz.pl
+czest.pl
+dlugoleka.pl
+elblag.pl
+elk.pl
+glogow.pl
+gniezno.pl
+gorlice.pl
+grajewo.pl
+ilawa.pl
+jaworzno.pl
+jelenia-gora.pl
+jgora.pl
+kalisz.pl
+kazimierz-dolny.pl
+karpacz.pl
+kartuzy.pl
+kaszuby.pl
+katowice.pl
+kepno.pl
+ketrzyn.pl
+klodzko.pl
+kobierzyce.pl
+kolobrzeg.pl
+konin.pl
+konskowola.pl
+kutno.pl
+lapy.pl
+lebork.pl
+legnica.pl
+lezajsk.pl
+limanowa.pl
+lomza.pl
+lowicz.pl
+lubin.pl
+lukow.pl
+malbork.pl
+malopolska.pl
+mazowsze.pl
+mazury.pl
+mielec.pl
+mielno.pl
+mragowo.pl
+naklo.pl
+nowaruda.pl
+nysa.pl
+olawa.pl
+olecko.pl
+olkusz.pl
+olsztyn.pl
+opoczno.pl
+opole.pl
+ostroda.pl
+ostroleka.pl
+ostrowiec.pl
+ostrowwlkp.pl
+pila.pl
+pisz.pl
+podhale.pl
+podlasie.pl
+polkowice.pl
+pomorze.pl
+pomorskie.pl
+prochowice.pl
+pruszkow.pl
+przeworsk.pl
+pulawy.pl
+radom.pl
+rawa-maz.pl
+rybnik.pl
+rzeszow.pl
+sanok.pl
+sejny.pl
+siedlce.pl
+slask.pl
+slupsk.pl
+sosnowiec.pl
+stalowa-wola.pl
+skoczow.pl
+starachowice.pl
+stargard.pl
+suwalki.pl
+swidnica.pl
+swiebodzin.pl
+swinoujscie.pl
+szczecin.pl
+szczytno.pl
+tarnobrzeg.pl
+tgory.pl
+turek.pl
+tychy.pl
+ustka.pl
+walbrzych.pl
+warmia.pl
+warszawa.pl
+waw.pl
+wegrow.pl
+wielun.pl
+wlocl.pl
+wloclawek.pl
+wodzislaw.pl
+wolomin.pl
+wroclaw.pl
+zachpomor.pl
+zagan.pl
+zarow.pl
+zgora.pl
+zgorzelec.pl
+// TASK geographical domains (www.task.gda.pl/uslugi/dns)
+gda.pl
+gdansk.pl
+gdynia.pl
+med.pl
+sopot.pl
+// other geographical domains
+gliwice.pl
+krakow.pl
+poznan.pl
+wroc.pl
+zakopane.pl
+
+// pm : http://www.afnic.fr/medias/documents/AFNIC-naming-policy2012.pdf
+pm
+
+// pn : http://www.government.pn/PnRegistry/policies.htm
+pn
+gov.pn
+co.pn
+org.pn
+edu.pn
+net.pn
+
+// pr : http://www.nic.pr/index.asp?f=1
+pr
+com.pr
+net.pr
+org.pr
+gov.pr
+edu.pr
+isla.pr
+pro.pr
+biz.pr
+info.pr
+name.pr
+// these aren't mentioned on nic.pr, but on http://en.wikipedia.org/wiki/.pr
+est.pr
+prof.pr
+ac.pr
+
+// pro : http://www.nic.pro/support_faq.htm
+pro
+aca.pro
+bar.pro
+cpa.pro
+jur.pro
+law.pro
+med.pro
+eng.pro
+
+// ps : http://en.wikipedia.org/wiki/.ps
+// http://www.nic.ps/registration/policy.html#reg
+ps
+edu.ps
+gov.ps
+sec.ps
+plo.ps
+com.ps
+org.ps
+net.ps
+
+// pt : http://online.dns.pt/dns/start_dns
+pt
+net.pt
+gov.pt
+org.pt
+edu.pt
+int.pt
+publ.pt
+com.pt
+nome.pt
+
+// pw : http://en.wikipedia.org/wiki/.pw
+pw
+co.pw
+ne.pw
+or.pw
+ed.pw
+go.pw
+belau.pw
+
+// py : http://www.nic.py/faq_a.html#faq_b
+*.py
+
+// qa : http://domains.qa/en/
+qa
+com.qa
+edu.qa
+gov.qa
+mil.qa
+name.qa
+net.qa
+org.qa
+sch.qa
+
+// re : http://www.afnic.re/obtenir/chartes/nommage-re/annexe-descriptifs
+re
+com.re
+asso.re
+nom.re
+
+// ro : http://www.rotld.ro/
+ro
+com.ro
+org.ro
+tm.ro
+nt.ro
+nom.ro
+info.ro
+rec.ro
+arts.ro
+firm.ro
+store.ro
+www.ro
+
+// rs : http://en.wikipedia.org/wiki/.rs
+rs
+co.rs
+org.rs
+edu.rs
+ac.rs
+gov.rs
+in.rs
+
+// ru : http://www.cctld.ru/ru/docs/aktiv_8.php
+// Industry domains
+ru
+ac.ru
+com.ru
+edu.ru
+int.ru
+net.ru
+org.ru
+pp.ru
+// Geographical domains
+adygeya.ru
+altai.ru
+amur.ru
+arkhangelsk.ru
+astrakhan.ru
+bashkiria.ru
+belgorod.ru
+bir.ru
+bryansk.ru
+buryatia.ru
+cbg.ru
+chel.ru
+chelyabinsk.ru
+chita.ru
+chukotka.ru
+chuvashia.ru
+dagestan.ru
+dudinka.ru
+e-burg.ru
+grozny.ru
+irkutsk.ru
+ivanovo.ru
+izhevsk.ru
+jar.ru
+joshkar-ola.ru
+kalmykia.ru
+kaluga.ru
+kamchatka.ru
+karelia.ru
+kazan.ru
+kchr.ru
+kemerovo.ru
+khabarovsk.ru
+khakassia.ru
+khv.ru
+kirov.ru
+koenig.ru
+komi.ru
+kostroma.ru
+krasnoyarsk.ru
+kuban.ru
+kurgan.ru
+kursk.ru
+lipetsk.ru
+magadan.ru
+mari.ru
+mari-el.ru
+marine.ru
+mordovia.ru
+mosreg.ru
+msk.ru
+murmansk.ru
+nalchik.ru
+nnov.ru
+nov.ru
+novosibirsk.ru
+nsk.ru
+omsk.ru
+orenburg.ru
+oryol.ru
+palana.ru
+penza.ru
+perm.ru
+pskov.ru
+ptz.ru
+rnd.ru
+ryazan.ru
+sakhalin.ru
+samara.ru
+saratov.ru
+simbirsk.ru
+smolensk.ru
+spb.ru
+stavropol.ru
+stv.ru
+surgut.ru
+tambov.ru
+tatarstan.ru
+tom.ru
+tomsk.ru
+tsaritsyn.ru
+tsk.ru
+tula.ru
+tuva.ru
+tver.ru
+tyumen.ru
+udm.ru
+udmurtia.ru
+ulan-ude.ru
+vladikavkaz.ru
+vladimir.ru
+vladivostok.ru
+volgograd.ru
+vologda.ru
+voronezh.ru
+vrn.ru
+vyatka.ru
+yakutia.ru
+yamal.ru
+yaroslavl.ru
+yekaterinburg.ru
+yuzhno-sakhalinsk.ru
+// More geographical domains
+amursk.ru
+baikal.ru
+cmw.ru
+fareast.ru
+jamal.ru
+kms.ru
+k-uralsk.ru
+kustanai.ru
+kuzbass.ru
+magnitka.ru
+mytis.ru
+nakhodka.ru
+nkz.ru
+norilsk.ru
+oskol.ru
+pyatigorsk.ru
+rubtsovsk.ru
+snz.ru
+syzran.ru
+vdonsk.ru
+zgrad.ru
+// State domains
+gov.ru
+mil.ru
+// Technical domains
+test.ru
+
+// rw : http://www.nic.rw/cgi-bin/policy.pl
+rw
+gov.rw
+net.rw
+edu.rw
+ac.rw
+com.rw
+co.rw
+int.rw
+mil.rw
+gouv.rw
+
+// sa : http://www.nic.net.sa/
+sa
+com.sa
+net.sa
+org.sa
+gov.sa
+med.sa
+pub.sa
+edu.sa
+sch.sa
+
+// sb : http://www.sbnic.net.sb/
+// Submitted by registry <lee.humphries@telekom.com.sb> 2008-06-08
+sb
+com.sb
+edu.sb
+gov.sb
+net.sb
+org.sb
+
+// sc : http://www.nic.sc/
+sc
+com.sc
+gov.sc
+net.sc
+org.sc
+edu.sc
+
+// sd : http://www.isoc.sd/sudanic.isoc.sd/billing_pricing.htm
+// Submitted by registry <admin@isoc.sd> 2008-06-17
+sd
+com.sd
+net.sd
+org.sd
+edu.sd
+med.sd
+gov.sd
+info.sd
+
+// se : http://en.wikipedia.org/wiki/.se
+// Submitted by registry <Patrik.Wallstrom@iis.se> 2008-06-24
+se
+a.se
+ac.se
+b.se
+bd.se
+brand.se
+c.se
+d.se
+e.se
+f.se
+fh.se
+fhsk.se
+fhv.se
+g.se
+h.se
+i.se
+k.se
+komforb.se
+kommunalforbund.se
+komvux.se
+l.se
+lanbib.se
+m.se
+n.se
+naturbruksgymn.se
+o.se
+org.se
+p.se
+parti.se
+pp.se
+press.se
+r.se
+s.se
+sshn.se
+t.se
+tm.se
+u.se
+w.se
+x.se
+y.se
+z.se
+
+// sg : http://www.nic.net.sg/sub_policies_agreement/2ld.html
+sg
+com.sg
+net.sg
+org.sg
+gov.sg
+edu.sg
+per.sg
+
+// sh : http://www.nic.sh/rules.html
+// list of 2nd level domains ?
+sh
+
+// si : http://en.wikipedia.org/wiki/.si
+si
+
+// sj : No registrations at this time.
+// Submitted by registry <jarle@uninett.no> 2008-06-16
+
+// sk : http://en.wikipedia.org/wiki/.sk
+// list of 2nd level domains ?
+sk
+
+// sl : http://www.nic.sl
+// Submitted by registry <adam@neoip.com> 2008-06-12
+sl
+com.sl
+net.sl
+edu.sl
+gov.sl
+org.sl
+
+// sm : http://en.wikipedia.org/wiki/.sm
+sm
+
+// sn : http://en.wikipedia.org/wiki/.sn
+sn
+art.sn
+com.sn
+edu.sn
+gouv.sn
+org.sn
+perso.sn
+univ.sn
+
+// so : http://www.soregistry.com/
+so
+com.so
+net.so
+org.so
+
+// sr : http://en.wikipedia.org/wiki/.sr
+sr
+
+// st : http://www.nic.st/html/policyrules/
+st
+co.st
+com.st
+consulado.st
+edu.st
+embaixada.st
+gov.st
+mil.st
+net.st
+org.st
+principe.st
+saotome.st
+store.st
+
+// su : http://en.wikipedia.org/wiki/.su
+su
+
+// sv : http://www.svnet.org.sv/svpolicy.html
+*.sv
+
+// sy : http://en.wikipedia.org/wiki/.sy
+// see also: http://www.gobin.info/domainname/sy.doc
+sy
+edu.sy
+gov.sy
+net.sy
+mil.sy
+com.sy
+org.sy
+
+// sz : http://en.wikipedia.org/wiki/.sz
+// http://www.sispa.org.sz/
+sz
+co.sz
+ac.sz
+org.sz
+
+// tc : http://en.wikipedia.org/wiki/.tc
+tc
+
+// td : http://en.wikipedia.org/wiki/.td
+td
+
+// tel: http://en.wikipedia.org/wiki/.tel
+// http://www.telnic.org/
+tel
+
+// tf : http://en.wikipedia.org/wiki/.tf
+tf
+
+// tg : http://en.wikipedia.org/wiki/.tg
+// http://www.nic.tg/nictg/index.php implies no reserved 2nd-level domains,
+// although this contradicts wikipedia.
+tg
+
+// th : http://en.wikipedia.org/wiki/.th
+// Submitted by registry <krit@thains.co.th> 2008-06-17
+th
+ac.th
+co.th
+go.th
+in.th
+mi.th
+net.th
+or.th
+
+// tj : http://www.nic.tj/policy.htm
+tj
+ac.tj
+biz.tj
+co.tj
+com.tj
+edu.tj
+go.tj
+gov.tj
+int.tj
+mil.tj
+name.tj
+net.tj
+nic.tj
+org.tj
+test.tj
+web.tj
+
+// tk : http://en.wikipedia.org/wiki/.tk
+tk
+
+// tl : http://en.wikipedia.org/wiki/.tl
+tl
+gov.tl
+
+// tm : http://www.nic.tm/rules.html
+// list of 2nd level tlds ?
+tm
+
+// tn : http://en.wikipedia.org/wiki/.tn
+// http://whois.ati.tn/
+tn
+com.tn
+ens.tn
+fin.tn
+gov.tn
+ind.tn
+intl.tn
+nat.tn
+net.tn
+org.tn
+info.tn
+perso.tn
+tourism.tn
+edunet.tn
+rnrt.tn
+rns.tn
+rnu.tn
+mincom.tn
+agrinet.tn
+defense.tn
+turen.tn
+
+// to : http://en.wikipedia.org/wiki/.to
+// Submitted by registry <egullich@colo.to> 2008-06-17
+to
+com.to
+gov.to
+net.to
+org.to
+edu.to
+mil.to
+
+// tr : http://en.wikipedia.org/wiki/.tr
+*.tr
+!nic.tr
+// Used by government in the TRNC
+// http://en.wikipedia.org/wiki/.nc.tr
+gov.nc.tr
+
+// travel : http://en.wikipedia.org/wiki/.travel
+travel
+
+// tt : http://www.nic.tt/
+tt
+co.tt
+com.tt
+org.tt
+net.tt
+biz.tt
+info.tt
+pro.tt
+int.tt
+coop.tt
+jobs.tt
+mobi.tt
+travel.tt
+museum.tt
+aero.tt
+name.tt
+gov.tt
+edu.tt
+
+// tv : http://en.wikipedia.org/wiki/.tv
+// Not listing any 2LDs as reserved since none seem to exist in practice,
+// Wikipedia notwithstanding.
+tv
+
+// tw : http://en.wikipedia.org/wiki/.tw
+tw
+edu.tw
+gov.tw
+mil.tw
+com.tw
+net.tw
+org.tw
+idv.tw
+game.tw
+ebiz.tw
+club.tw
+網路.tw
+組織.tw
+商業.tw
+
+// tz : http://en.wikipedia.org/wiki/.tz
+// Submitted by registry <randy@psg.com> 2008-06-17
+// Updated from http://www.tznic.or.tz/index.php/domains.html 2010-10-25
+ac.tz
+co.tz
+go.tz
+mil.tz
+ne.tz
+or.tz
+sc.tz
+
+// ua : http://www.nic.net.ua/
+ua
+com.ua
+edu.ua
+gov.ua
+in.ua
+net.ua
+org.ua
+// ua geo-names
+cherkassy.ua
+chernigov.ua
+chernovtsy.ua
+ck.ua
+cn.ua
+crimea.ua
+cv.ua
+dn.ua
+dnepropetrovsk.ua
+donetsk.ua
+dp.ua
+if.ua
+ivano-frankivsk.ua
+kh.ua
+kharkov.ua
+kherson.ua
+khmelnitskiy.ua
+kiev.ua
+kirovograd.ua
+km.ua
+kr.ua
+ks.ua
+kv.ua
+lg.ua
+lugansk.ua
+lutsk.ua
+lviv.ua
+mk.ua
+nikolaev.ua
+od.ua
+odessa.ua
+pl.ua
+poltava.ua
+rovno.ua
+rv.ua
+sebastopol.ua
+sumy.ua
+te.ua
+ternopil.ua
+uzhgorod.ua
+vinnica.ua
+vn.ua
+zaporizhzhe.ua
+zp.ua
+zhitomir.ua
+zt.ua
+
+// Private registries in .ua
+co.ua
+pp.ua
+
+// ug : http://www.registry.co.ug/
+ug
+co.ug
+ac.ug
+sc.ug
+go.ug
+ne.ug
+or.ug
+
+// uk : http://en.wikipedia.org/wiki/.uk
+*.uk
+*.sch.uk
+!bl.uk
+!british-library.uk
+!icnet.uk
+!jet.uk
+!mod.uk
+!nel.uk
+!nhs.uk
+!nic.uk
+!nls.uk
+!national-library-scotland.uk
+!parliament.uk
+!police.uk
+
+// us : http://en.wikipedia.org/wiki/.us
+us
+dni.us
+fed.us
+isa.us
+kids.us
+nsn.us
+// us geographic names
+ak.us
+al.us
+ar.us
+as.us
+az.us
+ca.us
+co.us
+ct.us
+dc.us
+de.us
+fl.us
+ga.us
+gu.us
+hi.us
+ia.us
+id.us
+il.us
+in.us
+ks.us
+ky.us
+la.us
+ma.us
+md.us
+me.us
+mi.us
+mn.us
+mo.us
+ms.us
+mt.us
+nc.us
+nd.us
+ne.us
+nh.us
+nj.us
+nm.us
+nv.us
+ny.us
+oh.us
+ok.us
+or.us
+pa.us
+pr.us
+ri.us
+sc.us
+sd.us
+tn.us
+tx.us
+ut.us
+vi.us
+vt.us
+va.us
+wa.us
+wi.us
+wv.us
+wy.us
+// The registrar notes several more specific domains available in each state,
+// such as state.*.us, dst.*.us, etc., but resolution of these is somewhat
+// haphazard; in some states these domains resolve as addresses, while in others
+// only subdomains are available, or even nothing at all. We include the
+// most common ones where it's clear that different sites are different
+// entities.
+k12.ak.us
+k12.al.us
+k12.ar.us
+k12.as.us
+k12.az.us
+k12.ca.us
+k12.co.us
+k12.ct.us
+k12.dc.us
+k12.de.us
+k12.fl.us
+k12.ga.us
+k12.gu.us
+// k12.hi.us Hawaii has a state-wide DOE login: bug 614565
+k12.ia.us
+k12.id.us
+k12.il.us
+k12.in.us
+k12.ks.us
+k12.ky.us
+k12.la.us
+k12.ma.us
+k12.md.us
+k12.me.us
+k12.mi.us
+k12.mn.us
+k12.mo.us
+k12.ms.us
+k12.mt.us
+k12.nc.us
+k12.nd.us
+k12.ne.us
+k12.nh.us
+k12.nj.us
+k12.nm.us
+k12.nv.us
+k12.ny.us
+k12.oh.us
+k12.ok.us
+k12.or.us
+k12.pa.us
+k12.pr.us
+k12.ri.us
+k12.sc.us
+k12.sd.us
+k12.tn.us
+k12.tx.us
+k12.ut.us
+k12.vi.us
+k12.vt.us
+k12.va.us
+k12.wa.us
+k12.wi.us
+k12.wv.us
+k12.wy.us
+
+cc.ak.us
+cc.al.us
+cc.ar.us
+cc.as.us
+cc.az.us
+cc.ca.us
+cc.co.us
+cc.ct.us
+cc.dc.us
+cc.de.us
+cc.fl.us
+cc.ga.us
+cc.gu.us
+cc.hi.us
+cc.ia.us
+cc.id.us
+cc.il.us
+cc.in.us
+cc.ks.us
+cc.ky.us
+cc.la.us
+cc.ma.us
+cc.md.us
+cc.me.us
+cc.mi.us
+cc.mn.us
+cc.mo.us
+cc.ms.us
+cc.mt.us
+cc.nc.us
+cc.nd.us
+cc.ne.us
+cc.nh.us
+cc.nj.us
+cc.nm.us
+cc.nv.us
+cc.ny.us
+cc.oh.us
+cc.ok.us
+cc.or.us
+cc.pa.us
+cc.pr.us
+cc.ri.us
+cc.sc.us
+cc.sd.us
+cc.tn.us
+cc.tx.us
+cc.ut.us
+cc.vi.us
+cc.vt.us
+cc.va.us
+cc.wa.us
+cc.wi.us
+cc.wv.us
+cc.wy.us
+
+lib.ak.us
+lib.al.us
+lib.ar.us
+lib.as.us
+lib.az.us
+lib.ca.us
+lib.co.us
+lib.ct.us
+lib.dc.us
+lib.de.us
+lib.fl.us
+lib.ga.us
+lib.gu.us
+lib.hi.us
+lib.ia.us
+lib.id.us
+lib.il.us
+lib.in.us
+lib.ks.us
+lib.ky.us
+lib.la.us
+lib.ma.us
+lib.md.us
+lib.me.us
+lib.mi.us
+lib.mn.us
+lib.mo.us
+lib.ms.us
+lib.mt.us
+lib.nc.us
+lib.nd.us
+lib.ne.us
+lib.nh.us
+lib.nj.us
+lib.nm.us
+lib.nv.us
+lib.ny.us
+lib.oh.us
+lib.ok.us
+lib.or.us
+lib.pa.us
+lib.pr.us
+lib.ri.us
+lib.sc.us
+lib.sd.us
+lib.tn.us
+lib.tx.us
+lib.ut.us
+lib.vi.us
+lib.vt.us
+lib.va.us
+lib.wa.us
+lib.wi.us
+lib.wv.us
+lib.wy.us
+
+// k12.ma.us contains school districts in Massachusetts. The 4LDs are
+// managed indepedently except for private (PVT), charter (CHTR) and
+// parochial (PAROCH) schools. Those are delegated dorectly to the
+// 5LD operators. <k12-ma-hostmaster _ at _ rsuc.gweep.net>
+pvt.k12.ma.us
+chtr.k12.ma.us
+paroch.k12.ma.us
+
+// uy : http://www.antel.com.uy/
+*.uy
+
+// uz : http://www.reg.uz/registerr.html
+// are there other 2nd level tlds ?
+uz
+com.uz
+co.uz
+
+// va : http://en.wikipedia.org/wiki/.va
+va
+
+// vc : http://en.wikipedia.org/wiki/.vc
+// Submitted by registry <kshah@ca.afilias.info> 2008-06-13
+vc
+com.vc
+net.vc
+org.vc
+gov.vc
+mil.vc
+edu.vc
+
+// ve : http://registro.nic.ve/nicve/registro/index.html
+*.ve
+
+// vg : http://en.wikipedia.org/wiki/.vg
+vg
+
+// vi : http://www.nic.vi/newdomainform.htm
+// http://www.nic.vi/Domain_Rules/body_domain_rules.html indicates some other
+// TLDs are "reserved", such as edu.vi and gov.vi, but doesn't actually say they
+// are available for registration (which they do not seem to be).
+vi
+co.vi
+com.vi
+k12.vi
+net.vi
+org.vi
+
+// vn : https://www.dot.vn/vnnic/vnnic/domainregistration.jsp
+vn
+com.vn
+net.vn
+org.vn
+edu.vn
+gov.vn
+int.vn
+ac.vn
+biz.vn
+info.vn
+name.vn
+pro.vn
+health.vn
+
+// vu : http://en.wikipedia.org/wiki/.vu
+// list of 2nd level tlds ?
+vu
+
+// wf : http://www.afnic.fr/medias/documents/AFNIC-naming-policy2012.pdf
+wf
+
+// ws : http://en.wikipedia.org/wiki/.ws
+// http://samoanic.ws/index.dhtml
+ws
+com.ws
+net.ws
+org.ws
+gov.ws
+edu.ws
+
+// yt : http://www.afnic.fr/medias/documents/AFNIC-naming-policy2012.pdf
+yt
+
+// IDN ccTLDs
+// Please sort by ISO 3166 ccTLD, then punicode string
+// when submitting patches and follow this format:
+// <Punicode> ("<english word>" <language>) : <ISO 3166 ccTLD>
+// [optional sponsoring org]
+// <URL>
+
+// xn--mgbaam7a8h ("Emerat" Arabic) : AE
+//http://nic.ae/english/arabicdomain/rules.jsp
+امارات
+
+// xn--54b7fta0cc ("Bangla" Bangla) : BD
+বাংলা
+
+// xn--fiqs8s ("China" Chinese-Han-Simplified <.Zhonggou>) : CN
+// CNNIC
+// http://cnnic.cn/html/Dir/2005/10/11/3218.htm
+中国
+
+// xn--fiqz9s ("China" Chinese-Han-Traditional <.Zhonggou>) : CN
+// CNNIC
+// http://cnnic.cn/html/Dir/2005/10/11/3218.htm
+中國
+
+// xn--lgbbat1ad8j ("Algeria / Al Jazair" Arabic) : DZ
+الجزائر
+
+// xn--wgbh1c ("Egypt" Arabic .masr) : EG
+// http://www.dotmasr.eg/
+مصر
+
+// xn--node ("ge" Georgian (Mkhedruli)) : GE
+გე
+
+// xn--j6w193g ("Hong Kong" Chinese-Han) : HK
+// https://www2.hkirc.hk/register/rules.jsp
+香港
+
+// xn--h2brj9c ("Bharat" Devanagari) : IN
+// India
+भारत
+
+// xn--mgbbh1a71e ("Bharat" Arabic) : IN
+// India
+بھارت
+
+// xn--fpcrj9c3d ("Bharat" Telugu) : IN
+// India
+భారత్
+
+// xn--gecrj9c ("Bharat" Gujarati) : IN
+// India
+ભારત
+
+// xn--s9brj9c ("Bharat" Gurmukhi) : IN
+// India
+ਭਾਰਤ
+
+// xn--45brj9c ("Bharat" Bengali) : IN
+// India
+ভারত
+
+// xn--xkc2dl3a5ee0h ("India" Tamil) : IN
+// India
+இந்தியா
+
+// xn--mgba3a4f16a ("Iran" Persian) : IR
+ایران
+
+// xn--mgba3a4fra ("Iran" Arabic) : IR
+ايران
+
+//xn--mgbayh7gpa ("al-Ordon" Arabic) JO
+//National Information Technology Center (NITC)
+//Royal Scientific Society, Al-Jubeiha
+الاردن
+
+// xn--3e0b707e ("Republic of Korea" Hangul) : KR
+한국
+
+// xn--fzc2c9e2c ("Lanka" Sinhalese-Sinhala) : LK
+// http://nic.lk
+ලංකා
+
+// xn--xkc2al3hye2a ("Ilangai" Tamil) : LK
+// http://nic.lk
+இலங்கை
+
+// xn--mgbc0a9azcg ("Morocco / al-Maghrib" Arabic) : MA
+المغرب
+
+// xn--mgb9awbf ("Oman" Arabic) : OM
+عمان
+
+// xn--ygbi2ammx ("Falasteen" Arabic) : PS
+// The Palestinian National Internet Naming Authority (PNINA)
+// http://www.pnina.ps
+فلسطين
+
+// xn--90a3ac ("srb" Cyrillic) : RS
+срб
+
+// xn--p1ai ("rf" Russian-Cyrillic) : RU
+// http://www.cctld.ru/en/docs/rulesrf.php
+рф
+
+// xn--wgbl6a ("Qatar" Arabic) : QA
+// http://www.ict.gov.qa/
+قطر
+
+// xn--mgberp4a5d4ar ("AlSaudiah" Arabic) : SA
+// http://www.nic.net.sa/
+السعودية
+
+// xn--mgberp4a5d4a87g ("AlSaudiah" Arabic) variant : SA
+السعودیة
+
+// xn--mgbqly7c0a67fbc ("AlSaudiah" Arabic) variant : SA
+السعودیۃ
+
+// xn--mgbqly7cvafr ("AlSaudiah" Arabic) variant : SA
+السعوديه
+
+// xn--ogbpf8fl ("Syria" Arabic) : SY
+سورية
+
+// xn--mgbtf8fl ("Syria" Arabic) variant : SY
+سوريا
+
+// xn--yfro4i67o Singapore ("Singapore" Chinese-Han) : SG
+新加坡
+
+// xn--clchc0ea0b2g2a9gcd ("Singapore" Tamil) : SG
+சிங்கப்பூர்
+
+// xn--o3cw4h ("Thai" Thai) : TH
+// http://www.thnic.co.th
+ไทย
+
+// xn--pgbs0dh ("Tunis") : TN
+// http://nic.tn
+تونس
+
+// xn--kpry57d ("Taiwan" Chinese-Han-Traditional) : TW
+// http://www.twnic.net/english/dn/dn_07a.htm
+台灣
+
+// xn--kprw13d ("Taiwan" Chinese-Han-Simplified) : TW
+// http://www.twnic.net/english/dn/dn_07a.htm
+台湾
+
+// xn--nnx388a ("Taiwan") variant : TW
+臺灣
+
+// xn--j1amh ("ukr" Cyrillic) : UA
+укр
+
+// xn--mgb2ddes ("AlYemen" Arabic) : YE
+اليمن
+
+// xxx : http://icmregistry.com
+xxx
+
+// ye : http://www.y.net.ye/services/domain_name.htm
+*.ye
+
+// za : http://www.zadna.org.za/slds.html
+*.za
+
+// zm : http://en.wikipedia.org/wiki/.zm
+*.zm
+
+// zw : http://en.wikipedia.org/wiki/.zw
+*.zw
+
+// ===END ICANN DOMAINS===
+// ===BEGIN PRIVATE DOMAINS===
+
+// info.at : http://www.info.at/
+biz.at
+info.at
+
+// priv.at : http://www.nic.priv.at/
+// Submitted by registry <lendl@nic.at> 2008-06-09
+priv.at
+
+// co.ca : http://registry.co.ca
+co.ca
+
+// CentralNic : http://www.centralnic.com/names/domains
+// Confirmed by registry <gavin.brown@centralnic.com> 2008-06-09
+ar.com
+br.com
+cn.com
+de.com
+eu.com
+gb.com
+gr.com
+hu.com
+jpn.com
+kr.com
+no.com
+qc.com
+ru.com
+sa.com
+se.com
+uk.com
+us.com
+uy.com
+za.com
+gb.net
+jp.net
+se.net
+uk.net
+ae.org
+us.org
+com.de
+
+// Opera Software, A.S.A.
+// Requested by Yngve Pettersen <yngve@opera.com> 2009-11-26
+operaunite.com
+
+// Google, Inc.
+// Requested by Eduardo Vela <evn@google.com> 2010-09-06
+appspot.com
+
+// iki.fi : Submitted by Hannu Aronsson <haa@iki.fi> 2009-11-05
+iki.fi
+
+// c.la : http://www.c.la/
+c.la
+
+// ZaNiC : http://www.za.net/
+// Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
+za.net
+za.org
+
+// CoDNS B.V.
+// Added 2010-05-23.
+co.nl
+co.no
+
+// Mainseek Sp. z o.o. : http://www.co.pl/
+co.pl
+
+// DynDNS.com : http://www.dyndns.com/services/dns/dyndns/
+dyndns-at-home.com
+dyndns-at-work.com
+dyndns-blog.com
+dyndns-free.com
+dyndns-home.com
+dyndns-ip.com
+dyndns-mail.com
+dyndns-office.com
+dyndns-pics.com
+dyndns-remote.com
+dyndns-server.com
+dyndns-web.com
+dyndns-wiki.com
+dyndns-work.com
+dyndns.biz
+dyndns.info
+dyndns.org
+dyndns.tv
+at-band-camp.net
+ath.cx
+barrel-of-knowledge.info
+barrell-of-knowledge.info
+better-than.tv
+blogdns.com
+blogdns.net
+blogdns.org
+blogsite.org
+boldlygoingnowhere.org
+broke-it.net
+buyshouses.net
+cechire.com
+dnsalias.com
+dnsalias.net
+dnsalias.org
+dnsdojo.com
+dnsdojo.net
+dnsdojo.org
+does-it.net
+doesntexist.com
+doesntexist.org
+dontexist.com
+dontexist.net
+dontexist.org
+doomdns.com
+doomdns.org
+dvrdns.org
+dyn-o-saur.com
+dynalias.com
+dynalias.net
+dynalias.org
+dynathome.net
+dyndns.ws
+endofinternet.net
+endofinternet.org
+endoftheinternet.org
+est-a-la-maison.com
+est-a-la-masion.com
+est-le-patron.com
+est-mon-blogueur.com
+for-better.biz
+for-more.biz
+for-our.info
+for-some.biz
+for-the.biz
+forgot.her.name
+forgot.his.name
+from-ak.com
+from-al.com
+from-ar.com
+from-az.net
+from-ca.com
+from-co.net
+from-ct.com
+from-dc.com
+from-de.com
+from-fl.com
+from-ga.com
+from-hi.com
+from-ia.com
+from-id.com
+from-il.com
+from-in.com
+from-ks.com
+from-ky.com
+from-la.net
+from-ma.com
+from-md.com
+from-me.org
+from-mi.com
+from-mn.com
+from-mo.com
+from-ms.com
+from-mt.com
+from-nc.com
+from-nd.com
+from-ne.com
+from-nh.com
+from-nj.com
+from-nm.com
+from-nv.com
+from-ny.net
+from-oh.com
+from-ok.com
+from-or.com
+from-pa.com
+from-pr.com
+from-ri.com
+from-sc.com
+from-sd.com
+from-tn.com
+from-tx.com
+from-ut.com
+from-va.com
+from-vt.com
+from-wa.com
+from-wi.com
+from-wv.com
+from-wy.com
+ftpaccess.cc
+fuettertdasnetz.de
+game-host.org
+game-server.cc
+getmyip.com
+gets-it.net
+go.dyndns.org
+gotdns.com
+gotdns.org
+groks-the.info
+groks-this.info
+ham-radio-op.net
+here-for-more.info
+hobby-site.com
+hobby-site.org
+home.dyndns.org
+homedns.org
+homeftp.net
+homeftp.org
+homeip.net
+homelinux.com
+homelinux.net
+homelinux.org
+homeunix.com
+homeunix.net
+homeunix.org
+iamallama.com
+in-the-band.net
+is-a-anarchist.com
+is-a-blogger.com
+is-a-bookkeeper.com
+is-a-bruinsfan.org
+is-a-bulls-fan.com
+is-a-candidate.org
+is-a-caterer.com
+is-a-celticsfan.org
+is-a-chef.com
+is-a-chef.net
+is-a-chef.org
+is-a-conservative.com
+is-a-cpa.com
+is-a-cubicle-slave.com
+is-a-democrat.com
+is-a-designer.com
+is-a-doctor.com
+is-a-financialadvisor.com
+is-a-geek.com
+is-a-geek.net
+is-a-geek.org
+is-a-green.com
+is-a-guru.com
+is-a-hard-worker.com
+is-a-hunter.com
+is-a-knight.org
+is-a-landscaper.com
+is-a-lawyer.com
+is-a-liberal.com
+is-a-libertarian.com
+is-a-linux-user.org
+is-a-llama.com
+is-a-musician.com
+is-a-nascarfan.com
+is-a-nurse.com
+is-a-painter.com
+is-a-patsfan.org
+is-a-personaltrainer.com
+is-a-photographer.com
+is-a-player.com
+is-a-republican.com
+is-a-rockstar.com
+is-a-socialist.com
+is-a-soxfan.org
+is-a-student.com
+is-a-teacher.com
+is-a-techie.com
+is-a-therapist.com
+is-an-accountant.com
+is-an-actor.com
+is-an-actress.com
+is-an-anarchist.com
+is-an-artist.com
+is-an-engineer.com
+is-an-entertainer.com
+is-by.us
+is-certified.com
+is-found.org
+is-gone.com
+is-into-anime.com
+is-into-cars.com
+is-into-cartoons.com
+is-into-games.com
+is-leet.com
+is-lost.org
+is-not-certified.com
+is-saved.org
+is-slick.com
+is-uberleet.com
+is-very-bad.org
+is-very-evil.org
+is-very-good.org
+is-very-nice.org
+is-very-sweet.org
+is-with-theband.com
+isa-geek.com
+isa-geek.net
+isa-geek.org
+isa-hockeynut.com
+issmarterthanyou.com
+isteingeek.de
+istmein.de
+kicks-ass.net
+kicks-ass.org
+knowsitall.info
+land-4-sale.us
+lebtimnetz.de
+leitungsen.de
+likes-pie.com
+likescandy.com
+merseine.nu
+mine.nu
+misconfused.org
+mypets.ws
+myphotos.cc
+neat-url.com
+office-on-the.net
+on-the-web.tv
+podzone.net
+podzone.org
+readmyblog.org
+saves-the-whales.com
+scrapper-site.net
+scrapping.cc
+selfip.biz
+selfip.com
+selfip.info
+selfip.net
+selfip.org
+sells-for-less.com
+sells-for-u.com
+sells-it.net
+sellsyourhome.org
+servebbs.com
+servebbs.net
+servebbs.org
+serveftp.net
+serveftp.org
+servegame.org
+shacknet.nu
+simple-url.com
+space-to-rent.com
+stuff-4-sale.org
+stuff-4-sale.us
+teaches-yoga.com
+thruhere.net
+traeumtgerade.de
+webhop.biz
+webhop.info
+webhop.net
+webhop.org
+worse-than.tv
+writesthisblog.com
+
+// ===END PRIVATE DOMAINS===
--- /dev/null
+/*
+ * Copyright GoInstant, Inc. and other contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+var vows = require('vows');
+var assert = require('assert');
+var async = require('async');
+
+// NOTE use require("tough-cookie") in your own code:
+var tough = require('./lib/cookie');
+var Cookie = tough.Cookie;
+var CookieJar = tough.CookieJar;
+
+
+function dateVows(table) {
+ var theVows = { };
+ var keys = Object.keys(table).forEach(function(date) {
+ var expect = table[date];
+ theVows[date] = function() {
+ var got = tough.parseDate(date) ? 'valid' : 'invalid';
+ assert.equal(got, expect ? 'valid' : 'invalid');
+ };
+ });
+ return { "date parsing": theVows };
+}
+
+function matchVows(func,table) {
+ var theVows = {};
+ table.forEach(function(item) {
+ var str = item[0];
+ var dom = item[1];
+ var expect = item[2];
+ var label = str+(expect?" matches ":" doesn't match ")+dom;
+ theVows[label] = function() {
+ assert.equal(func(str,dom),expect);
+ };
+ });
+ return theVows;
+}
+
+function defaultPathVows(table) {
+ var theVows = {};
+ table.forEach(function(item) {
+ var str = item[0];
+ var expect = item[1];
+ var label = str+" gives "+expect;
+ theVows[label] = function() {
+ assert.equal(tough.defaultPath(str),expect);
+ };
+ });
+ return theVows;
+}
+
+var atNow = Date.now();
+function at(offset) { return {now: new Date(atNow+offset)} }
+
+vows.describe('Cookie Jar')
+.addBatch({
+ "all defined": function() {
+ assert.ok(Cookie);
+ assert.ok(CookieJar);
+ },
+})
+.addBatch(
+ dateVows({
+ "Wed, 09 Jun 2021 10:18:14 GMT": true,
+ "Wed, 09 Jun 2021 22:18:14 GMT": true,
+ "Tue, 18 Oct 2011 07:42:42.123 GMT": true,
+ "18 Oct 2011 07:42:42 GMT": true,
+ "8 Oct 2011 7:42:42 GMT": true,
+ "8 Oct 2011 7:2:42 GMT": false,
+ "Oct 18 2011 07:42:42 GMT": true,
+ "Tue Oct 18 2011 07:05:03 GMT+0000 (GMT)": true,
+ "09 Jun 2021 10:18:14 GMT": true,
+ "99 Jix 3038 48:86:72 ZMT": false,
+ '01 Jan 1970 00:00:00 GMT': true,
+ '01 Jan 1600 00:00:00 GMT': false, // before 1601
+ '01 Jan 1601 00:00:00 GMT': true,
+ '10 Feb 81 13:00:00 GMT': true, // implicit year
+ 'Thu, 01 Jan 1970 00:00:010 GMT': true, // strange time, non-strict OK
+ 'Thu, 17-Apr-2014 02:12:29 GMT': true, // dashes
+ 'Thu, 17-Apr-2014 02:12:29 UTC': true, // dashes and UTC
+ })
+)
+.addBatch({
+ "strict date parse of Thu, 01 Jan 1970 00:00:010 GMT": {
+ topic: function() {
+ return tough.parseDate('Thu, 01 Jan 1970 00:00:010 GMT', true) ? true : false;
+ },
+ "invalid": function(date) {
+ assert.equal(date,false);
+ },
+ }
+})
+.addBatch({
+ "formatting": {
+ "a simple cookie": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ return c;
+ },
+ "validates": function(c) {
+ assert.ok(c.validate());
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a=b');
+ },
+ },
+ "a cookie with spaces in the value": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'beta gamma';
+ return c;
+ },
+ "doesn't validate": function(c) {
+ assert.ok(!c.validate());
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a="beta gamma"');
+ },
+ },
+ "with an empty value and HttpOnly": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.httpOnly = true;
+ return c;
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a=; HttpOnly');
+ }
+ },
+ "with an expiry": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ c.setExpires("Oct 18 2011 07:05:03 GMT");
+ return c;
+ },
+ "validates": function(c) {
+ assert.ok(c.validate());
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a=b; Expires=Tue, 18 Oct 2011 07:05:03 GMT');
+ },
+ "to short string": function(c) {
+ assert.equal(c.cookieString(), 'a=b');
+ },
+ },
+ "with a max-age": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ c.setExpires("Oct 18 2011 07:05:03 GMT");
+ c.maxAge = 12345;
+ return c;
+ },
+ "validates": function(c) {
+ assert.ok(c.validate()); // mabe this one *shouldn't*?
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a=b; Expires=Tue, 18 Oct 2011 07:05:03 GMT; Max-Age=12345');
+ },
+ },
+ "with a bunch of things": function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ c.setExpires("Oct 18 2011 07:05:03 GMT");
+ c.maxAge = 12345;
+ c.domain = 'example.com';
+ c.path = '/foo';
+ c.secure = true;
+ c.httpOnly = true;
+ c.extensions = ['MyExtension'];
+ assert.equal(c.toString(), 'a=b; Expires=Tue, 18 Oct 2011 07:05:03 GMT; Max-Age=12345; Domain=example.com; Path=/foo; Secure; HttpOnly; MyExtension');
+ },
+ "a host-only cookie": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ c.hostOnly = true;
+ c.domain = 'shouldnt-stringify.example.com';
+ c.path = '/should-stringify';
+ return c;
+ },
+ "validates": function(c) {
+ assert.ok(c.validate());
+ },
+ "to string": function(c) {
+ assert.equal(c.toString(), 'a=b; Path=/should-stringify');
+ },
+ },
+ "minutes are '10'": {
+ topic: function() {
+ var c = new Cookie();
+ c.key = 'a';
+ c.value = 'b';
+ c.expires = new Date(1284113410000);
+ return c;
+ },
+ "validates": function(c) {
+ assert.ok(c.validate());
+ },
+ "to string": function(c) {
+ var str = c.toString();
+ assert.notEqual(str, 'a=b; Expires=Fri, 010 Sep 2010 010:010:010 GMT');
+ assert.equal(str, 'a=b; Expires=Fri, 10 Sep 2010 10:10:10 GMT');
+ },
+ }
+ }
+})
+.addBatch({
+ "TTL with max-age": function() {
+ var c = new Cookie();
+ c.maxAge = 123;
+ assert.equal(c.TTL(), 123000);
+ assert.equal(c.expiryTime(new Date(9000000)), 9123000);
+ },
+ "TTL with zero max-age": function() {
+ var c = new Cookie();
+ c.key = 'a'; c.value = 'b';
+ c.maxAge = 0; // should be treated as "earliest representable"
+ assert.equal(c.TTL(), 0);
+ assert.equal(c.expiryTime(new Date(9000000)), -Infinity);
+ assert.ok(!c.validate()); // not valid, really: non-zero-digit *DIGIT
+ },
+ "TTL with negative max-age": function() {
+ var c = new Cookie();
+ c.key = 'a'; c.value = 'b';
+ c.maxAge = -1; // should be treated as "earliest representable"
+ assert.equal(c.TTL(), 0);
+ assert.equal(c.expiryTime(new Date(9000000)), -Infinity);
+ assert.ok(!c.validate()); // not valid, really: non-zero-digit *DIGIT
+ },
+ "TTL with max-age and expires": function() {
+ var c = new Cookie();
+ c.maxAge = 123;
+ c.expires = new Date(Date.now()+9000);
+ assert.equal(c.TTL(), 123000);
+ assert.ok(c.isPersistent());
+ },
+ "TTL with expires": function() {
+ var c = new Cookie();
+ var now = Date.now();
+ c.expires = new Date(now+9000);
+ assert.equal(c.TTL(now), 9000);
+ assert.equal(c.expiryTime(), c.expires.getTime());
+ },
+ "TTL with old expires": function() {
+ var c = new Cookie();
+ c.setExpires('17 Oct 2010 00:00:00 GMT');
+ assert.ok(c.TTL() < 0);
+ assert.ok(c.isPersistent());
+ },
+ "default TTL": {
+ topic: function() { return new Cookie() },
+ "is Infinite-future": function(c) { assert.equal(c.TTL(), Infinity) },
+ "is a 'session' cookie": function(c) { assert.ok(!c.isPersistent()) },
+ },
+}).addBatch({
+ "Parsing": {
+ "simple": {
+ topic: function() {
+ return Cookie.parse('a=bcd',true) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'a') },
+ "value": function(c) { assert.equal(c.value, 'bcd') },
+ "no path": function(c) { assert.equal(c.path, null) },
+ "no domain": function(c) { assert.equal(c.domain, null) },
+ "no extensions": function(c) { assert.ok(!c.extensions) },
+ },
+ "with expiry": {
+ topic: function() {
+ return Cookie.parse('a=bcd; Expires=Tue, 18 Oct 2011 07:05:03 GMT',true) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'a') },
+ "value": function(c) { assert.equal(c.value, 'bcd') },
+ "has expires": function(c) {
+ assert.ok(c.expires !== Infinity, 'expiry is infinite when it shouldn\'t be');
+ assert.equal(c.expires.getTime(), 1318921503000);
+ },
+ },
+ "with expiry and path": {
+ topic: function() {
+ return Cookie.parse('abc="xyzzy!"; Expires=Tue, 18 Oct 2011 07:05:03 GMT; Path=/aBc',true) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'abc') },
+ "value": function(c) { assert.equal(c.value, 'xyzzy!') },
+ "has expires": function(c) {
+ assert.ok(c.expires !== Infinity, 'expiry is infinite when it shouldn\'t be');
+ assert.equal(c.expires.getTime(), 1318921503000);
+ },
+ "has path": function(c) { assert.equal(c.path, '/aBc'); },
+ "no httponly or secure": function(c) {
+ assert.ok(!c.httpOnly);
+ assert.ok(!c.secure);
+ },
+ },
+ "with everything": {
+ topic: function() {
+ return Cookie.parse('abc="xyzzy!"; Expires=Tue, 18 Oct 2011 07:05:03 GMT; Path=/aBc; Domain=example.com; Secure; HTTPOnly; Max-Age=1234; Foo=Bar; Baz', true) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'abc') },
+ "value": function(c) { assert.equal(c.value, 'xyzzy!') },
+ "has expires": function(c) {
+ assert.ok(c.expires !== Infinity, 'expiry is infinite when it shouldn\'t be');
+ assert.equal(c.expires.getTime(), 1318921503000);
+ },
+ "has path": function(c) { assert.equal(c.path, '/aBc'); },
+ "has domain": function(c) { assert.equal(c.domain, 'example.com'); },
+ "has httponly": function(c) { assert.equal(c.httpOnly, true); },
+ "has secure": function(c) { assert.equal(c.secure, true); },
+ "has max-age": function(c) { assert.equal(c.maxAge, 1234); },
+ "has extensions": function(c) {
+ assert.ok(c.extensions);
+ assert.equal(c.extensions[0], 'Foo=Bar');
+ assert.equal(c.extensions[1], 'Baz');
+ },
+ },
+ "invalid expires": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; Expires=xyzzy", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; Expires=xyzzy");
+ assert.ok(c);
+ assert.equal(c.expires, Infinity);
+ },
+ },
+ "zero max-age": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; Max-Age=0", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; Max-Age=0");
+ assert.ok(c);
+ assert.equal(c.maxAge, 0);
+ },
+ },
+ "negative max-age": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; Max-Age=-1", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; Max-Age=-1");
+ assert.ok(c);
+ assert.equal(c.maxAge, -1);
+ },
+ },
+ "empty domain": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; domain=", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; domain=");
+ assert.ok(c);
+ assert.equal(c.domain, null);
+ },
+ },
+ "dot domain": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; domain=.", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; domain=.");
+ assert.ok(c);
+ assert.equal(c.domain, null);
+ },
+ },
+ "uppercase domain": {
+ "strict lowercases": function() {
+ var c = Cookie.parse("a=b; domain=EXAMPLE.COM");
+ assert.ok(c);
+ assert.equal(c.domain, 'example.com');
+ },
+ "non-strict lowercases": function() {
+ var c = Cookie.parse("a=b; domain=EXAMPLE.COM");
+ assert.ok(c);
+ assert.equal(c.domain, 'example.com');
+ },
+ },
+ "trailing dot in domain": {
+ topic: function() {
+ return Cookie.parse("a=b; Domain=example.com.", true) || null;
+ },
+ "has the domain": function(c) { assert.equal(c.domain,"example.com.") },
+ "but doesn't validate": function(c) { assert.equal(c.validate(),false) },
+ },
+ "empty path": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; path=", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; path=");
+ assert.ok(c);
+ assert.equal(c.path, null);
+ },
+ },
+ "no-slash path": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; path=xyzzy", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; path=xyzzy");
+ assert.ok(c);
+ assert.equal(c.path, null);
+ },
+ },
+ "trailing semi-colons after path": {
+ topic: function () {
+ return [
+ "a=b; path=/;",
+ "c=d;;;;"
+ ];
+ },
+ "strict": function (t) {
+ assert.ok(!Cookie.parse(t[0], true));
+ assert.ok(!Cookie.parse(t[1], true));
+ },
+ "non-strict": function (t) {
+ var c1 = Cookie.parse(t[0]);
+ var c2 = Cookie.parse(t[1]);
+ assert.ok(c1);
+ assert.ok(c2);
+ assert.equal(c1.path, '/');
+ }
+ },
+ "secure-with-value": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; Secure=xyzzy", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; Secure=xyzzy");
+ assert.ok(c);
+ assert.equal(c.secure, true);
+ },
+ },
+ "httponly-with-value": {
+ "strict": function() { assert.ok(!Cookie.parse("a=b; HttpOnly=xyzzy", true)) },
+ "non-strict": function() {
+ var c = Cookie.parse("a=b; HttpOnly=xyzzy");
+ assert.ok(c);
+ assert.equal(c.httpOnly, true);
+ },
+ },
+ "garbage": {
+ topic: function() {
+ return Cookie.parse("\x08", true) || null;
+ },
+ "doesn't parse": function(c) { assert.equal(c,null) },
+ },
+ "public suffix domain": {
+ topic: function() {
+ return Cookie.parse("a=b; domain=kyoto.jp", true) || null;
+ },
+ "parses fine": function(c) {
+ assert.ok(c);
+ assert.equal(c.domain, 'kyoto.jp');
+ },
+ "but fails validation": function(c) {
+ assert.ok(c);
+ assert.ok(!c.validate());
+ },
+ },
+ "Ironically, Google 'GAPS' cookie has very little whitespace": {
+ topic: function() {
+ return Cookie.parse("GAPS=1:A1aaaaAaAAa1aaAaAaaAAAaaa1a11a:aaaAaAaAa-aaaA1-;Path=/;Expires=Thu, 17-Apr-2014 02:12:29 GMT;Secure;HttpOnly");
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'GAPS') },
+ "value": function(c) { assert.equal(c.value, '1:A1aaaaAaAAa1aaAaAaaAAAaaa1a11a:aaaAaAaAa-aaaA1-') },
+ "path": function(c) {
+ assert.notEqual(c.path, '/;Expires'); // BUG
+ assert.equal(c.path, '/');
+ },
+ "expires": function(c) {
+ assert.notEqual(c.expires, Infinity);
+ assert.equal(c.expires.getTime(), 1397700749000);
+ },
+ "secure": function(c) { assert.ok(c.secure) },
+ "httponly": function(c) { assert.ok(c.httpOnly) },
+ },
+ "lots of equal signs": {
+ topic: function() {
+ return Cookie.parse("queryPref=b=c&d=e; Path=/f=g; Expires=Thu, 17 Apr 2014 02:12:29 GMT; HttpOnly");
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'queryPref') },
+ "value": function(c) { assert.equal(c.value, 'b=c&d=e') },
+ "path": function(c) {
+ assert.equal(c.path, '/f=g');
+ },
+ "expires": function(c) {
+ assert.notEqual(c.expires, Infinity);
+ assert.equal(c.expires.getTime(), 1397700749000);
+ },
+ "httponly": function(c) { assert.ok(c.httpOnly) },
+ }
+ }
+})
+.addBatch({
+ "domain normalization": {
+ "simple": function() {
+ var c = new Cookie();
+ c.domain = "EXAMPLE.com";
+ assert.equal(c.canonicalizedDomain(), "example.com");
+ },
+ "extra dots": function() {
+ var c = new Cookie();
+ c.domain = ".EXAMPLE.com";
+ assert.equal(c.cdomain(), "example.com");
+ },
+ "weird trailing dot": function() {
+ var c = new Cookie();
+ c.domain = "EXAMPLE.ca.";
+ assert.equal(c.canonicalizedDomain(), "example.ca.");
+ },
+ "weird internal dots": function() {
+ var c = new Cookie();
+ c.domain = "EXAMPLE...ca.";
+ assert.equal(c.canonicalizedDomain(), "example...ca.");
+ },
+ "IDN": function() {
+ var c = new Cookie();
+ c.domain = "δοκιμή.δοκιμή"; // "test.test" in greek
+ assert.equal(c.canonicalizedDomain(), "xn--jxalpdlp.xn--jxalpdlp");
+ }
+ }
+})
+.addBatch({
+ "Domain Match":matchVows(tough.domainMatch, [
+ // str, dom, expect
+ ["example.com", "example.com", true],
+ ["eXaMpLe.cOm", "ExAmPlE.CoM", true],
+ ["no.ca", "yes.ca", false],
+ ["wwwexample.com", "example.com", false],
+ ["www.example.com", "example.com", true],
+ ["example.com", "www.example.com", false],
+ ["www.subdom.example.com", "example.com", true],
+ ["www.subdom.example.com", "subdom.example.com", true],
+ ["example.com", "example.com.", false], // RFC6265 S4.1.2.3
+ ["192.168.0.1", "168.0.1", false], // S5.1.3 "The string is a host name"
+ [null, "example.com", null],
+ ["example.com", null, null],
+ [null, null, null],
+ [undefined, undefined, null],
+ ])
+})
+.addBatch({
+ "default-path": defaultPathVows([
+ [null,"/"],
+ ["/","/"],
+ ["/file","/"],
+ ["/dir/file","/dir"],
+ ["noslash","/"],
+ ])
+})
+.addBatch({
+ "Path-Match": matchVows(tough.pathMatch, [
+ // request, cookie, match
+ ["/","/",true],
+ ["/dir","/",true],
+ ["/","/dir",false],
+ ["/dir/","/dir/", true],
+ ["/dir/file","/dir/",true],
+ ["/dir/file","/dir",true],
+ ["/directory","/dir",false],
+ ])
+})
+.addBatch({
+ "Cookie Sorting": {
+ topic: function() {
+ var cookies = [];
+ var now = Date.now();
+ cookies.push(Cookie.parse("a=0; Domain=example.com"));
+ cookies.push(Cookie.parse("b=1; Domain=www.example.com"));
+ cookies.push(Cookie.parse("c=2; Domain=example.com; Path=/pathA"));
+ cookies.push(Cookie.parse("d=3; Domain=www.example.com; Path=/pathA"));
+ cookies.push(Cookie.parse("e=4; Domain=example.com; Path=/pathA/pathB"));
+ cookies.push(Cookie.parse("f=5; Domain=www.example.com; Path=/pathA/pathB"));
+
+ // force a stable creation time consistent with the order above since
+ // some may have been created at now + 1ms.
+ var i = cookies.length;
+ cookies.forEach(function(cookie) {
+ cookie.creation = new Date(now - 100*(i--));
+ });
+
+ // weak shuffle:
+ cookies = cookies.sort(function(){return Math.random()-0.5});
+
+ cookies = cookies.sort(tough.cookieCompare);
+ return cookies;
+ },
+ "got": function(cookies) {
+ assert.lengthOf(cookies, 6);
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['e','f','c','d','a','b']);
+ },
+ }
+})
+.addBatch({
+ "CookieJar": {
+ "Setting a basic cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com; Path=/");
+ assert.strictEqual(c.hostOnly, null);
+ assert.instanceOf(c.creation, Date);
+ assert.strictEqual(c.lastAccessed, null);
+ c.creation = new Date(Date.now()-10000);
+ cj.setCookie(c, 'http://example.com/index.html', this.callback);
+ },
+ "works": function(c) { assert.instanceOf(c,Cookie) }, // C is for Cookie, good enough for me
+ "gets timestamped": function(c) {
+ assert.ok(c.creation);
+ assert.ok(Date.now() - c.creation.getTime() < 5000); // recently stamped
+ assert.ok(c.lastAccessed);
+ assert.equal(c.creation, c.lastAccessed);
+ assert.equal(c.TTL(), Infinity);
+ assert.ok(!c.isPersistent());
+ },
+ },
+ "Setting a no-path cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com");
+ assert.strictEqual(c.hostOnly, null);
+ assert.instanceOf(c.creation, Date);
+ assert.strictEqual(c.lastAccessed, null);
+ c.creation = new Date(Date.now()-10000);
+ cj.setCookie(c, 'http://example.com/index.html', this.callback);
+ },
+ "domain": function(c) { assert.equal(c.domain, 'example.com') },
+ "path is /": function(c) { assert.equal(c.path, '/') },
+ "path was derived": function(c) { assert.strictEqual(c.pathIsDefault, true) },
+ },
+ "Setting a cookie already marked as host-only": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com");
+ assert.strictEqual(c.hostOnly, null);
+ assert.instanceOf(c.creation, Date);
+ assert.strictEqual(c.lastAccessed, null);
+ c.creation = new Date(Date.now()-10000);
+ c.hostOnly = true;
+ cj.setCookie(c, 'http://example.com/index.html', this.callback);
+ },
+ "domain": function(c) { assert.equal(c.domain, 'example.com') },
+ "still hostOnly": function(c) { assert.strictEqual(c.hostOnly, true) },
+ },
+ "Setting a session cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b");
+ assert.strictEqual(c.path, null);
+ cj.setCookie(c, 'http://www.example.com/dir/index.html', this.callback);
+ },
+ "works": function(c) { assert.instanceOf(c,Cookie) },
+ "gets the domain": function(c) { assert.equal(c.domain, 'www.example.com') },
+ "gets the default path": function(c) { assert.equal(c.path, '/dir') },
+ "is 'hostOnly'": function(c) { assert.ok(c.hostOnly) },
+ },
+ "Setting wrong domain cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=fooxample.com; Path=/");
+ cj.setCookie(c, 'http://example.com/index.html', this.callback);
+ },
+ "fails": function(err,c) {
+ assert.ok(err.message.match(/domain/i));
+ assert.ok(!c);
+ },
+ },
+ "Setting sub-domain cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=www.example.com; Path=/");
+ cj.setCookie(c, 'http://example.com/index.html', this.callback);
+ },
+ "fails": function(err,c) {
+ assert.ok(err.message.match(/domain/i));
+ assert.ok(!c);
+ },
+ },
+ "Setting super-domain cookie": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com; Path=/");
+ cj.setCookie(c, 'http://www.app.example.com/index.html', this.callback);
+ },
+ "success": function(err,c) {
+ assert.ok(!err);
+ assert.equal(c.domain, 'example.com');
+ },
+ },
+ "Setting HttpOnly cookie over non-HTTP API": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com; Path=/; HttpOnly");
+ cj.setCookie(c, 'http://example.com/index.html', {http:false}, this.callback);
+ },
+ "fails": function(err,c) {
+ assert.match(err.message, /HttpOnly/i);
+ assert.ok(!c);
+ },
+ },
+ },
+ "Cookie Jar store eight cookies": {
+ topic: function() {
+ var cj = new CookieJar();
+ var ex = 'http://example.com/index.html';
+ var tasks = [];
+ tasks.push(function(next) {
+ cj.setCookie('a=1; Domain=example.com; Path=/',ex,at(0),next);
+ });
+ tasks.push(function(next) {
+ cj.setCookie('b=2; Domain=example.com; Path=/; HttpOnly',ex,at(1000),next);
+ });
+ tasks.push(function(next) {
+ cj.setCookie('c=3; Domain=example.com; Path=/; Secure',ex,at(2000),next);
+ });
+ tasks.push(function(next) { // path
+ cj.setCookie('d=4; Domain=example.com; Path=/foo',ex,at(3000),next);
+ });
+ tasks.push(function(next) { // host only
+ cj.setCookie('e=5',ex,at(4000),next);
+ });
+ tasks.push(function(next) { // other domain
+ cj.setCookie('f=6; Domain=nodejs.org; Path=/','http://nodejs.org',at(5000),next);
+ });
+ tasks.push(function(next) { // expired
+ cj.setCookie('g=7; Domain=example.com; Path=/; Expires=Tue, 18 Oct 2011 00:00:00 GMT',ex,at(6000),next);
+ });
+ tasks.push(function(next) { // expired via Max-Age
+ cj.setCookie('h=8; Domain=example.com; Path=/; Max-Age=1',ex,next);
+ });
+ var cb = this.callback;
+ async.parallel(tasks, function(err,results){
+ setTimeout(function() {
+ cb(err,cj,results);
+ }, 2000); // so that 'h=8' expires
+ });
+ },
+ "setup ok": function(err,cj,results) {
+ assert.ok(1);
+ },
+ "then retrieving for http://nodejs.org": {
+ topic: function(cj,results) {
+ cj.getCookies('http://nodejs.org',this.callback);
+ },
+ "get a nodejs cookie": function(cookies) {
+ assert.lengthOf(cookies, 1);
+ var cookie = cookies[0];
+ assert.equal(cookie.domain, 'nodejs.org');
+ },
+ },
+ "then retrieving for https://example.com": {
+ topic: function(cj,results) {
+ cj.getCookies('https://example.com',{secure:true},this.callback);
+ },
+ "get a secure example cookie with others": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['a','b','c','e']);
+ },
+ },
+ "then retrieving for https://example.com (missing options)": {
+ topic: function(cj,results) {
+ cj.getCookies('https://example.com',this.callback);
+ },
+ "get a secure example cookie with others": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['a','b','c','e']);
+ },
+ },
+ "then retrieving for http://example.com": {
+ topic: function(cj,results) {
+ cj.getCookies('http://example.com',this.callback);
+ },
+ "get a bunch of cookies": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['a','b','e']);
+ },
+ },
+ "then retrieving for http://EXAMPlE.com": {
+ topic: function(cj,results) {
+ cj.getCookies('http://EXAMPlE.com',this.callback);
+ },
+ "get a bunch of cookies": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['a','b','e']);
+ },
+ },
+ "then retrieving for http://example.com, non-HTTP": {
+ topic: function(cj,results) {
+ cj.getCookies('http://example.com',{http:false},this.callback);
+ },
+ "get a bunch of cookies": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['a','e']);
+ },
+ },
+ "then retrieving for http://example.com/foo/bar": {
+ topic: function(cj,results) {
+ cj.getCookies('http://example.com/foo/bar',this.callback);
+ },
+ "get a bunch of cookies": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['d','a','b','e']);
+ },
+ },
+ "then retrieving for http://example.com as a string": {
+ topic: function(cj,results) {
+ cj.getCookieString('http://example.com',this.callback);
+ },
+ "get a single string": function(cookieHeader) {
+ assert.equal(cookieHeader, "a=1; b=2; e=5");
+ },
+ },
+ "then retrieving for http://example.com as a set-cookie header": {
+ topic: function(cj,results) {
+ cj.getSetCookieStrings('http://example.com',this.callback);
+ },
+ "get a single string": function(cookieHeaders) {
+ assert.lengthOf(cookieHeaders, 3);
+ assert.equal(cookieHeaders[0], "a=1; Domain=example.com; Path=/");
+ assert.equal(cookieHeaders[1], "b=2; Domain=example.com; Path=/; HttpOnly");
+ assert.equal(cookieHeaders[2], "e=5; Path=/");
+ },
+ },
+ "then retrieving for http://www.example.com/": {
+ topic: function(cj,results) {
+ cj.getCookies('http://www.example.com/foo/bar',this.callback);
+ },
+ "get a bunch of cookies": function(cookies) {
+ var names = cookies.map(function(c) {return c.key});
+ assert.deepEqual(names, ['d','a','b']); // note lack of 'e'
+ },
+ },
+ },
+ "Repeated names": {
+ topic: function() {
+ var cb = this.callback;
+ var cj = new CookieJar();
+ var ex = 'http://www.example.com/';
+ var sc = cj.setCookie;
+ var tasks = [];
+ var now = Date.now();
+ tasks.push(sc.bind(cj,'aaaa=xxxx',ex,at(0)));
+ tasks.push(sc.bind(cj,'aaaa=1111; Domain=www.example.com',ex,at(1000)));
+ tasks.push(sc.bind(cj,'aaaa=2222; Domain=example.com',ex,at(2000)));
+ tasks.push(sc.bind(cj,'aaaa=3333; Domain=www.example.com; Path=/pathA',ex,at(3000)));
+ async.series(tasks,function(err,results) {
+ results = results.filter(function(e) {return e !== undefined});
+ cb(err,{cj:cj, cookies:results, now:now});
+ });
+ },
+ "all got set": function(err,t) {
+ assert.lengthOf(t.cookies,4);
+ },
+ "then getting 'em back": {
+ topic: function(t) {
+ var cj = t.cj;
+ cj.getCookies('http://www.example.com/pathA',this.callback);
+ },
+ "there's just three": function (err,cookies) {
+ var vals = cookies.map(function(c) {return c.value});
+ // may break with sorting; sorting should put 3333 first due to longest path:
+ assert.deepEqual(vals, ['3333','1111','2222']);
+ }
+ },
+ },
+ "CookieJar setCookie errors": {
+ "public-suffix domain": {
+ topic: function() {
+ var cj = new CookieJar();
+ cj.setCookie('i=9; Domain=kyoto.jp; Path=/','kyoto.jp',this.callback);
+ },
+ "errors": function(err,cookie) {
+ assert.ok(err);
+ assert.ok(!cookie);
+ assert.match(err.message, /public suffix/i);
+ },
+ },
+ "wrong domain": {
+ topic: function() {
+ var cj = new CookieJar();
+ cj.setCookie('j=10; Domain=google.com; Path=/','google.ca',this.callback);
+ },
+ "errors": function(err,cookie) {
+ assert.ok(err);
+ assert.ok(!cookie);
+ assert.match(err.message, /not in this host's domain/i);
+ },
+ },
+ "old cookie is HttpOnly": {
+ topic: function() {
+ var cb = this.callback;
+ var next = function (err,c) {
+ return cb(err,cj);
+ };
+ var cj = new CookieJar();
+ cj.setCookie('k=11; Domain=example.ca; Path=/; HttpOnly','http://example.ca',{http:true},next);
+ },
+ "initial cookie is set": function(err,cj) {
+ assert.ok(!err);
+ },
+ "but when trying to overwrite": {
+ topic: function(cj) {
+ var cb = this.callback;
+ cj.setCookie('k=12; Domain=example.ca; Path=/','http://example.ca',{http:false},function(err,c) {cb(null,err)});
+ },
+ "it's an error": function(err) {
+ assert.ok(err);
+ },
+ "then, checking the original": {
+ topic: function(ignored,cj) {
+ assert.ok(cj instanceof CookieJar);
+ cj.getCookies('http://example.ca',{http:true},this.callback);
+ },
+ "cookie has original value": function(err,cookies) {
+ assert.equal(err,null);
+ assert.lengthOf(cookies, 1);
+ assert.equal(cookies[0].value,11);
+ },
+ },
+ },
+ },
+ },
+})
+.addBatch({
+ "JSON": {
+ "serialization": {
+ topic: function() {
+ var c = Cookie.parse('alpha=beta; Domain=example.com; Path=/foo; Expires=Tue, 19 Jan 2038 03:14:07 GMT; HttpOnly');
+ return JSON.stringify(c);
+ },
+ "gives a string": function(str) {
+ assert.equal(typeof str, "string");
+ },
+ "date is in ISO format": function(str) {
+ assert.match(str, /"expires":"2038-01-19T03:14:07\.000Z"/, 'expires is in ISO format');
+ },
+ },
+ "deserialization": {
+ topic: function() {
+ var json = '{"key":"alpha","value":"beta","domain":"example.com","path":"/foo","expires":"2038-01-19T03:14:07.000Z","httpOnly":true,"lastAccessed":2000000000123}';
+ return Cookie.fromJSON(json);
+ },
+ "works": function(c) {
+ assert.ok(c);
+ },
+ "key": function(c) { assert.equal(c.key, "alpha") },
+ "value": function(c) { assert.equal(c.value, "beta") },
+ "domain": function(c) { assert.equal(c.domain, "example.com") },
+ "path": function(c) { assert.equal(c.path, "/foo") },
+ "httpOnly": function(c) { assert.strictEqual(c.httpOnly, true) },
+ "secure": function(c) { assert.strictEqual(c.secure, false) },
+ "hostOnly": function(c) { assert.strictEqual(c.hostOnly, null) },
+ "expires is a date object": function(c) {
+ assert.equal(c.expires.getTime(), 2147483647000);
+ },
+ "lastAccessed is a date object": function(c) {
+ assert.equal(c.lastAccessed.getTime(), 2000000000123);
+ },
+ "creation defaulted": function(c) {
+ assert.ok(c.creation.getTime());
+ }
+ },
+ "null deserialization": {
+ topic: function() {
+ return Cookie.fromJSON(null);
+ },
+ "is null": function(cookie) {
+ assert.equal(cookie,null);
+ },
+ },
+ },
+ "expiry deserialization": {
+ "Infinity": {
+ topic: Cookie.fromJSON.bind(null, '{"expires":"Infinity"}'),
+ "is infinite": function(c) {
+ assert.strictEqual(c.expires, "Infinity");
+ assert.equal(c.expires, Infinity);
+ },
+ },
+ },
+ "maxAge serialization": {
+ topic: function() {
+ return function(toSet) {
+ var c = new Cookie();
+ c.key = 'foo'; c.value = 'bar';
+ c.setMaxAge(toSet);
+ return JSON.stringify(c);
+ };
+ },
+ "zero": {
+ topic: function(f) { return f(0) },
+ "looks good": function(str) {
+ assert.match(str, /"maxAge":0/);
+ },
+ },
+ "Infinity": {
+ topic: function(f) { return f(Infinity) },
+ "looks good": function(str) {
+ assert.match(str, /"maxAge":"Infinity"/);
+ },
+ },
+ "-Infinity": {
+ topic: function(f) { return f(-Infinity) },
+ "looks good": function(str) {
+ assert.match(str, /"maxAge":"-Infinity"/);
+ },
+ },
+ "null": {
+ topic: function(f) { return f(null) },
+ "looks good": function(str) {
+ assert.match(str, /"maxAge":null/);
+ },
+ },
+ },
+ "maxAge deserialization": {
+ "number": {
+ topic: Cookie.fromJSON.bind(null,'{"key":"foo","value":"bar","maxAge":123}'),
+ "is the number": function(c) {
+ assert.strictEqual(c.maxAge, 123);
+ },
+ },
+ "null": {
+ topic: Cookie.fromJSON.bind(null,'{"key":"foo","value":"bar","maxAge":null}'),
+ "is null": function(c) {
+ assert.strictEqual(c.maxAge, null);
+ },
+ },
+ "less than zero": {
+ topic: Cookie.fromJSON.bind(null,'{"key":"foo","value":"bar","maxAge":-123}'),
+ "is -123": function(c) {
+ assert.strictEqual(c.maxAge, -123);
+ },
+ },
+ "Infinity": {
+ topic: Cookie.fromJSON.bind(null,'{"key":"foo","value":"bar","maxAge":"Infinity"}'),
+ "is inf-as-string": function(c) {
+ assert.strictEqual(c.maxAge, "Infinity");
+ },
+ },
+ "-Infinity": {
+ topic: Cookie.fromJSON.bind(null,'{"key":"foo","value":"bar","maxAge":"-Infinity"}'),
+ "is inf-as-string": function(c) {
+ assert.strictEqual(c.maxAge, "-Infinity");
+ },
+ },
+ }
+})
+.addBatch({
+ "permuteDomain": {
+ "base case": {
+ topic: tough.permuteDomain.bind(null,'example.com'),
+ "got the domain": function(list) {
+ assert.deepEqual(list, ['example.com']);
+ },
+ },
+ "two levels": {
+ topic: tough.permuteDomain.bind(null,'foo.bar.example.com'),
+ "got three things": function(list) {
+ assert.deepEqual(list, ['example.com','bar.example.com','foo.bar.example.com']);
+ },
+ },
+ "invalid domain": {
+ topic: tough.permuteDomain.bind(null,'foo.bar.example.localduhmain'),
+ "got three things": function(list) {
+ assert.equal(list, null);
+ },
+ },
+ },
+ "permutePath": {
+ "base case": {
+ topic: tough.permutePath.bind(null,'/'),
+ "just slash": function(list) {
+ assert.deepEqual(list,['/']);
+ },
+ },
+ "single case": {
+ topic: tough.permutePath.bind(null,'/foo'),
+ "two things": function(list) {
+ assert.deepEqual(list,['/foo','/']);
+ },
+ "path matching": function(list) {
+ list.forEach(function(e) {
+ assert.ok(tough.pathMatch('/foo',e));
+ });
+ },
+ },
+ "double case": {
+ topic: tough.permutePath.bind(null,'/foo/bar'),
+ "four things": function(list) {
+ assert.deepEqual(list,['/foo/bar','/foo','/']);
+ },
+ "path matching": function(list) {
+ list.forEach(function(e) {
+ assert.ok(tough.pathMatch('/foo/bar',e));
+ });
+ },
+ },
+ "trailing slash": {
+ topic: tough.permutePath.bind(null,'/foo/bar/'),
+ "three things": function(list) {
+ assert.deepEqual(list,['/foo/bar','/foo','/']);
+ },
+ "path matching": function(list) {
+ list.forEach(function(e) {
+ assert.ok(tough.pathMatch('/foo/bar/',e));
+ });
+ },
+ },
+ }
+})
+.addBatch({
+ "Issue 1": {
+ topic: function() {
+ var cj = new CookieJar();
+ cj.setCookie('hello=world; path=/some/path/', 'http://domain/some/path/file', function(err,cookie) {
+ this.callback(err,{cj:cj, cookie:cookie});
+ }.bind(this));
+ },
+ "stored a cookie": function(t) {
+ assert.ok(t.cookie);
+ },
+ "cookie's path was modified to remove unnecessary slash": function(t) {
+ assert.equal(t.cookie.path, '/some/path');
+ },
+ "getting it back": {
+ topic: function(t) {
+ t.cj.getCookies('http://domain/some/path/file', function(err,cookies) {
+ this.callback(err, {cj:t.cj, cookies:cookies||[]});
+ }.bind(this));
+ },
+ "got one cookie": function(t) {
+ assert.lengthOf(t.cookies, 1);
+ },
+ "it's the right one": function(t) {
+ var c = t.cookies[0];
+ assert.equal(c.key, 'hello');
+ assert.equal(c.value, 'world');
+ },
+ }
+ }
+})
+.addBatch({
+ "expiry option": {
+ topic: function() {
+ var cb = this.callback;
+ var cj = new CookieJar();
+ cj.setCookie('near=expiry; Domain=example.com; Path=/; Max-Age=1','http://www.example.com',at(-1), function(err,cookie) {
+
+ cb(err, {cj:cj, cookie:cookie});
+ });
+ },
+ "set the cookie": function(t) {
+ assert.ok(t.cookie, "didn't set?!");
+ assert.equal(t.cookie.key, 'near');
+ },
+ "then, retrieving": {
+ topic: function(t) {
+ var cb = this.callback;
+ setTimeout(function() {
+ t.cj.getCookies('http://www.example.com', {http:true, expire:false}, function(err,cookies) {
+ t.cookies = cookies;
+ cb(err,t);
+ });
+ },2000);
+ },
+ "got the cookie": function(t) {
+ assert.lengthOf(t.cookies, 1);
+ assert.equal(t.cookies[0].key, 'near');
+ },
+ }
+ }
+})
+.addBatch({
+ "trailing semi-colon set into cj": {
+ topic: function () {
+ var cb = this.callback;
+ var cj = new CookieJar();
+ var ex = 'http://www.example.com';
+ var tasks = [];
+ tasks.push(function(next) {
+ cj.setCookie('broken_path=testme; path=/;',ex,at(-1),next);
+ });
+ tasks.push(function(next) {
+ cj.setCookie('b=2; Path=/;;;;',ex,at(-1),next);
+ });
+ async.parallel(tasks, function (err, cookies) {
+ cb(null, {
+ cj: cj,
+ cookies: cookies
+ });
+ });
+ },
+ "check number of cookies": function (t) {
+ assert.lengthOf(t.cookies, 2, "didn't set");
+ },
+ "check *broken_path* was set properly": function (t) {
+ assert.equal(t.cookies[0].key, "broken_path");
+ assert.equal(t.cookies[0].value, "testme");
+ assert.equal(t.cookies[0].path, "/");
+ },
+ "check *b* was set properly": function (t) {
+ assert.equal(t.cookies[1].key, "b");
+ assert.equal(t.cookies[1].value, "2");
+ assert.equal(t.cookies[1].path, "/");
+ },
+ "retrieve the cookie": {
+ topic: function (t) {
+ var cb = this.callback;
+ t.cj.getCookies('http://www.example.com', {}, function (err, cookies) {
+ t.cookies = cookies;
+ cb(err, t);
+ });
+ },
+ "get the cookie": function(t) {
+ assert.lengthOf(t.cookies, 2);
+ assert.equal(t.cookies[0].key, 'broken_path');
+ assert.equal(t.cookies[0].value, 'testme');
+ assert.equal(t.cookies[1].key, "b");
+ assert.equal(t.cookies[1].value, "2");
+ assert.equal(t.cookies[1].path, "/");
+ },
+ },
+ }
+})
+.addBatch({
+ "Constructor":{
+ topic: function () {
+ return new Cookie({
+ key: 'test',
+ value: 'b',
+ maxAge: 60
+ });
+ },
+ 'check for key property': function (c) {
+ assert.ok(c);
+ assert.equal(c.key, 'test');
+ },
+ 'check for value property': function (c) {
+ assert.equal(c.value, 'b');
+ },
+ 'check for maxAge': function (c) {
+ assert.equal(c.maxAge, 60);
+ },
+ 'check for default values for unspecified properties': function (c) {
+ assert.equal(c.expires, "Infinity");
+ assert.equal(c.secure, false);
+ assert.equal(c.httpOnly, false);
+ }
+ }
+})
+.addBatch({
+ "allPaths option": {
+ topic: function() {
+ var cj = new CookieJar();
+ var tasks = [];
+ tasks.push(cj.setCookie.bind(cj, 'nopath_dom=qq; Path=/; Domain=example.com', 'http://example.com', {}));
+ tasks.push(cj.setCookie.bind(cj, 'path_dom=qq; Path=/foo; Domain=example.com', 'http://example.com', {}));
+ tasks.push(cj.setCookie.bind(cj, 'nopath_host=qq; Path=/', 'http://www.example.com', {}));
+ tasks.push(cj.setCookie.bind(cj, 'path_host=qq; Path=/foo', 'http://www.example.com', {}));
+ tasks.push(cj.setCookie.bind(cj, 'other=qq; Path=/', 'http://other.example.com/', {}));
+ tasks.push(cj.setCookie.bind(cj, 'other2=qq; Path=/foo', 'http://other.example.com/foo', {}));
+ var cb = this.callback;
+ async.parallel(tasks, function(err,results) {
+ cb(err, {cj:cj, cookies: results});
+ });
+ },
+ "all set": function(t) {
+ assert.equal(t.cookies.length, 6);
+ assert.ok(t.cookies.every(function(c) { return !!c }));
+ },
+ "getting without allPaths": {
+ topic: function(t) {
+ var cb = this.callback;
+ var cj = t.cj;
+ cj.getCookies('http://www.example.com/', {}, function(err,cookies) {
+ cb(err, {cj:cj, cookies:cookies});
+ });
+ },
+ "found just two cookies": function(t) {
+ assert.equal(t.cookies.length, 2);
+ },
+ "all are path=/": function(t) {
+ assert.ok(t.cookies.every(function(c) { return c.path === '/' }));
+ },
+ "no 'other' cookies": function(t) {
+ assert.ok(!t.cookies.some(function(c) { return (/^other/).test(c.name) }));
+ },
+ },
+ "getting without allPaths for /foo": {
+ topic: function(t) {
+ var cb = this.callback;
+ var cj = t.cj;
+ cj.getCookies('http://www.example.com/foo', {}, function(err,cookies) {
+ cb(err, {cj:cj, cookies:cookies});
+ });
+ },
+ "found four cookies": function(t) {
+ assert.equal(t.cookies.length, 4);
+ },
+ "no 'other' cookies": function(t) {
+ assert.ok(!t.cookies.some(function(c) { return (/^other/).test(c.name) }));
+ },
+ },
+ "getting with allPaths:true": {
+ topic: function(t) {
+ var cb = this.callback;
+ var cj = t.cj;
+ cj.getCookies('http://www.example.com/', {allPaths:true}, function(err,cookies) {
+ cb(err, {cj:cj, cookies:cookies});
+ });
+ },
+ "found four cookies": function(t) {
+ assert.equal(t.cookies.length, 4);
+ },
+ "no 'other' cookies": function(t) {
+ assert.ok(!t.cookies.some(function(c) { return (/^other/).test(c.name) }));
+ },
+ },
+ }
+})
+.export(module);
},
"homepage": "https://github.com/mikeal/tunnel-agent",
"_id": "tunnel-agent@0.3.0",
- "_from": "tunnel-agent@~0.3.0"
+ "dist": {
+ "shasum": "987d4436dc2264fb29afff470b9b8f3b19600db9"
+ },
+ "_from": "tunnel-agent@~0.3.0",
+ "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz"
}
"util",
"utility"
],
- "version": "2.27.0",
+ "version": "2.29.0",
"author": {
"name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com"
"qs": "~0.6.0",
"json-stringify-safe": "~5.0.0",
"forever-agent": "~0.5.0",
+ "node-uuid": "~1.4.0",
+ "mime": "~1.2.9",
+ "tough-cookie": "~0.9.15",
+ "form-data": "~0.1.0",
"tunnel-agent": "~0.3.0",
"http-signature": "~0.10.0",
+ "oauth-sign": "~0.3.0",
"hawk": "~1.0.0",
- "aws-sign": "~0.3.0",
+ "aws-sign2": "~0.5.0"
+ },
+ "optionalDependencies": {
+ "tough-cookie": "~0.9.15",
+ "form-data": "~0.1.0",
+ "tunnel-agent": "~0.3.0",
+ "http-signature": "~0.10.0",
"oauth-sign": "~0.3.0",
- "cookie-jar": "~0.3.0",
- "node-uuid": "~1.4.0",
- "mime": "~1.2.9",
- "form-data": "~0.1.0"
+ "hawk": "~1.0.0",
+ "aws-sign2": "~0.5.0"
},
"scripts": {
"test": "node tests/run.js"
},
- "readme": "# Request -- Simplified HTTP client\n\n[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou 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.\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let's get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n }\n }\n})\n```\n\nYou 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:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nUrl encoded forms are simple\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## HTTP Authentication\n\n```javascript\nrequest.get('http://some.server.com/').auth('username', 'password', false);\n// or\nrequest.get('http://some.server.com/', {\n 'auth': {\n 'user': 'username',\n 'pass': 'password',\n 'sendImmediately': false\n }\n});\n```\n\nIf passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.\n\n`sendImmediately` defaults to true, which will cause a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a 401 response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).\n\nDigest authentication is supported, but it only works with `sendImmediately` set to `false` (otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail).\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Ideally, you would take the body in the response\n // and construct a URL that a user clicks on (like a sign in button).\n // The verifier is only available in the response after a user has\n // verified with twitter that they are authorizing your app.\n var access_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: access_token.oauth_verifier\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params =\n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n\n\n### request(options, callback)\n\nThe first argument can be either a url or an options object. The only required option is uri, all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()\n* `qs` - object containing querystring values to be appended to the uri\n* `method` - http method, defaults to GET\n* `headers` - http headers, defaults to {}\n* `body` - entity body for PATCH, POST and PUT requests. Must be buffer or string.\n* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.\n* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as json.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.\n* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.\n* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.\n* `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.\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\n* `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.\n* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.\n* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n* `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.\n* `jar` - Set to `true` if you want cookies to be remembered for future use, or define your custom cookie jar (see examples section)\n* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)\n* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.\n* `localAddress` - Local interface to bind for network connections.\n\n\nThe 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 is an http.ClientResponse object. The third is the response body String or Buffer.\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options)\n\nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as request() but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.patch\n\nSame as request() but defaults to `method: \"PATCH\"`.\n\n```javascript\nrequest.patch(url)\n```\n\n### request.post\n\nSame as request() but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as request() but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nAlias to normal request method for uniformity.\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart:\n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ]\n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\nCookies are disabled by default (else, they would be used in subsequent requests). To enable cookies set jar to true (either in defaults or in the options sent).\n\n```javascript\nvar request = request.defaults({jar: true})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nIf 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:\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
+ "readme": "# Request -- Simplified HTTP client\n\n[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou 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 the headers don’t already provide one).\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let’s get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n }\n }\n})\n```\n\nYou can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since `pipe()` returns the destination stream in ≥ Node 0.5.x you can do one line proxying. :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\n\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nURL-encoded forms are simple.\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don’t need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## HTTP Authentication\n\n```javascript\nrequest.get('http://some.server.com/').auth('username', 'password', false);\n// or\nrequest.get('http://some.server.com/', {\n 'auth': {\n 'user': 'username',\n 'pass': 'password',\n 'sendImmediately': false\n }\n});\n```\n\nIf passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.\n\n`sendImmediately` defaults to `true`, which causes a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a `401` response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).\n\nDigest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail.\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Ideally, you would take the body in the response\n // and construct a URL that a user clicks on (like a sign in button).\n // The verifier is only available in the response after a user has\n // verified with twitter that they are authorizing your app.\n var access_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: access_token.oauth_verifier\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params =\n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n### Custom HTTP Headers\n\nHTTP Headers, such as `User-Agent`, can be set in the `options` object.\nIn the example below, we call the github API to find out the number\nof stars and forks for the request repository. This requires a\ncustom `User-Agent` header as well as https.\n\n```\nvar request = require('request');\n\nvar options = {\n\turl: 'https://api.github.com/repos/mikeal/request',\n\theaders: {\n\t\t'User-Agent': 'request'\n\t}\n};\n\nfunction callback(error, response, body) {\n\tif (!error && response.statusCode == 200) {\n\t\tvar info = JSON.parse(body);\n\t\tconsole.log(info.stargazers_count + \" Stars\");\n\t\tconsole.log(info.forks_count + \" Forks\");\n\t}\n}\n\nrequest(options, callback);\n```\n\n### request(options, callback)\n\nThe first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()`\n* `qs` - object containing querystring values to be appended to the `uri`\n* `method` - http method (default: `\"GET\"`)\n* `headers` - http headers (default: `{}`)\n* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`.\n* `form` - when passed an object, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no options, a `FormData` instance is returned (and is piped to request).\n* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`)\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)\n* `maxRedirects` - the maximum number of redirects to follow (default: `10`)\n* `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`.\n* `pool` - A hash object containing the agents for these requests. If omitted, the request will use the global pool (which is set to node's default `maxSockets`)\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\n* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)\n* `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.\n* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n* `strictSSL` - If `true`, requires 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.\n* `jar` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section)\n* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services)\n* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.\n* `localAddress` - Local interface to bind for network connections.\n\n\nThe callback argument gets 3 arguments: \n\n1. An `error` when applicable (usually from the `http.Client` option, not the `http.ClientRequest` object)\n2. An `http.ClientResponse` object\n3. The third is the `response` body (`String` or `Buffer`)\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options)\n\nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as `request()`, but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.patch\n\nSame as `request()`, but defaults to `method: \"PATCH\"`.\n\n```javascript\nrequest.patch(url)\n```\n\n### request.post\n\nSame as `request()`, but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as `request()`, but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nSame as `request()` (for uniformity).\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart:\n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ]\n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\n\nCookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`).\n\n```javascript\nvar request = request.defaults({jar: true})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nTo use a custom cookie jar (instead `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`)\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
"readmeFilename": "README.md",
"homepage": "https://github.com/mikeal/request",
- "_id": "request@2.27.0",
- "_from": "request@~2.27.0"
+ "_id": "request@2.29.0",
+ "dist": {
+ "shasum": "919f51c1eec29bfdaa3cadbfbc94e67c9a469e2f"
+ },
+ "_from": "request@2.29.0",
+ "_resolved": "https://registry.npmjs.org/request/-/request-2.29.0.tgz"
}
-var http = require('http')
- , https = false
- , tls = false
+var optional = require('./lib/optional')
+ , http = require('http')
+ , https = optional('https')
+ , tls = optional('tls')
, url = require('url')
, util = require('util')
, stream = require('stream')
, querystring = require('querystring')
, crypto = require('crypto')
- , oauth = require('oauth-sign')
- , hawk = require('hawk')
- , aws = require('aws-sign')
- , httpSignature = require('http-signature')
+ , oauth = optional('oauth-sign')
+ , hawk = optional('hawk')
+ , aws = optional('aws-sign')
+ , httpSignature = optional('http-signature')
, uuid = require('node-uuid')
, mime = require('mime')
- , tunnel = require('tunnel-agent')
+ , tunnel = optional('tunnel-agent')
, _safeStringify = require('json-stringify-safe')
, ForeverAgent = require('forever-agent')
- , FormData = require('form-data')
+ , FormData = optional('form-data')
- , Cookie = require('cookie-jar')
- , CookieJar = Cookie.Jar
- , cookieJar = new CookieJar
+ , Cookie = optional('tough-cookie')
+ , CookieJar = Cookie && Cookie.CookieJar
+ , cookieJar = CookieJar && new CookieJar
, copy = require('./lib/copy')
, debug = require('./lib/debug')
var globalPool = {}
var isUrl = /^https?:/i
-try {
- https = require('https')
-} catch (e) {}
-
-try {
- tls = require('tls')
-} catch (e) {}
-
-
// Hacky fix for pre-0.4.4 https
if (https && !https.Agent) {
this.explicitMethod = true
}
+ this.canTunnel = options.tunnel !== false && tunnel;
+
this.init(options)
}
util.inherits(Request, stream.Stream)
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:") {
+ if (http.globalAgent && self.uri.protocol === "https:" && self.canTunnel) {
var tunnelFn = self.proxy.protocol === "http:"
? tunnel.httpsOverHttp : tunnel.httpsOverHttps
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)
+ // As this is a case where the user cannot do anything (they didn't call request directly with this URL)
+ // they 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))
self.clientErrorHandler = function (error) {
if (self._aborted) return
-
if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET'
&& self.agent.addRequestNoreuse) {
self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
}
if (options.auth) {
+ if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) options.auth.user = options.auth.username
+ if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) options.auth.pass = options.auth.password
+
self.auth(
- (options.auth.user==="") ? options.auth.user : (options.auth.user || options.auth.username ),
- options.auth.pass || options.auth.password,
- options.auth.sendImmediately)
+ options.auth.user,
+ options.auth.pass,
+ options.auth.sendImmediately
+ )
}
if (self.uri.auth && !self.hasHeader('authorization')) {
if (protocol === 'https:') {
// previously was doing http, now doing https
// if it's https, then we might need to tunnel now.
- if (self.proxy) {
+ if (self.proxy && self.canTunnel) {
self.tunnel = true
var tunnelFn = self.proxy.protocol === 'http:'
? tunnel.httpsOverHttp : tunnel.httpsOverHttps
}
}
if (this.ca) options.ca = this.ca
+ if (this.ciphers) options.ciphers = this.ciphers
+ if (this.secureProtocol) options.secureProtocol = this.secureProtocol
if (typeof this.rejectUnauthorized !== 'undefined') options.rejectUnauthorized = this.rejectUnauthorized
if (this.cert && this.key) {
poolKey += options.ciphers
}
- if (options.secureOptions) {
+ if (options.secureProtocol) {
if (poolKey) poolKey += ':'
- poolKey += options.secureOptions
+ poolKey += options.secureProtocol
}
}
var addCookie = function (cookie) {
if (self._jar){
- if(self._jar.add){
- self._jar.add(new Cookie(cookie))
- }
- else cookieJar.add(new Cookie(cookie))
+ var targetCookieJar = self._jar.setCookie?self._jar:cookieJar;
+
+ //set the cookie if it's domain in the href's domain.
+ targetCookieJar.setCookie(cookie, self.uri.href, function(err){
+ if (err){
+ console.warn('set cookie failed,'+ err)
+ }
+ })
}
}
var ha1 = md5(self._user + ':' + challenge.realm + ':' + self._pass)
var ha2 = md5(self.method + ':' + self.uri.path)
- var digestResponse = md5(ha1 + ':' + challenge.nonce + ':1::auth:' + ha2)
+ var cnonce = uuid().replace(/-/g, '')
+ var digestResponse = md5(ha1 + ':' + challenge.nonce + ':1:' + cnonce + ':auth:' + ha2)
var authValues = {
username: self._user,
realm: challenge.realm,
qop: challenge.qop,
response: digestResponse,
nc: 1,
- cnonce: ''
+ cnonce: cnonce
}
authHeader = []
if (!self.hasHeader('content-type')) {
self.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
} else {
- self.setHeader('content-type', self.headers['content-type'].split(';')[0] + '; boundary=' + self.boundary)
+ var headerName = self.hasHeader('content-type');
+ self.setHeader(headerName, self.headers[headerName].split(';')[0] + '; boundary=' + self.boundary)
}
if (!multipart.forEach) throw new Error('Argument error, options.multipart.')
// disable cookies
cookies = false
this._disableCookies = true
- } else if (jar && jar.get) {
- // fetch cookie from the user defined cookie jar
- cookies = jar.get({ url: this.uri.href })
} else {
- // fetch cookie from the global cookie jar
- cookies = cookieJar.get({ url: this.uri.href })
+ var targetCookieJar = (jar && jar.getCookieString)?jar:cookieJar;
+ var urihref = this.uri.href
+
+ //fetch cookie in the Specified host
+ targetCookieJar.getCookieString(urihref, function(err, hrefCookie){
+ if (err){
+ console.warn('get cookieString failed,' +err)
+ } else {
+ cookies = hrefCookie
+ }
+ })
+
}
+ //if need cookie and cookie is not empty
if (cookies && cookies.length) {
- var cookieString = cookies.map(function (c) {
- return c.name + "=" + c.value
- }).join("; ")
-
if (this.originalCookieHeader) {
// Don't overwrite existing Cookie header
- this.setHeader('cookie', this.originalCookieHeader + '; ' + cookieString)
+ this.setHeader('cookie', this.originalCookieHeader + '; ' + cookies)
} else {
- this.setHeader('cookie', cookieString)
+ this.setHeader('cookie', cookies)
}
}
this._jar = jar
Request.prototype.toJSON = toJSON
-module.exports = Request
\ No newline at end of file
+module.exports = Request
+++ /dev/null
-var spawn = require('child_process').spawn
- , exitCode = 0
- , timeout = 10000
- , fs = require('fs')
- ;
-
-fs.readdir(__dirname, function (e, files) {
- if (e) throw e
-
- var tests = files.filter(function (f) {return f.slice(0, 'test-'.length) === 'test-'})
-
- var next = function () {
- if (tests.length === 0) process.exit(exitCode);
-
- var file = tests.shift()
- console.log(file)
- var proc = spawn('node', [ 'tests/' + file ])
-
- var killed = false
- var t = setTimeout(function () {
- proc.kill()
- exitCode += 1
- console.error(file + ' timeout')
- killed = true
- }, timeout)
-
- proc.stdout.pipe(process.stdout)
- proc.stderr.pipe(process.stderr)
- proc.on('exit', function (code) {
- if (code && !killed) console.error(file + ' failed')
- exitCode += code || 0
- clearTimeout(t)
- next()
- })
- }
- next()
-
-})
-
-
+++ /dev/null
-var fs = require('fs')
- , http = require('http')
- , path = require('path')
- , https = require('https')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- ;
-
-exports.createServer = function (port) {
- port = port || 6767
- var s = http.createServer(function (req, resp) {
- s.emit(req.url, req, resp);
- })
- s.port = port
- s.url = 'http://localhost:'+port
- return s;
-}
-
-exports.createSSLServer = function(port, opts) {
- port = port || 16767
-
- var options = { 'key' : path.join(__dirname, 'ssl', 'test.key')
- , 'cert': path.join(__dirname, 'ssl', 'test.crt')
- }
- if (opts) {
- for (var i in opts) options[i] = opts[i]
- }
-
- for (var i in options) {
- options[i] = fs.readFileSync(options[i])
- }
-
- var s = https.createServer(options, function (req, resp) {
- s.emit(req.url, req, resp);
- })
- s.port = port
- s.url = 'https://localhost:'+port
- return s;
-}
-
-exports.createPostStream = function (text) {
- var postStream = new stream.Stream();
- postStream.writeable = true;
- postStream.readable = true;
- setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0);
- return postStream;
-}
-exports.createPostValidator = function (text, reqContentType) {
- var l = function (req, resp) {
- var r = '';
- req.on('data', function (chunk) {r += chunk})
- req.on('end', function () {
- if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) {
- var boundary = req.headers['content-type'].split('boundary=')[1];
- text = text.replace(/__BOUNDARY__/g, boundary);
- }
- if (r !== text) console.log(r, text);
- assert.equal(r, text)
- if (reqContentType) {
- assert.ok(req.headers['content-type'])
- assert.ok(~req.headers['content-type'].indexOf(reqContentType))
- }
- resp.writeHead(200, {'content-type':'text/plain'})
- resp.write('OK')
- resp.end()
- })
- }
- return l;
-}
-exports.createGetResponse = function (text, contentType) {
- var l = function (req, resp) {
- contentType = contentType || 'text/plain'
- resp.writeHead(200, {'content-type':contentType})
- resp.write(text)
- resp.end()
- }
- return l;
-}
-exports.createChunkResponse = function (chunks, contentType) {
- var l = function (req, resp) {
- contentType = contentType || 'text/plain'
- resp.writeHead(200, {'content-type':contentType})
- chunks.forEach(function (chunk) {
- resp.write(chunk)
- })
- resp.end()
- }
- return l;
-}
+++ /dev/null
-#
-# Recommended minimum configuration:
-#
-acl manager proto cache_object
-acl localhost src 127.0.0.1/32 ::1
-acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
-
-# Example rule allowing access from your local networks.
-# Adapt to list your (internal) IP networks from where browsing
-# should be allowed
-acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
-acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
-acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
-acl localnet src fc00::/7 # RFC 4193 local private network range
-acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
-
-acl SSL_ports port 443
-acl Safe_ports port 80 # http
-acl Safe_ports port 21 # ftp
-acl Safe_ports port 443 # https
-acl Safe_ports port 70 # gopher
-acl Safe_ports port 210 # wais
-acl Safe_ports port 1025-65535 # unregistered ports
-acl Safe_ports port 280 # http-mgmt
-acl Safe_ports port 488 # gss-http
-acl Safe_ports port 591 # filemaker
-acl Safe_ports port 777 # multiling http
-acl CONNECT method CONNECT
-
-#
-# Recommended minimum Access Permission configuration:
-#
-# Only allow cachemgr access from localhost
-http_access allow manager localhost
-http_access deny manager
-
-# Deny requests to certain unsafe ports
-http_access deny !Safe_ports
-
-# Deny CONNECT to other than secure SSL ports
-#http_access deny CONNECT !SSL_ports
-
-# We strongly recommend the following be uncommented to protect innocent
-# web applications running on the proxy server who think the only
-# one who can access services on "localhost" is a local user
-#http_access deny to_localhost
-
-#
-# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
-#
-
-# Example rule allowing access from your local networks.
-# Adapt localnet in the ACL section to list your (internal) IP networks
-# from where browsing should be allowed
-http_access allow localnet
-http_access allow localhost
-
-# And finally deny all other access to this proxy
-http_access deny all
-
-# Squid normally listens to port 3128
-http_port 3128
-
-# We recommend you to use at least the following line.
-hierarchy_stoplist cgi-bin ?
-
-# Uncomment and adjust the following to add a disk cache directory.
-#cache_dir ufs /usr/local/var/cache 100 16 256
-
-# Leave coredumps in the first cache dir
-coredump_dir /usr/local/var/cache
-
-# Add any of your own refresh_pattern entries above these.
-refresh_pattern ^ftp: 1440 20% 10080
-refresh_pattern ^gopher: 1440 0% 1440
-refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
-refresh_pattern . 0 20% 4320
+++ /dev/null
-[ req ]
-default_bits = 1024
-days = 3650
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-prompt = no
-output_password = password
-
-[ req_distinguished_name ]
-C = US
-ST = CA
-L = Oakland
-O = request
-OU = request Certificate Authority
-CN = requestCA
-emailAddress = mikeal@mikealrogers.com
-
-[ req_attributes ]
-challengePassword = password challenge
-
+++ /dev/null
------BEGIN CERTIFICATE-----
-MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
-VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
-ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
-A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
-ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD
-VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
-B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
-MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl
-YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4
-5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ
-5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD
-xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB
-ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm
-D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo
-88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj
------END CERTIFICATE-----
+++ /dev/null
------BEGIN CERTIFICATE REQUEST-----
-MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
-BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD
-ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG
-SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB
-BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0
-deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br
-44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB
-AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3
-DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj
-bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia
-SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X
------END CERTIFICATE REQUEST-----
+++ /dev/null
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,C8B5887048377F02
-
-nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q
-nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+
-GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH
-gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38
-VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3
-/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb
-4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U
-gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR
-Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh
-FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf
-dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC
-uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb
-EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w==
------END RSA PRIVATE KEY-----
+++ /dev/null
-ADF62016AA40C9C3
+++ /dev/null
-[ req ]
-default_bits = 1024
-days = 3650
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-prompt = no
-
-[ req_distinguished_name ]
-C = US
-ST = CA
-L = Oakland
-O = request
-OU = testing
-CN = testing.request.mikealrogers.com
-emailAddress = mikeal@mikealrogers.com
-
-[ req_attributes ]
-challengePassword = password challenge
-
+++ /dev/null
------BEGIN CERTIFICATE-----
-MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
-VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
-ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
-A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
-ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD
-VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
-B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx
-dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr
-ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM
-20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh
-DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj
-7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB
-kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC
-yapjN3RxZbInGhWR+jA=
------END CERTIFICATE-----
+++ /dev/null
------BEGIN CERTIFICATE REQUEST-----
-MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
-BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp
-MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq
-hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB
-BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
-cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU
-ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw
-7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A
-HidVJ/3u
------END CERTIFICATE REQUEST-----
+++ /dev/null
-var fs = require("fs")
-var https = require("https")
-var options = { key: fs.readFileSync("./server.key")
- , cert: fs.readFileSync("./server.crt") }
-
-var server = https.createServer(options, function (req, res) {
- res.writeHead(200)
- res.end()
- server.close()
-})
-server.listen(1337)
-
-var ca = fs.readFileSync("./ca.crt")
-var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca })
-
-https.request({ host: "localhost"
- , method: "HEAD"
- , port: 1337
- , headers: { host: "testing.request.mikealrogers.com" }
- , agent: agent
- , ca: [ ca ]
- , path: "/" }, function (res) {
- if (res.client.authorized) {
- console.log("node test: OK")
- } else {
- throw new Error(res.client.authorizationError)
- }
-}).end()
+++ /dev/null
------BEGIN RSA PRIVATE KEY-----
-MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
-cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB
-iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW
-gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0
-JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ
-rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ
-0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw==
------END RSA PRIVATE KEY-----
+++ /dev/null
------BEGIN CERTIFICATE-----
-MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC
-VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x
-IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w
-bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y
-MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV
-BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj
-YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA
-aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE
-OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz
-Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl
-y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC
-l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv
-yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl
-ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op
------END CERTIFICATE-----
+++ /dev/null
------BEGIN CERTIFICATE-----
-MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU
-SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo
-ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx
-MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV
-BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz
-dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B
-AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto
-wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj
-eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC
-AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV
-l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4
-L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE
-c7U8F6MWLQ==
------END CERTIFICATE-----
+++ /dev/null
------BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt
-NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE
-mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB
-AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt
-Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ
-fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb
-rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6
-V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF
-+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb
-G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf
-Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ
-fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w
-kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w==
------END RSA PRIVATE KEY-----
+++ /dev/null
-var request = require('../index')
- , http = require('http')
- , server = require('./server')
- , assert = require('assert')
- ;
-
-var s = http.createServer(function (req, resp) {
- resp.statusCode = 200
- resp.end('')
-}).listen(6767, function () {
- // requests without agentOptions should use global agent
- var r = request('http://localhost:6767', function (e, resp, body) {
- assert.deepEqual(r.agent, http.globalAgent);
- assert.equal(Object.keys(r.pool).length, 0);
-
- // requests with agentOptions should apply agentOptions to new agent in pool
- var r2 = request('http://localhost:6767', { agentOptions: { foo: 'bar' } }, function (e, resp, body) {
- assert.deepEqual(r2.agent.options, { foo: 'bar' });
- assert.equal(Object.keys(r2.pool).length, 1);
- s.close()
- });
- })
-})
+++ /dev/null
-var assert = require('assert')
- , http = require('http')
- , request = require('../index')
- ;
-
-var numBasicRequests = 0;
-
-var basicServer = http.createServer(function (req, res) {
- console.error('Basic auth server: ', req.method, req.url);
- numBasicRequests++;
-
- var ok;
-
- if (req.headers.authorization) {
- if (req.headers.authorization == 'Basic ' + new Buffer('test:testing2').toString('base64')) {
- ok = true;
- } else if ( req.headers.authorization == 'Basic ' + new Buffer(':apassword').toString('base64')) {
- ok = true;
- } else if ( req.headers.authorization == 'Basic ' + new Buffer('justauser').toString('base64')) {
- ok = true;
- } else {
- // Bad auth header, don't send back WWW-Authenticate header
- ok = false;
- }
- } else {
- // No auth header, send back WWW-Authenticate header
- ok = false;
- res.setHeader('www-authenticate', 'Basic realm="Private"');
- }
-
- if (req.url == '/post/') {
- var expectedContent = 'data_key=data_value';
- req.on('data', function(data) {
- assert.equal(data, expectedContent);
- console.log('received request data: ' + data);
- });
- assert.equal(req.method, 'POST');
- assert.equal(req.headers['content-length'], '' + expectedContent.length);
- assert.equal(req.headers['content-type'], 'application/x-www-form-urlencoded; charset=utf-8');
- }
-
- if (ok) {
- console.log('request ok');
- res.end('ok');
- } else {
- console.log('status=401');
- res.statusCode = 401;
- res.end('401');
- }
-});
-
-basicServer.listen(6767);
-
-var tests = [
- function(next) {
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing2',
- 'sendImmediately': false
- }
- }, function(error, res, body) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 2);
- next();
- });
- },
-
- function(next) {
- // If we don't set sendImmediately = false, request will send basic auth
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test2/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing2'
- }
- }, function(error, res, body) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 3);
- next();
- });
- },
-
- function(next) {
- request({
- 'method': 'GET',
- 'uri': 'http://test:testing2@localhost:6767/test2/'
- }, function(error, res, body) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 4);
- next();
- });
- },
-
- function(next) {
- request({
- 'method': 'POST',
- 'form': { 'data_key': 'data_value' },
- 'uri': 'http://localhost:6767/post/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing2',
- 'sendImmediately': false
- }
- }, function(error, res, body) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 6);
- next();
- });
- },
-
- function(next) {
- assert.doesNotThrow( function() {
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/allow_empty_user/',
- 'auth': {
- 'user': '',
- 'pass': 'apassword',
- 'sendImmediately': false
- }
- }, function(error, res, body ) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 8);
- next();
- });
- })
- },
-
- function(next) {
- assert.doesNotThrow( function() {
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/allow_undefined_password/',
- 'auth': {
- 'user': 'justauser',
- 'pass': undefined,
- 'sendImmediately': false
- }
- }, function(error, res, body ) {
- assert.equal(res.statusCode, 200);
- assert.equal(numBasicRequests, 10);
- next();
- });
- })
- }
-];
-
-function runTest(i) {
- if (i < tests.length) {
- tests[i](function() {
- runTest(i + 1);
- });
- } else {
- console.log('All tests passed');
- basicServer.close();
- }
-}
-
-runTest(0);
+++ /dev/null
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var s = server.createServer();
-
-var tests =
- { testGet :
- { resp : server.createGetResponse("TESTING!")
- , expectBody: "TESTING!"
- }
- , testGetChunkBreak :
- { resp : server.createChunkResponse(
- [ new Buffer([239])
- , new Buffer([163])
- , new Buffer([191])
- , new Buffer([206])
- , new Buffer([169])
- , new Buffer([226])
- , new Buffer([152])
- , new Buffer([131])
- ])
- , expectBody: "Ω☃"
- }
- , testGetBuffer :
- { resp : server.createGetResponse(new Buffer("TESTING!"))
- , encoding: null
- , expectBody: new Buffer("TESTING!")
- }
- , testGetEncoding :
- { resp : server.createGetResponse(new Buffer('efa3bfcea9e29883', 'hex'))
- , encoding: 'hex'
- , expectBody: "efa3bfcea9e29883"
- }
- , testGetUTF8:
- { resp: server.createGetResponse(new Buffer([0xEF, 0xBB, 0xBF, 226, 152, 131]))
- , encoding: "utf8"
- , expectBody: "☃"
- }
- , testGetJSON :
- { resp : server.createGetResponse('{"test":true}', 'application/json')
- , json : true
- , expectBody: {"test":true}
- }
- , testPutString :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : "PUTTINGDATA"
- }
- , testPutBuffer :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : new Buffer("PUTTINGDATA")
- }
- , testPutJSON :
- { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
- , method: "PUT"
- , json: {foo: 'bar'}
- }
- , testPutMultipart :
- { resp: server.createPostValidator(
- '--__BOUNDARY__\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--__BOUNDARY__\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--__BOUNDARY__--'
- )
- , method: "PUT"
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- , testPutMultipartPreambleCRLF :
- { resp: server.createPostValidator(
- '\r\n--__BOUNDARY__\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--__BOUNDARY__\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--__BOUNDARY__--'
- )
- , method: "PUT"
- , preambleCRLF: true
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- }
-
-s.listen(s.port, function () {
-
- var counter = 0
-
- for (i in tests) {
- (function () {
- var test = tests[i]
- s.on('/'+i, test.resp)
- test.uri = s.url + '/' + i
- request(test, function (err, resp, body) {
- if (err) throw err
- if (test.expectBody) {
- assert.deepEqual(test.expectBody, body)
- }
- counter = counter - 1;
- if (counter === 0) {
- console.log(Object.keys(tests).length+" tests passed.")
- s.close()
- }
- })
- counter++
- })()
- }
-})
-
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var s = server.createServer();
-
-s.listen(s.port, function () {
- var counter = 0;
- s.on('/get', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.method, 'GET')
- resp.writeHead(200, {'Content-Type': 'text/plain'});
- resp.end('TESTING!');
- });
-
- // test get(string, function)
- request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){
- if (e) throw e;
- assert.deepEqual("TESTING!", b);
- counter += 1;
- });
-
- s.on('/post', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.headers['content-type'], null);
- assert.equal(req.method, 'POST')
- resp.writeHead(200, {'Content-Type': 'application/json'});
- resp.end(JSON.stringify({foo:'bar'}));
- });
-
- // test post(string, object, function)
- request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){
- if (e) throw e;
- assert.deepEqual('bar', b.foo);
- counter += 1;
- });
-
- s.on('/patch', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.headers['content-type'], null);
- assert.equal(req.method, 'PATCH')
- resp.writeHead(200, {'Content-Type': 'application/json'});
- resp.end(JSON.stringify({foo:'bar'}));
- });
-
- // test post(string, object, function)
- request.defaults({headers:{foo:"bar"}}).patch(s.url + '/patch', {json: true}, function (e, r, b){
- if (e) throw e;
- assert.deepEqual('bar', b.foo);
- counter += 1;
- });
-
- s.on('/post-body', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.headers['content-type'], 'application/json');
- assert.equal(req.method, 'POST')
- resp.writeHead(200, {'Content-Type': 'application/json'});
- resp.end(JSON.stringify({foo:'bar'}));
- });
-
- // test post(string, object, function) with body
- request.defaults({headers:{foo:"bar"}}).post(s.url + '/post-body', {json: true, body:{bar:"baz"}}, function (e, r, b){
- if (e) throw e;
- assert.deepEqual('bar', b.foo);
- counter += 1;
- });
-
- s.on('/del', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.method, 'DELETE')
- resp.writeHead(200, {'Content-Type': 'application/json'});
- resp.end(JSON.stringify({foo:'bar'}));
- });
-
- // test .del(string, function)
- request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){
- if (e) throw e;
- assert.deepEqual('bar', b.foo);
- counter += 1;
- });
-
- s.on('/head', function (req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.method, 'HEAD')
- resp.writeHead(200, {'Content-Type': 'text/plain'});
- resp.end();
- });
-
- // test head.(object, function)
- request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){
- if (e) throw e;
- counter += 1;
- });
-
- s.on('/get_custom', function(req, resp) {
- assert.equal(req.headers.foo, 'bar');
- assert.equal(req.headers.x, 'y');
- resp.writeHead(200, {'Content-Type': 'text/plain'});
- resp.end();
- });
-
- // test custom request handler function
- var defaultRequest = request.defaults({
- headers:{foo:"bar"}
- , body: 'TESTING!'
- }, function(uri, options, callback) {
- var params = request.initParams(uri, options, callback);
- options = params.options;
- options.headers.x = 'y';
-
- return request(params.uri, params.options, params.callback);
- });
-
- var msg = 'defaults test failed. head request should throw earlier';
- assert.throws(function() {
- defaultRequest.head(s.url + '/get_custom', function(e, r, b) {
- throw new Error(msg);
- });
- counter+=1;
- }, msg);
-
- defaultRequest.get(s.url + '/get_custom', function(e, r, b) {
- if(e) throw e;
- counter += 1;
- console.log(counter.toString() + " tests passed.");
- s.close();
- });
-})
+++ /dev/null
-var assert = require('assert')
- , http = require('http')
- , request = require('../index')
- ;
-
-// Test digest auth
-// Using header values captured from interaction with Apache
-
-var numDigestRequests = 0;
-
-var digestServer = http.createServer(function (req, res) {
- console.error('Digest auth server: ', req.method, req.url);
- numDigestRequests++;
-
- var ok;
-
- if (req.headers.authorization) {
- if (req.headers.authorization == 'Digest username="test", realm="Private", nonce="WpcHS2/TBAA=dffcc0dbd5f96d49a5477166649b7c0ae3866a93", uri="/test/", qop="auth", response="54753ce37c10cb20b09b769f0bed730e", nc="1", cnonce=""') {
- ok = true;
- } else {
- // Bad auth header, don't send back WWW-Authenticate header
- ok = false;
- }
- } else {
- // No auth header, send back WWW-Authenticate header
- ok = false;
- res.setHeader('www-authenticate', 'Digest realm="Private", nonce="WpcHS2/TBAA=dffcc0dbd5f96d49a5477166649b7c0ae3866a93", algorithm=MD5, qop="auth"');
- }
-
- if (ok) {
- console.log('request ok');
- res.end('ok');
- } else {
- console.log('status=401');
- res.statusCode = 401;
- res.end('401');
- }
-});
-
-digestServer.listen(6767);
-
-request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing',
- 'sendImmediately': false
- }
-}, function(error, response, body) {
- assert.equal(response.statusCode, 200);
- assert.equal(numDigestRequests, 2);
-
- // If we don't set sendImmediately = false, request will send basic auth
- request({
- 'method': 'GET',
- 'uri': 'http://localhost:6767/test/',
- 'auth': {
- 'user': 'test',
- 'pass': 'testing'
- }
- }, function(error, response, body) {
- assert.equal(response.statusCode, 401);
- assert.equal(numDigestRequests, 3);
-
- console.log('All tests passed');
- digestServer.close();
- });
-});
+++ /dev/null
-var request = require('../index')
- , http = require('http')
- , assert = require('assert')
- ;
-
-var s = http.createServer(function (req, resp) {
- resp.statusCode = 200
- resp.end('')
-}).listen(8080, function () {
- var r = request('http://localhost:8080', function (e, resp, body) {
- assert.equal(resp.statusCode, 200)
- assert.equal(body, "")
-
- var r2 = request({ url: 'http://localhost:8080', json: {} }, function (e, resp, body) {
- assert.equal(resp.statusCode, 200)
- assert.equal(body, undefined)
- s.close()
- });
- })
-})
+++ /dev/null
-var server = require('./server')
- , events = require('events')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var local = 'http://localhost:8888/asdf'
-
-try {
- request({uri:local, body:{}})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Argument error, options.body.')
-}
-
-try {
- request({uri:local, multipart: 'foo'})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Argument error, options.multipart.')
-}
-
-try {
- request({uri:local, multipart: [{}]})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Body attribute missing in multipart.')
-}
-
-try {
- request(local, {multipart: [{}]})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Body attribute missing in multipart.')
-}
-
-console.log("All tests passed.")
+++ /dev/null
-var request = require('../index');
-var http = require('http');
-var requests = 0;
-var assert = require('assert');
-
-var server = http.createServer(function (req, res) {
- console.error(req.method, req.url);
- requests ++;
-
- if (req.method === 'POST') {
- console.error('send 303');
- res.setHeader('location', req.url);
- res.statusCode = 303;
- res.end('try again, i guess\n');
- } else {
- console.error('send 200')
- res.end('ok: ' + requests);
- }
-});
-server.listen(6767);
-
-request.post({ url: 'http://localhost:6767/foo',
- followAllRedirects: true,
- form: { foo: 'bar' } }, function (er, req, body) {
- if (er) throw er;
- assert.equal(body, 'ok: 2');
- assert.equal(requests, 2);
- console.error('ok - ' + process.version);
- server.close();
-});
+++ /dev/null
-var request = require('../index');
-var http = require('http');
-var requests = 0;
-var assert = require('assert');
-
-var server = http.createServer(function (req, res) {
- requests ++;
-
- // redirect everything 3 times, no matter what.
- var c = req.headers.cookie;
-
- if (!c) c = 0;
- else c = +c.split('=')[1] || 0;
-
- if (c > 3) {
- res.end('ok: '+requests);
- return;
- }
-
- res.setHeader('set-cookie', 'c=' + (c + 1));
- res.setHeader('location', req.url);
- res.statusCode = 302;
- res.end('try again, i guess\n');
-});
-server.listen(6767);
-
-request.post({ url: 'http://localhost:6767/foo',
- followAllRedirects: true,
- jar: true,
- form: { foo: 'bar' } }, function (er, req, body) {
- if (er) throw er;
- assert.equal(body, 'ok: 5');
- assert.equal(requests, 5);
- console.error('ok - ' + process.version);
- server.close();
-});
+++ /dev/null
-var assert = require('assert')
-var http = require('http');
-var path = require('path');
-var mime = require('mime');
-var request = require('../index');
-var fs = require('fs');
-
-var remoteFile = 'http://nodejs.org/images/logo.png';
-
-var FIELDS = [
- {name: 'my_field', value: 'my_value'},
- {name: 'my_buffer', value: new Buffer([1, 2, 3])},
- {name: 'my_file', value: fs.createReadStream(__dirname + '/unicycle.jpg')},
- {name: 'remote_file', value: request(remoteFile) }
-];
-
-var server = http.createServer(function(req, res) {
-
- // temp workaround
- var data = '';
- req.setEncoding('utf8');
-
- req.on('data', function(d) {
- data += d;
- });
-
- req.on('end', function() {
- // check for the fields' traces
-
- // 1st field : my_field
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 2nd field : my_buffer
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf(field.value) != -1 );
-
- // 3rd field : my_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for unicycle.jpg traces
- assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
-
- // 4th field : remote_file
- var field = FIELDS.shift();
- assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
- assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
- // check for http://nodejs.org/images/logo.png traces
- assert.ok( data.indexOf('ImageReady') != -1 );
- assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
-
- res.writeHead(200);
- res.end('done');
-
- });
-
-
-});
-
-server.listen(8080, function() {
-
- var req = request.post('http://localhost:8080/upload', function () {
- server.close();
- })
- var form = req.form()
-
- FIELDS.forEach(function(field) {
- form.append(field.name, field.value);
- });
-
-});
-
-process.on('exit', function() {
- assert.strictEqual(FIELDS.length, 0);
-});
+++ /dev/null
-var createServer = require('http').createServer
- , request = require('../index')
- , hawk = require('hawk')
- , assert = require('assert')
- ;
-
-var server = createServer(function (req, resp) {
-
- var getCred = function (id, callback) {
- assert.equal(id, 'dh37fgj492je')
- var credentials =
- { key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn'
- , algorithm: 'sha256'
- , user: 'Steve'
- }
- return callback(null, credentials)
- }
-
- hawk.server.authenticate(req, getCred, {}, function (err, credentials, attributes) {
- resp.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' })
- resp.end(!err ? 'Hello ' + credentials.user : 'Shoosh!')
- })
-
-})
-
-server.listen(8080, function () {
- var creds = {key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', algorithm: 'sha256', id:'dh37fgj492je'}
- request('http://localhost:8080', {hawk:{credentials:creds}}, function (e, r, b) {
- assert.equal(200, r.statusCode)
- assert.equal(b, 'Hello Steve')
- server.close()
- })
-})
\ No newline at end of file
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- , Cookie = require('cookie-jar')
- , Jar = Cookie.Jar
- , s = server.createServer()
-
-s.listen(s.port, function () {
- var serverUri = 'http://localhost:' + s.port
- , numTests = 0
- , numOutstandingTests = 0
-
- function createTest(requestObj, serverAssertFn) {
- var testNumber = numTests;
- numTests += 1;
- numOutstandingTests += 1;
- s.on('/' + testNumber, function (req, res) {
- serverAssertFn(req, res);
- res.writeHead(200);
- res.end();
- });
- requestObj.url = serverUri + '/' + testNumber
- request(requestObj, function (err, res, body) {
- assert.ok(!err)
- assert.equal(res.statusCode, 200)
- numOutstandingTests -= 1
- if (numOutstandingTests === 0) {
- console.log(numTests + ' tests passed.')
- s.close()
- }
- })
- }
-
- // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified
- createTest({headers: {cookie: 'foo=bar'}}, function (req, res) {
- assert.ok(req.headers.cookie)
- assert.equal(req.headers.cookie, 'foo=bar')
- })
-
- // Issue #125: headers.cookie + cookie jar
- var jar = new Jar()
- jar.add(new Cookie('quux=baz'));
- createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) {
- assert.ok(req.headers.cookie)
- assert.equal(req.headers.cookie, 'foo=bar; quux=baz')
- })
-
- // There should be no cookie header when neither headers.cookie nor a cookie jar is specified
- createTest({}, function (req, res) {
- assert.ok(!req.headers.cookie)
- })
-})
+++ /dev/null
-var createServer = require('http').createServer
- , request = require('../index')
- , httpSignature = require('http-signature')
- , assert = require('assert')
- ;
-
-var privateKeyPEMs = {}
-
-privateKeyPEMs['key-1'] =
- '-----BEGIN RSA PRIVATE KEY-----\n' +
- 'MIIEpAIBAAKCAQEAzWSJl+Z9Bqv00FVL5N3+JCUoqmQPjIlya1BbeqQroNQ5yG1i\n' +
- 'VbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9diDMnrzijAnYlTLOl84CK2vOxkj5b6\n' +
- '8zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcuVi2lT9VjygFs1ILG4RyeX1BXUumu\n' +
- 'Y8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u114wS7OQPigu6G99dpn/iPHa3zBm8\n' +
- '7baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADPTdnO/SO+kvXy7fqd8atSn+HlQcx6\n' +
- 'tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft2QIDAQABAoIBAG1exe3/LEBrPLfb\n' +
- 'U8iRdY0lxFvHYIhDgIwohC3wUdMYb5SMurpNdEZn+7Sh/fkUVgp/GKJViu1mvh52\n' +
- 'bKd2r52DwG9NQBQjVgkqY/auRYSglIPpr8PpYNSZlcneunCDGeqEY9hMmXc5Ssqs\n' +
- 'PQYoEKKPN+IlDTg6PguDgAfLR4IUvt9KXVvmB/SSgV9tSeTy35LECt1Lq3ozbUgu\n' +
- '30HZI3U6/7H+X22Pxxf8vzBtzkg5rRCLgv+OeNPo16xMnqbutt4TeqEkxRv5rtOo\n' +
- '/A1i9khBeki0OJAFJsE82qnaSZodaRsxic59VnN8sWBwEKAt87tEu5A3K3j4XSDU\n' +
- '/avZxAECgYEA+pS3DvpiQLtHlaO3nAH6MxHRrREOARXWRDe5nUQuUNpS1xq9wte6\n' +
- 'DkFtba0UCvDLic08xvReTCbo9kH0y6zEy3zMpZuJlKbcWCkZf4S5miYPI0RTZtF8\n' +
- 'yps6hWqzYFSiO9hMYws9k4OJLxX0x3sLK7iNZ32ujcSrkPBSiBr0gxkCgYEA0dWl\n' +
- '637K41AJ/zy0FP0syq+r4eIkfqv+/t6y2aQVUBvxJYrj9ci6XHBqoxpDV8lufVYj\n' +
- 'fUAfeI9/MZaWvQJRbnYLre0I6PJfLuCBIL5eflO77BGso165AF7QJZ+fwtgKv3zv\n' +
- 'ZX75eudCSS/cFo0po9hlbcLMT4B82zEkgT8E2MECgYEAnz+3/wrdOmpLGiyL2dff\n' +
- '3GjsqmJ2VfY8z+niSrI0BSpbD11tT9Ct67VlCBjA7hsOH6uRfpd6/kaUMzzDiFVq\n' +
- 'VDAiFvV8QD6zNkwYalQ9aFvbrvwTTPrBpjl0vamMCiJ/YC0cjq1sGr2zh3sar1Ph\n' +
- 'S43kP+s97dcZeelhaiJHVrECgYEAsx61q/loJ/LDFeYzs1cLTVn4V7I7hQY9fkOM\n' +
- 'WM0AhInVqD6PqdfXfeFYpjJdGisQ7l0BnoGGW9vir+nkcyPvb2PFRIr6+B8tsU5j\n' +
- '7BeVgjDoUfQkcrEBK5fEBtnj/ud9BUkY8oMZZBjVNLRuI7IMwZiPvMp0rcj4zAN/\n' +
- 'LfUlpgECgYArBvFcBxSkNAzR3Rtteud1YDboSKluRM37Ey5plrn4BS0DD0jm++aD\n' +
- '0pG2Hsik000hibw92lCkzvvBVAqF8BuAcnPlAeYfsOaa97PGEjSKEN5bJVWZ9/om\n' +
- '9FV1axotRN2XWlwrhixZLEaagkREXhgQc540FS5O8IaI2Vpa80Atzg==\n' +
- '-----END RSA PRIVATE KEY-----'
-
-var publicKeyPEMs = {}
-
-publicKeyPEMs['key-1'] =
- '-----BEGIN PUBLIC KEY-----\n' +
- 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzWSJl+Z9Bqv00FVL5N3+\n' +
- 'JCUoqmQPjIlya1BbeqQroNQ5yG1iVbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9di\n' +
- 'DMnrzijAnYlTLOl84CK2vOxkj5b68zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcu\n' +
- 'Vi2lT9VjygFs1ILG4RyeX1BXUumuY8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u1\n' +
- '14wS7OQPigu6G99dpn/iPHa3zBm87baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADP\n' +
- 'TdnO/SO+kvXy7fqd8atSn+HlQcx6tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft\n' +
- '2QIDAQAB\n' +
- '-----END PUBLIC KEY-----'
-
-publicKeyPEMs['key-2'] =
- '-----BEGIN PUBLIC KEY-----\n' +
- 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqp04VVr9OThli9b35Omz\n' +
- 'VqSfWbsoQuRrgyWsrNRn3XkFmbWw4FzZwQ42OgGMzQ84Ta4d9zGKKQyFriTiPjPf\n' +
- 'xhhrsaJnDuybcpVhcr7UNKjSZ0S59tU3hpRiEz6hO+Nc/OSSLkvalG0VKrxOln7J\n' +
- 'LK/h3rNS/l6wDZ5S/KqsI6CYtV2ZLpn3ahLrizvEYNY038Qcm38qMWx+VJAvZ4di\n' +
- 'qqmW7RLIsLT59SWmpXdhFKnkYYGhxrk1Mwl22dBTJNY5SbriU5G3gWgzYkm8pgHr\n' +
- '6CtrXch9ciJAcDJehPrKXNvNDOdUh8EW3fekNJerF1lWcwQg44/12v8sDPyfbaKB\n' +
- 'dQIDAQAB\n' +
- '-----END PUBLIC KEY-----'
-
-var server = createServer(function (req, res) {
- var parsed = httpSignature.parseRequest(req)
- var publicKeyPEM = publicKeyPEMs[parsed.keyId]
- var verified = httpSignature.verifySignature(parsed, publicKeyPEM)
- res.writeHead(verified ? 200 : 400)
- res.end()
-})
-
-server.listen(8080, function () {
- function correctKeyTest(callback) {
- var options = {
- httpSignature: {
- keyId: 'key-1',
- key: privateKeyPEMs['key-1']
- }
- }
- request('http://localhost:8080', options, function (e, r, b) {
- assert.equal(200, r.statusCode)
- callback()
- })
- }
-
- function incorrectKeyTest(callback) {
- var options = {
- httpSignature: {
- keyId: 'key-2',
- key: privateKeyPEMs['key-1']
- }
- }
- request('http://localhost:8080', options, function (e, r, b) {
- assert.equal(400, r.statusCode)
- callback()
- })
- }
-
- var tests = [correctKeyTest, incorrectKeyTest]
- var todo = tests.length;
- for(var i = 0; i < tests.length; ++i) {
- tests[i](function() {
- if(!--todo) {
- server.close()
- }
- })
- }
-})
+++ /dev/null
-var http = require('http')
- , https = require('https')
- , server = require('./server')
- , assert = require('assert')
- , request = require('../index')
-
-
-var faux_requests_made = {'http':0, 'https':0}
-function wrap_request(name, module) {
- // Just like the http or https module, but note when a request is made.
- var wrapped = {}
- Object.keys(module).forEach(function(key) {
- var value = module[key];
-
- if(key != 'request')
- wrapped[key] = value;
- else
- wrapped[key] = function(options, callback) {
- faux_requests_made[name] += 1
- return value.apply(this, arguments)
- }
- })
-
- return wrapped;
-}
-
-
-var faux_http = wrap_request('http', http)
- , faux_https = wrap_request('https', https)
- , plain_server = server.createServer()
- , https_server = server.createSSLServer()
-
-
-plain_server.listen(plain_server.port, function() {
- plain_server.on('/plain', function (req, res) {
- res.writeHead(200)
- res.end('plain')
- })
- plain_server.on('/to_https', function (req, res) {
- res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'})
- res.end()
- })
-
- https_server.listen(https_server.port, function() {
- https_server.on('/https', function (req, res) {
- res.writeHead(200)
- res.end('https')
- })
- https_server.on('/to_plain', function (req, res) {
- res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'})
- res.end()
- })
-
- run_tests()
- run_tests({})
- run_tests({'http:':faux_http})
- run_tests({'https:':faux_https})
- run_tests({'http:':faux_http, 'https:':faux_https})
- })
-})
-
-function run_tests(httpModules) {
- var to_https = 'http://localhost:'+plain_server.port+'/to_https'
- var to_plain = 'https://localhost:'+https_server.port+'/to_plain'
-
- request(to_https, {'httpModules':httpModules, strictSSL:false}, function (er, res, body) {
- if (er) throw er
- assert.equal(body, 'https', 'Received HTTPS server body')
- done()
- })
-
- request(to_plain, {'httpModules':httpModules, strictSSL:false}, function (er, res, body) {
- if (er) throw er
- assert.equal(body, 'plain', 'Received HTTPS server body')
- done()
- })
-}
-
-
-var passed = 0;
-function done() {
- passed += 1
- var expected = 10
-
- if(passed == expected) {
- plain_server.close()
- https_server.close()
-
- assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately')
- assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately')
-
- console.log((expected+2) + ' tests passed.')
- }
-}
+++ /dev/null
-// a test where we validate the siguature of the keys
-// otherwise exactly the same as the ssl test
-
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- , fs = require('fs')
- , path = require('path')
- , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key')
- , cert: path.resolve(__dirname, 'ssl/ca/server.crt') }
- , s = server.createSSLServer(null, opts)
- , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt')
- , ca = fs.readFileSync(caFile)
-
-var tests =
- { testGet :
- { resp : server.createGetResponse("TESTING!")
- , expectBody: "TESTING!"
- }
- , testGetChunkBreak :
- { resp : server.createChunkResponse(
- [ new Buffer([239])
- , new Buffer([163])
- , new Buffer([191])
- , new Buffer([206])
- , new Buffer([169])
- , new Buffer([226])
- , new Buffer([152])
- , new Buffer([131])
- ])
- , expectBody: "Ω☃"
- }
- , testGetJSON :
- { resp : server.createGetResponse('{"test":true}', 'application/json')
- , json : true
- , expectBody: {"test":true}
- }
- , testPutString :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : "PUTTINGDATA"
- }
- , testPutBuffer :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : new Buffer("PUTTINGDATA")
- }
- , testPutJSON :
- { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
- , method: "PUT"
- , json: {foo: 'bar'}
- }
- , testPutMultipart :
- { resp: server.createPostValidator(
- '--__BOUNDARY__\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--__BOUNDARY__\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--__BOUNDARY__--'
- )
- , method: "PUT"
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- }
-
-s.listen(s.port, function () {
-
- var counter = 0
-
- for (i in tests) {
- (function () {
- var test = tests[i]
- s.on('/'+i, test.resp)
- test.uri = s.url + '/' + i
- test.strictSSL = true
- test.ca = ca
- test.headers = { host: 'testing.request.mikealrogers.com' }
- request(test, function (err, resp, body) {
- if (err) throw err
- if (test.expectBody) {
- assert.deepEqual(test.expectBody, body)
- }
- counter = counter - 1;
- if (counter === 0) {
- console.log(Object.keys(tests).length+" tests passed.")
- s.close()
- }
- })
- counter++
- })()
- }
-})
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
-
-var s = server.createSSLServer();
-
-var tests =
- { testGet :
- { resp : server.createGetResponse("TESTING!")
- , expectBody: "TESTING!"
- }
- , testGetChunkBreak :
- { resp : server.createChunkResponse(
- [ new Buffer([239])
- , new Buffer([163])
- , new Buffer([191])
- , new Buffer([206])
- , new Buffer([169])
- , new Buffer([226])
- , new Buffer([152])
- , new Buffer([131])
- ])
- , expectBody: "Ω☃"
- }
- , testGetJSON :
- { resp : server.createGetResponse('{"test":true}', 'application/json')
- , json : true
- , expectBody: {"test":true}
- }
- , testPutString :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : "PUTTINGDATA"
- }
- , testPutBuffer :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : new Buffer("PUTTINGDATA")
- }
- , testPutJSON :
- { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
- , method: "PUT"
- , json: {foo: 'bar'}
- }
- , testPutMultipart :
- { resp: server.createPostValidator(
- '--__BOUNDARY__\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--__BOUNDARY__\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--__BOUNDARY__--'
- )
- , method: "PUT"
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- }
-
-s.listen(s.port, function () {
-
- var counter = 0
-
- for (i in tests) {
- (function () {
- var test = tests[i]
- s.on('/'+i, test.resp)
- test.uri = s.url + '/' + i
- test.rejectUnauthorized = false
- request(test, function (err, resp, body) {
- if (err) throw err
- if (test.expectBody) {
- assert.deepEqual(test.expectBody, body)
- }
- counter = counter - 1;
- if (counter === 0) {
- console.log(Object.keys(tests).length+" tests passed.")
- s.close()
- }
- })
- counter++
- })()
- }
-})
+++ /dev/null
-var assert = require('assert')
- , request = require('../index')
- , http = require('http')
- ;
-
-var s = http.createServer(function(req, res) {
- res.statusCode = 200;
- res.end('');
-}).listen(6767, function () {
-
- // Test lowercase
- request('http://localhost:6767', function (err, resp, body) {
- // just need to get here without throwing an error
- assert.equal(true, true);
- })
-
- // Test uppercase
- request('HTTP://localhost:6767', function (err, resp, body) {
- assert.equal(true, true);
- })
-
- // Test mixedcase
- request('HtTp://localhost:6767', function (err, resp, body) {
- assert.equal(true, true);
- // clean up
- s.close();
- })
-})
\ No newline at end of file
+++ /dev/null
-var request = require('../index')
- , assert = require('assert')
- ;
-
-request.get({
- uri: 'http://www.google.com', localAddress: '1.2.3.4' // some invalid address
-}, function(err, res) {
- assert(!res) // asserting that no response received
-})
-
-request.get({
- uri: 'http://www.google.com', localAddress: '127.0.0.1'
-}, function(err, res) {
- assert(!res) // asserting that no response received
-})
+++ /dev/null
-var hmacsign = require('oauth-sign').hmacsign
- , assert = require('assert')
- , qs = require('querystring')
- , request = require('../index')
- ;
-
-function getsignature (r) {
- var sign
- r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) {
- if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1)
- })
- return decodeURIComponent(sign)
-}
-
-// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth
-
-var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token',
- { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
- , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
- , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
- , oauth_signature_method: 'HMAC-SHA1'
- , oauth_timestamp: '1272323042'
- , oauth_version: '1.0'
- }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98")
-
-console.log(reqsign)
-console.log('8wUi7m5HFQy76nowoCThusfgB+Q=')
-assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=')
-
-var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token',
- { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
- , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
- , oauth_signature_method: 'HMAC-SHA1'
- , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
- , oauth_timestamp: '1272323047'
- , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
- , oauth_version: '1.0'
- }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA")
-
-console.log(accsign)
-console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
-assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
-
-var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json',
- { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g"
- , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
- , oauth_signature_method: "HMAC-SHA1"
- , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
- , oauth_timestamp: "1272325550"
- , oauth_version: "1.0"
- , status: 'setting up my twitter 私のさえずりを設定する'
- }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA")
-
-console.log(upsign)
-console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=')
-assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=')
-
-
-var rsign = request.post(
- { url: 'https://api.twitter.com/oauth/request_token'
- , oauth:
- { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
- , consumer_key: 'GDdmIQH6jhtmLUypg82g'
- , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
- , timestamp: '1272323042'
- , version: '1.0'
- , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
- }
- })
-
-setTimeout(function () {
- console.log(getsignature(rsign))
- assert.equal(reqsign, getsignature(rsign))
-})
-
-var raccsign = request.post(
- { url: 'https://api.twitter.com/oauth/access_token'
- , oauth:
- { consumer_key: 'GDdmIQH6jhtmLUypg82g'
- , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
- , signature_method: 'HMAC-SHA1'
- , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
- , timestamp: '1272323047'
- , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
- , version: '1.0'
- , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
- , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA"
- }
- })
-
-setTimeout(function () {
- console.log(getsignature(raccsign))
- assert.equal(accsign, getsignature(raccsign))
-}, 1)
-
-var rupsign = request.post(
- { url: 'http://api.twitter.com/1/statuses/update.json'
- , oauth:
- { consumer_key: "GDdmIQH6jhtmLUypg82g"
- , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
- , signature_method: "HMAC-SHA1"
- , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
- , timestamp: "1272325550"
- , version: "1.0"
- , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
- , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA"
- }
- , form: {status: 'setting up my twitter 私のさえずりを設定する'}
- })
-setTimeout(function () {
- console.log(getsignature(rupsign))
- assert.equal(upsign, getsignature(rupsign))
-}, 1)
-
-
-
-
+++ /dev/null
-var http = require('http')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var server = http.createServer(function (req, resp) {
- resp.statusCode = 200
- if (req.url === '/get') {
- assert.equal(req.method, 'GET')
- resp.write('content')
- resp.end()
- return
- }
- if (req.url === '/put') {
- var x = ''
- assert.equal(req.method, 'PUT')
- req.on('data', function (chunk) {
- x += chunk
- })
- req.on('end', function () {
- assert.equal(x, 'content')
- resp.write('success')
- resp.end()
- })
- return
- }
- if (req.url === '/proxy') {
- assert.equal(req.method, 'PUT')
- return req.pipe(request('http://localhost:8080/put')).pipe(resp)
- }
-
- if (req.url === '/test') {
- return request('http://localhost:8080/get').pipe(request.put('http://localhost:8080/proxy')).pipe(resp)
- }
- throw new Error('Unknown url', req.url)
-}).listen(8080, function () {
- request('http://localhost:8080/test', function (e, resp, body) {
- if (e) throw e
- if (resp.statusCode !== 200) throw new Error('statusCode not 200 ' + resp.statusCode)
- assert.equal(body, 'success')
- server.close()
- })
-})
-
-
-
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var s = server.createServer();
-
-var tests =
- { testGet :
- { resp : server.createGetResponse("TESTING!")
- , expectBody: "TESTING!"
- }
- , testGetChunkBreak :
- { resp : server.createChunkResponse(
- [ new Buffer([239])
- , new Buffer([163])
- , new Buffer([191])
- , new Buffer([206])
- , new Buffer([169])
- , new Buffer([226])
- , new Buffer([152])
- , new Buffer([131])
- ])
- , expectBody: "Ω☃"
- }
- , testGetBuffer :
- { resp : server.createGetResponse(new Buffer("TESTING!"))
- , encoding: null
- , expectBody: new Buffer("TESTING!")
- }
- , testGetJSON :
- { resp : server.createGetResponse('{"test":true}', 'application/json')
- , json : true
- , expectBody: {"test":true}
- }
- , testPutString :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : "PUTTINGDATA"
- }
- , testPutBuffer :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : new Buffer("PUTTINGDATA")
- }
- , testPutJSON :
- { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
- , method: "PUT"
- , json: {foo: 'bar'}
- }
- , testPutMultipart :
- { resp: server.createPostValidator(
- '--__BOUNDARY__\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--__BOUNDARY__\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--__BOUNDARY__--'
- )
- , method: "PUT"
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- }
-
-s.listen(s.port, function () {
-
- var counter = 0
-
- for (i in tests) {
- (function () {
- var test = tests[i]
- s.on('/'+i, test.resp)
- //test.uri = s.url + '/' + i
- request(s.url + '/' + i, test, function (err, resp, body) {
- if (err) throw err
- if (test.expectBody) {
- assert.deepEqual(test.expectBody, body)
- }
- counter = counter - 1;
- if (counter === 0) {
- assert.notEqual(typeof test.callback, 'function')
- console.log(1 + Object.keys(tests).length+" tests passed.")
- s.close()
- }
- })
- counter++
- })()
- }
-})
+++ /dev/null
-var http = require('http')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var portOne = 8968
- , portTwo = 8969
- ;
-
-
-// server one
-var s1 = http.createServer(function (req, resp) {
- if (req.url == '/original') {
- resp.writeHeader(302, {'location': '/redirected'})
- resp.end()
- } else if (req.url == '/redirected') {
- resp.writeHeader(200, {'content-type': 'text/plain'})
- resp.write('OK')
- resp.end()
- }
-
-}).listen(portOne);
-
-
-// server two
-var s2 = http.createServer(function (req, resp) {
- var x = request('http://localhost:'+portOne+'/original')
- req.pipe(x)
- x.pipe(resp)
-
-}).listen(portTwo, function () {
- var r = request('http://localhost:'+portTwo+'/original', function (err, res, body) {
- assert.equal(body, 'OK')
-
- s1.close()
- s2.close()
- });
-
- // it hangs, so wait a second :)
- r.timeout = 1000;
-
-})
+++ /dev/null
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , fs = require('fs')
- , request = require('../index')
- , path = require('path')
- , util = require('util')
- ;
-
-var s = server.createServer(3453);
-
-function ValidationStream(str) {
- this.str = str
- this.buf = ''
- this.on('data', function (data) {
- this.buf += data
- })
- this.on('end', function () {
- assert.equal(this.str, this.buf)
- })
- this.writable = true
-}
-util.inherits(ValidationStream, stream.Stream)
-ValidationStream.prototype.write = function (chunk) {
- this.emit('data', chunk)
-}
-ValidationStream.prototype.end = function (chunk) {
- if (chunk) emit('data', chunk)
- this.emit('end')
-}
-
-s.listen(s.port, function () {
- counter = 0;
-
- var check = function () {
- counter = counter - 1
- if (counter === 0) {
- console.log('All tests passed.')
- setTimeout(function () {
- process.exit();
- }, 500)
- }
- }
-
- // Test pipeing to a request object
- s.once('/push', server.createPostValidator("mydata"));
-
- var mydata = new stream.Stream();
- mydata.readable = true
-
- counter++
- var r1 = request.put({url:'http://localhost:3453/push'}, function () {
- check();
- })
- mydata.pipe(r1)
-
- mydata.emit('data', 'mydata');
- mydata.emit('end');
-
- // Test pipeing to a request object with a json body
- s.once('/push-json', server.createPostValidator("{\"foo\":\"bar\"}", "application/json"));
-
- var mybodydata = new stream.Stream();
- mybodydata.readable = true
-
- counter++
- var r2 = request.put({url:'http://localhost:3453/push-json',json:true}, function () {
- check();
- })
- mybodydata.pipe(r2)
-
- mybodydata.emit('data', JSON.stringify({foo:"bar"}));
- mybodydata.emit('end');
-
- // Test pipeing from a request object.
- s.once('/pull', server.createGetResponse("mypulldata"));
-
- var mypulldata = new stream.Stream();
- mypulldata.writable = true
-
- counter++
- request({url:'http://localhost:3453/pull'}).pipe(mypulldata)
-
- var d = '';
-
- mypulldata.write = function (chunk) {
- d += chunk;
- }
- mypulldata.end = function () {
- assert.equal(d, 'mypulldata');
- check();
- };
-
-
- s.on('/cat', function (req, resp) {
- if (req.method === "GET") {
- resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4});
- resp.end('asdf')
- } else if (req.method === "PUT") {
- assert.equal(req.headers['content-type'], 'text/plain-test');
- assert.equal(req.headers['content-length'], 4)
- var validate = '';
-
- req.on('data', function (chunk) {validate += chunk})
- req.on('end', function () {
- resp.writeHead(201);
- resp.end();
- assert.equal(validate, 'asdf');
- check();
- })
- }
- })
- s.on('/pushjs', function (req, resp) {
- if (req.method === "PUT") {
- assert.equal(req.headers['content-type'], 'application/javascript');
- check();
- }
- })
- s.on('/catresp', function (req, resp) {
- request.get('http://localhost:3453/cat').pipe(resp)
- })
- s.on('/doodle', function (req, resp) {
- if (req.headers['x-oneline-proxy']) {
- resp.setHeader('x-oneline-proxy', 'yup')
- }
- resp.writeHead('200', {'content-type':'image/jpeg'})
- fs.createReadStream(path.join(__dirname, 'googledoodle.jpg')).pipe(resp)
- })
- s.on('/onelineproxy', function (req, resp) {
- var x = request('http://localhost:3453/doodle')
- req.pipe(x)
- x.pipe(resp)
- })
-
- counter++
- fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs'))
-
- counter++
- request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat'))
-
- counter++
- request.get('http://localhost:3453/catresp', function (e, resp, body) {
- assert.equal(resp.headers['content-type'], 'text/plain-test');
- assert.equal(resp.headers['content-length'], 4)
- check();
- })
-
- var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.jpg'))
-
- counter++
- request.get('http://localhost:3453/doodle').pipe(doodleWrite)
-
- doodleWrite.on('close', function () {
- assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.jpg')), fs.readFileSync(path.join(__dirname, 'test.jpg')))
- check()
- })
-
- process.on('exit', function () {
- fs.unlinkSync(path.join(__dirname, 'test.jpg'))
- })
-
- counter++
- request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) {
- assert.equal(resp.headers['x-oneline-proxy'], 'yup')
- check()
- })
-
- s.on('/afterresponse', function (req, resp) {
- resp.write('d')
- resp.end()
- })
-
- counter++
- var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () {
- var v = new ValidationStream('d')
- afterresp.pipe(v)
- v.on('end', check)
- })
-
- s.on('/forward1', function (req, resp) {
- resp.writeHead(302, {location:'/forward2'})
- resp.end()
- })
- s.on('/forward2', function (req, resp) {
- resp.writeHead('200', {'content-type':'image/png'})
- resp.write('d')
- resp.end()
- })
-
- counter++
- var validateForward = new ValidationStream('d')
- validateForward.on('end', check)
- request.get('http://localhost:3453/forward1').pipe(validateForward)
-
- // Test pipe options
- s.once('/opts', server.createGetResponse('opts response'));
-
- var optsStream = new stream.Stream();
- optsStream.writable = true
-
- var optsData = '';
- optsStream.write = function (buf) {
- optsData += buf;
- if (optsData === 'opts response') {
- setTimeout(check, 10);
- }
- }
-
- optsStream.end = function () {
- assert.fail('end called')
- };
-
- counter++
- request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false })
-})
+++ /dev/null
-var request = require('../index')
- , http = require('http')
- , assert = require('assert')
- ;
-
-var s = http.createServer(function (req, resp) {
- resp.statusCode = 200;
- resp.end('asdf');
-}).listen(8080, function () {
- request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) {
- var agent = resp.request.agent;
- assert.strictEqual(typeof agent, 'boolean');
- assert.strictEqual(agent, false);
- s.close();
- });
-});
\ No newline at end of file
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
-
-
-var s = server.createServer()
-var ss = server.createSSLServer()
-var sUrl = 'http://localhost:' + s.port
-var ssUrl = 'https://localhost:' + ss.port
-
-s.listen(s.port, bouncy(s, ssUrl))
-ss.listen(ss.port, bouncy(ss, sUrl))
-
-var hits = {}
-var expect = {}
-var pending = 0
-function bouncy (s, server) { return function () {
-
- var redirs = { a: 'b'
- , b: 'c'
- , c: 'd'
- , d: 'e'
- , e: 'f'
- , f: 'g'
- , g: 'h'
- , h: 'end' }
-
- var perm = true
- Object.keys(redirs).forEach(function (p) {
- var t = redirs[p]
-
- // switch type each time
- var type = perm ? 301 : 302
- perm = !perm
- s.on('/' + p, function (req, res) {
- res.writeHead(type, { location: server + '/' + t })
- res.end()
- })
- })
-
- s.on('/end', function (req, res) {
- var h = req.headers['x-test-key']
- hits[h] = true
- pending --
- if (pending === 0) done()
- })
-}}
-
-for (var i = 0; i < 5; i ++) {
- pending ++
- var val = 'test_' + i
- expect[val] = true
- request({ url: (i % 2 ? sUrl : ssUrl) + '/a'
- , headers: { 'x-test-key': val }
- , rejectUnauthorized: false })
-}
-
-function done () {
- assert.deepEqual(hits, expect)
- process.exit(0)
-}
+++ /dev/null
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , fs = require('fs')
- , request = require('../index')
- , path = require('path')
- , util = require('util')
- ;
-
-var port = 6768
- , called = false
- , proxiedHost = 'google.com'
- ;
-
-var s = server.createServer(port)
-s.listen(port, function () {
- s.on('http://google.com/', function (req, res) {
- called = true
- assert.equal(req.headers.host, proxiedHost)
- res.writeHeader(200)
- res.end()
- })
- request ({
- url: 'http://'+proxiedHost,
- proxy: 'http://localhost:'+port
- /*
- //should behave as if these arguments where passed:
- url: 'http://localhost:'+port,
- headers: {host: proxiedHost}
- //*/
- }, function (err, res, body) {
- s.close()
- })
-})
-
-process.on('exit', function () {
- assert.ok(called, 'the request must be made to the proxy server')
-})
+++ /dev/null
-var request = request = require('../index')
- , assert = require('assert')
- ;
-
-
-// Test adding a querystring
-var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }})
-setTimeout(function() {
- assert.equal('/?q=search', req1.path)
-}, 1)
-
-// Test replacing a querystring value
-var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }})
-setTimeout(function() {
- assert.equal('/?q=search', req2.path)
-}, 1)
-
-// Test appending a querystring value to the ones present in the uri
-var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }})
-setTimeout(function() {
- assert.equal('/?x=y&q=search', req3.path)
-}, 1)
-
-// Test leaving a querystring alone
-var req4 = request.get({ uri: 'http://www.google.com?x=y'})
-setTimeout(function() {
- assert.equal('/?x=y', req4.path)
-}, 1)
-
-// Test giving empty qs property
-var req5 = request.get({ uri: 'http://www.google.com', qs: {}})
-setTimeout(function(){
- assert.equal('/', req5.path)
-}, 1)
-
-
-// Test modifying the qs after creating the request
-var req6 = request.get({ uri: 'http://www.google.com', qs: {}});
-req6.qs({ q: "test" });
-process.nextTick(function() {
- assert.equal('/?q=test', req6.path);
-});
+++ /dev/null
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- , Cookie = require('cookie-jar')
- , Jar = Cookie.Jar
- ;
-
-var s = server.createServer()
-
-s.listen(s.port, function () {
- var server = 'http://localhost:' + s.port;
- var hits = {}
- var passed = 0;
-
- bouncer(301, 'temp')
- bouncer(302, 'perm')
- bouncer(302, 'nope')
-
- function bouncer(code, label) {
- var landing = label+'_landing';
-
- s.on('/'+label, function (req, res) {
- hits[label] = true;
- res.writeHead(code, {
- 'location':server + '/'+landing,
- 'set-cookie': 'ham=eggs'
- })
- res.end()
- })
-
- s.on('/'+landing, function (req, res) {
- if (req.method !== 'GET') { // We should only accept GET redirects
- console.error("Got a non-GET request to the redirect destination URL");
- res.writeHead(400);
- res.end();
- return;
- }
- // Make sure the cookie doesn't get included twice, see #139:
- // Make sure cookies are set properly after redirect
- assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs');
- hits[landing] = true;
- res.writeHead(200)
- res.end(landing)
- })
- }
-
- // Permanent bounce
- var jar = new Jar()
- jar.add(new Cookie('quux=baz'))
- request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
- assert.ok(hits.perm, 'Original request is to /perm')
- assert.ok(hits.perm_landing, 'Forward to permanent landing URL')
- assert.equal(body, 'perm_landing', 'Got permanent landing content')
- passed += 1
- done()
- })
-
- // Temporary bounce
- request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
- assert.equal(body, 'temp_landing', 'Got temporary landing content')
- passed += 1
- done()
- })
-
- // Prevent bouncing.
- request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode)
- assert.ok(hits.nope, 'Original request to /nope')
- assert.ok(!hits.nope_landing, 'No chasing the redirect')
- assert.equal(res.statusCode, 302, 'Response is the bounce itself')
- passed += 1
- done()
- })
-
- // Should not follow post redirects by default
- request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(!hits.temp_landing, 'No chasing the redirect when post')
- assert.equal(res.statusCode, 301, 'Response is the bounce itself')
- passed += 1
- done()
- })
-
- // Should follow post redirects when followAllRedirects true
- request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
- assert.equal(body, 'temp_landing', 'Got temporary landing content')
- passed += 1
- done()
- })
-
- request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(!hits.temp_landing, 'No chasing the redirect')
- assert.equal(res.statusCode, 301, 'Response is the bounce itself')
- passed += 1
- done()
- })
-
- // Should not follow delete redirects by default
- request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode < 301) throw new Error('Status is not a redirect.')
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
- assert.equal(res.statusCode, 301, 'Response is the bounce itself')
- passed += 1
- done()
- })
-
- // Should not follow delete redirects even if followRedirect is set to true
- request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
- assert.equal(res.statusCode, 301, 'Response is the bounce itself')
- passed += 1
- done()
- })
-
- // Should follow delete redirects when followAllRedirects true
- request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
- if (er) throw er
- if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
- assert.ok(hits.temp, 'Original request is to /temp')
- assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
- assert.equal(body, 'temp_landing', 'Got temporary landing content')
- passed += 1
- done()
- })
-
- var reqs_done = 0;
- function done() {
- reqs_done += 1;
- if(reqs_done == 9) {
- console.log(passed + ' tests passed.')
- s.close()
- }
- }
-})
+++ /dev/null
-var request = require('../index')
-
-var r = request.get('https://log.curlybracecast.com.s3.amazonaws.com/',
- { aws:
- { key: 'AKIAI6KIQRRVMGK3WK5Q'
- , secret: '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'
- , bucket: 'log.curlybracecast.com'
- }
- }, function (e, resp, body) {
- console.log(r.headers)
- console.log(body)
- }
-)
\ No newline at end of file
+++ /dev/null
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , request = require('../index')
- ;
-
-var s = server.createServer();
-var expectedBody = "waited";
-var remainingTests = 5;
-
-s.listen(s.port, function () {
- // Request that waits for 200ms
- s.on('/timeout', function (req, resp) {
- setTimeout(function(){
- resp.writeHead(200, {'content-type':'text/plain'})
- resp.write(expectedBody)
- resp.end()
- }, 200);
- });
-
- // Scenario that should timeout
- var shouldTimeout = {
- url: s.url + "/timeout",
- timeout:100
- }
-
-
- request(shouldTimeout, function (err, resp, body) {
- assert.equal(err.code, "ETIMEDOUT");
- checkDone();
- })
-
-
- // Scenario that shouldn't timeout
- var shouldntTimeout = {
- url: s.url + "/timeout",
- timeout:300
- }
-
- request(shouldntTimeout, function (err, resp, body) {
- assert.equal(err, null);
- assert.equal(expectedBody, body)
- checkDone();
- })
-
- // Scenario with no timeout set, so shouldn't timeout
- var noTimeout = {
- url: s.url + "/timeout"
- }
-
- request(noTimeout, function (err, resp, body) {
- assert.equal(err);
- assert.equal(expectedBody, body)
- checkDone();
- })
-
- // Scenario with a negative timeout value, should be treated a zero or the minimum delay
- var negativeTimeout = {
- url: s.url + "/timeout",
- timeout:-1000
- }
-
- request(negativeTimeout, function (err, resp, body) {
- assert.equal(err.code, "ETIMEDOUT");
- checkDone();
- })
-
- // Scenario with a float timeout value, should be rounded by setTimeout anyway
- var floatTimeout = {
- url: s.url + "/timeout",
- timeout: 100.76
- }
-
- request(floatTimeout, function (err, resp, body) {
- assert.equal(err.code, "ETIMEDOUT");
- checkDone();
- })
-
- function checkDone() {
- if(--remainingTests == 0) {
- s.close();
- console.log("All tests passed.");
- }
- }
-})
-
+++ /dev/null
-var request = require('../index')
- , http = require('http')
- , assert = require('assert')
- ;
-
-var s = http.createServer(function (req, resp) {
- resp.statusCode = 200
- resp.end('asdf')
-}).listen(8080, function () {
- var r = request('http://localhost:8080', function (e, resp) {
- assert.equal(JSON.parse(JSON.stringify(r)).response.statusCode, 200)
- s.close()
- })
-})
\ No newline at end of file
+++ /dev/null
-// test that we can tunnel a https request over an http proxy
-// keeping all the CA and whatnot intact.
-//
-// Note: this requires that squid is installed.
-// If the proxy fails to start, we'll just log a warning and assume success.
-
-var server = require('./server')
- , assert = require('assert')
- , request = require('../index')
- , fs = require('fs')
- , path = require('path')
- , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt')
- , ca = fs.readFileSync(caFile)
- , child_process = require('child_process')
- , sqConf = path.resolve(__dirname, 'squid.conf')
- , sqArgs = ['-f', sqConf, '-N', '-d', '5']
- , proxy = 'http://localhost:3128'
- , hadError = null
-
-var squid = child_process.spawn('squid', sqArgs);
-var ready = false
-
-squid.stderr.on('data', function (c) {
- console.error('SQUIDERR ' + c.toString().trim().split('\n')
- .join('\nSQUIDERR '))
- ready = c.toString().match(/ready to serve requests|Accepting HTTP Socket connections/i)
-})
-
-squid.stdout.on('data', function (c) {
- console.error('SQUIDOUT ' + c.toString().trim().split('\n')
- .join('\nSQUIDOUT '))
-})
-
-squid.on('error', function (c) {
- console.error('squid: error '+c)
- if (c && !ready) {
- notInstalled()
- return
- }
-})
-
-squid.on('exit', function (c) {
- console.error('squid: exit '+c)
- if (c && !ready) {
- notInstalled()
- return
- }
-
- if (c) {
- hadError = hadError || new Error('Squid exited with '+c)
- }
- if (hadError) throw hadError
-})
-
-setTimeout(function F () {
- if (!ready) return setTimeout(F, 100)
- request({ uri: 'https://registry.npmjs.org/'
- , proxy: 'http://localhost:3128'
- , strictSSL: true
- , ca: ca
- , json: true }, function (er, body) {
- hadError = er
- console.log(er || typeof body)
- if (!er) console.log("ok")
- squid.kill('SIGKILL')
- })
-}, 100)
-
-function notInstalled() {
- console.error('squid must be installed to run this test.')
- console.error('skipping this test. please install squid and run again if you need to test tunneling.')
- c = null
- hadError = null
- process.exit(0)
-}
-A `rm -rf` for node.
+`rm -rf` for node.
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
The callback will be called with an error if there is one. Certain
errors are handled for you:
-* `EBUSY` - rimraf will back off a maximum of opts.maxBusyTries times
- before giving up.
-* `EMFILE` - If too many file descriptors get opened, rimraf will
- patiently wait until more become available.
-
+* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
+ `opts.maxBusyTries` times before giving up.
+* `ENOENT` - If the file doesn't exist, rimraf will return
+ successfully, since your desired outcome is already the case.
## rimraf.sync
If installed with `npm install rimraf -g` it can be used as a global
command `rimraf <path>` which is useful for cross platform support.
+
+## mkdirp
+
+If you need to create a directory recursively, check out
+[mkdirp](https://github.com/substack/node-mkdirp).
{
"name": "rimraf",
- "version": "2.2.2",
+ "version": "2.2.5",
"main": "rimraf.js",
"description": "A deep deletion module for node (like `rm -rf`)",
"author": {
"type": "MIT",
"url": "https://github.com/isaacs/rimraf/raw/master/LICENSE"
},
- "optionalDependencies": {
- "graceful-fs": "~2"
- },
"repository": {
"type": "git",
"url": "git://github.com/isaacs/rimraf.git"
"email": "yosefd@microsoft.com"
}
],
- "readme": "A `rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, callback)`\n\nThe callback will be called with an error if there is one. Certain\nerrors are handled for you:\n\n* `EBUSY` - rimraf will back off a maximum of opts.maxBusyTries times\n before giving up.\n* `EMFILE` - If too many file descriptors get opened, rimraf will\n patiently wait until more become available.\n\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too. But that's not so good. Use\nthe async API. It's better.\n\n## CLI\n\nIf installed with `npm install rimraf -g` it can be used as a global\ncommand `rimraf <path>` which is useful for cross platform support.\n",
+ "readme": "`rm -rf` for node.\n\nInstall with `npm install rimraf`, or just drop rimraf.js somewhere.\n\n## API\n\n`rimraf(f, callback)`\n\nThe callback will be called with an error if there is one. Certain\nerrors are handled for you:\n\n* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of\n `opts.maxBusyTries` times before giving up.\n* `ENOENT` - If the file doesn't exist, rimraf will return\n successfully, since your desired outcome is already the case.\n\n## rimraf.sync\n\nIt can remove stuff synchronously, too. But that's not so good. Use\nthe async API. It's better.\n\n## CLI\n\nIf installed with `npm install rimraf -g` it can be used as a global\ncommand `rimraf <path>` which is useful for cross platform support.\n\n## mkdirp\n\nIf you need to create a directory recursively, check out\n[mkdirp](https://github.com/substack/node-mkdirp).\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/rimraf/issues"
},
- "dependencies": {
- "graceful-fs": "~2"
- },
- "_id": "rimraf@2.2.2",
- "dist": {
- "shasum": "d99ec41dc646e55bf7a7a44a255c28bef33a8abf"
- },
- "_from": "rimraf@2.2.2",
- "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.2.tgz"
+ "homepage": "https://github.com/isaacs/rimraf",
+ "_id": "rimraf@2.2.5",
+ "_from": "rimraf@latest"
}
rimraf.sync = rimrafSync
var path = require("path")
- , fs
-
-try {
- // optional dependency
- fs = require("graceful-fs")
-} catch (er) {
- fs = require("fs")
-}
+var fs = require("fs")
// for EMFILE handling
var timeout = 0
var busyTries = 0
rimraf_(p, function CB (er) {
if (er) {
- if (er.code === "EBUSY" && busyTries < exports.BUSYTRIES_MAX) {
+ if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") &&
+ busyTries < exports.BUSYTRIES_MAX) {
busyTries ++
var time = busyTries * 100
// try again, with the same exact callback as this one.
fs.unlink(p, function (er) {
if (er) {
if (er.code === "ENOENT")
- return cb()
+ return cb(null)
if (er.code === "EPERM")
return (isWindows) ? fixWinEPERM(p, er, cb) : rmdir(p, er, cb)
if (er.code === "EISDIR")
Tar for Node.js.
-## Goals of this project
+[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)
-1. Be able to parse and reasonably extract the contents of any tar file
- created by any program that creates tar files, period.
+## API
- At least, this includes every version of:
+See `examples/` for usage examples.
- * bsdtar
- * gnutar
- * solaris posix tar
- * Joerg Schilling's star ("Schilly tar")
+### var tar = require('tar')
-2. Create tar files that can be extracted by any of the following tar programs:
+Returns an object with `.Pack`, `.Extract` and `.Parse` methods.
- * bsdtar/libarchive version 2.6.2
- * gnutar 1.15 and above
- * SunOS Posix tar
- * Joerg Schilling's star ("Schilly tar")
+### tar.Pack([properties])
-3. 100% test coverage. Speed is important. Correctness is slightly more important.
+Returns a through stream. Use
+[fstream](https://npmjs.org/package/fstream) to write files into the
+pack stream and you will receive tar archive data from the pack
+stream.
-4. Create the kind of tar interface that Node users would want to use.
+The optional `properties` object are used to set properties in the tar
+'Global Extended Header'.
-5. Satisfy npm's needs for a portable tar implementation with a JavaScript interface.
+### tar.Extract([options])
-6. No excuses. No complaining. No tolerance for failure.
+Returns a through stream. Write tar data to the stream and the files
+in the tarball will be extracted onto the filesystem.
-## But isn't there already a tar.js?
+`options` can be:
-Yes, there are a few. This one is going to be better, and it will be
-fanatically maintained, because npm will depend on it.
+```js
+{
+ path: '/path/to/extract/tar/into',
+ strip: 0, // how many path segments to strip from the root when extracting
+}
+```
-That's why I need to write it from scratch. Creating and extracting
-tarballs is such a large part of what npm does, I simply can't have it
-be a black box any longer.
+`options` also get passed to the `fstream.Writer` instance that `tar`
+uses internally.
-## Didn't you have something already? Where'd it go?
+### tar.Parse()
-It's in the "old" folder. It's not functional. Don't use it.
-
-It was a useful exploration to learn the issues involved, but like most
-software of any reasonable complexity, node-tar won't be useful until
-it's been written at least 3 times.
+Returns a writable stream. Write tar data to it and it will emit
+`entry` events for each entry parsed from the tarball. This is used by
+`tar.Extract`.
},
"name": "tar",
"description": "tar for node",
- "version": "0.1.18",
+ "version": "0.1.19",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-tar.git"
"rimraf": "1.x"
},
"license": "BSD",
- "readme": "# node-tar\n\nTar for Node.js.\n\n## Goals of this project\n\n1. Be able to parse and reasonably extract the contents of any tar file\n created by any program that creates tar files, period.\n\n At least, this includes every version of:\n\n * bsdtar\n * gnutar\n * solaris posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n2. Create tar files that can be extracted by any of the following tar programs:\n\n * bsdtar/libarchive version 2.6.2\n * gnutar 1.15 and above\n * SunOS Posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n3. 100% test coverage. Speed is important. Correctness is slightly more important.\n\n4. Create the kind of tar interface that Node users would want to use.\n\n5. Satisfy npm's needs for a portable tar implementation with a JavaScript interface.\n\n6. No excuses. No complaining. No tolerance for failure.\n\n## But isn't there already a tar.js?\n\nYes, there are a few. This one is going to be better, and it will be\nfanatically maintained, because npm will depend on it.\n\nThat's why I need to write it from scratch. Creating and extracting\ntarballs is such a large part of what npm does, I simply can't have it\nbe a black box any longer.\n\n## Didn't you have something already? Where'd it go?\n\nIt's in the \"old\" folder. It's not functional. Don't use it.\n\nIt was a useful exploration to learn the issues involved, but like most\nsoftware of any reasonable complexity, node-tar won't be useful until\nit's been written at least 3 times.\n",
+ "readme": "# node-tar\n\nTar for Node.js.\n\n[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)\n\n## API\n\nSee `examples/` for usage examples.\n\n### var tar = require('tar')\n\nReturns an object with `.Pack`, `.Extract` and `.Parse` methods.\n\n### tar.Pack([properties])\n\nReturns a through stream. Use\n[fstream](https://npmjs.org/package/fstream) to write files into the\npack stream and you will receive tar archive data from the pack\nstream.\n\nThe optional `properties` object are used to set properties in the tar\n'Global Extended Header'.\n\n### tar.Extract([options])\n\nReturns a through stream. Write tar data to the stream and the files\nin the tarball will be extracted onto the filesystem.\n\n`options` can be:\n\n```js\n{\n path: '/path/to/extract/tar/into',\n strip: 0, // how many path segments to strip from the root when extracting\n}\n```\n\n`options` also get passed to the `fstream.Writer` instance that `tar`\nuses internally.\n\n### tar.Parse()\n\nReturns a writable stream. Write tar data to it and it will emit\n`entry` events for each entry parsed from the tarball. This is used by\n`tar.Extract`.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/node-tar/issues"
},
- "_id": "tar@0.1.18",
- "_from": "tar@latest"
+ "homepage": "https://github.com/isaacs/node-tar",
+ "_id": "tar@0.1.19",
+ "dist": {
+ "shasum": "fe45941799e660ce1ea52d875d37481b4bf13eac"
+ },
+ "_from": "tar@0.1.19",
+ "_resolved": "https://registry.npmjs.org/tar/-/tar-0.1.19.tgz"
}
--- /dev/null
+language: node_js
+node_js:
+ - "0.8"
+ - "0.10"
--- /dev/null
+This software is released under the MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+var table = require('../');
+var t = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '33450' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45' ]
+], { align: [ 'l', 'r' ] });
+console.log(t);
--- /dev/null
+var table = require('../');
+var t = table([
+ [ 'beep', '1024', 'xyz' ],
+ [ 'boop', '3388450', 'tuv' ],
+ [ 'foo', '10106', 'qrstuv' ],
+ [ 'bar', '45', 'lmno' ]
+], { align: [ 'l', 'c', 'l' ] });
+console.log(t);
--- /dev/null
+var table = require('../');
+var t = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '334.212' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45.6' ],
+ [ 'baz', '123.' ]
+], { align: [ 'l', '.' ] });
+console.log(t);
--- /dev/null
+var table = require('../');
+var t = table([
+ [ '0.1.2' ],
+ [ '11.22.33' ],
+ [ '5.6.7' ],
+ [ '1.22222' ],
+ [ '12345.' ],
+ [ '5555.' ],
+ [ '123' ]
+], { align: [ '.' ] });
+console.log(t);
--- /dev/null
+var table = require('../');
+var t = table([
+ [ 'master', '0123456789abcdef' ],
+ [ 'staging', 'fedcba9876543210' ]
+]);
+console.log(t);
--- /dev/null
+module.exports = function (rows_, opts) {
+ if (!opts) opts = {};
+ var hsep = opts.hsep === undefined ? ' ' : opts.hsep;
+ var align = opts.align || [];
+ var stringLength = opts.stringLength
+ || function (s) { return String(s).length; }
+ ;
+
+ var dotsizes = reduce(rows_, function (acc, row) {
+ forEach(row, function (c, ix) {
+ var n = dotindex(c);
+ if (!acc[ix] || n > acc[ix]) acc[ix] = n;
+ });
+ return acc;
+ }, []);
+
+ var rows = map(rows_, function (row) {
+ return map(row, function (c_, ix) {
+ var c = String(c_);
+ if (align[ix] === '.') {
+ var index = dotindex(c);
+ var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2)
+ - (stringLength(c) - index)
+ ;
+ return c + Array(size).join(' ');
+ }
+ else return c;
+ });
+ });
+
+ var sizes = reduce(rows, function (acc, row) {
+ forEach(row, function (c, ix) {
+ var n = stringLength(c);
+ if (!acc[ix] || n > acc[ix]) acc[ix] = n;
+ });
+ return acc;
+ }, []);
+
+ return map(rows, function (row) {
+ return map(row, function (c, ix) {
+ var n = (sizes[ix] - stringLength(c)) || 0;
+ var s = Array(Math.max(n + 1, 1)).join(' ');
+ if (align[ix] === 'r' || align[ix] === '.') {
+ return s + c;
+ }
+ if (align[ix] === 'c') {
+ return Array(Math.ceil(n / 2 + 1)).join(' ')
+ + c + Array(Math.floor(n / 2 + 1)).join(' ')
+ ;
+ }
+
+ return c + s;
+ }).join(hsep).replace(/\s+$/, '');
+ }).join('\n');
+};
+
+function dotindex (c) {
+ var m = /\.[^.]*$/.exec(c);
+ return m ? m.index + 1 : c.length;
+}
+
+function reduce (xs, f, init) {
+ if (xs.reduce) return xs.reduce(f, init);
+ var i = 0;
+ var acc = arguments.length >= 3 ? init : xs[i++];
+ for (; i < xs.length; i++) {
+ f(acc, xs[i], i);
+ }
+ return acc;
+}
+
+function forEach (xs, f) {
+ if (xs.forEach) return xs.forEach(f);
+ for (var i = 0; i < xs.length; i++) {
+ f.call(xs, xs[i], i);
+ }
+}
+
+function map (xs, f) {
+ if (xs.map) return xs.map(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ res.push(f.call(xs, xs[i], i));
+ }
+ return res;
+}
--- /dev/null
+{
+ "name": "text-table",
+ "version": "0.2.0",
+ "description": "borderless text tables with alignment",
+ "main": "index.js",
+ "devDependencies": {
+ "tap": "~0.4.0",
+ "tape": "~1.0.2",
+ "cli-color": "~0.2.3"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "testling": {
+ "files": "test/*.js",
+ "browsers": [
+ "ie/6..latest",
+ "chrome/20..latest",
+ "firefox/10..latest",
+ "safari/latest",
+ "opera/11.0..latest",
+ "iphone/6",
+ "ipad/6"
+ ]
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/substack/text-table.git"
+ },
+ "homepage": "https://github.com/substack/text-table",
+ "keywords": [
+ "text",
+ "table",
+ "align",
+ "ascii",
+ "rows",
+ "tabular"
+ ],
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "license": "MIT",
+ "readme": "# text-table\n\ngenerate borderless text table strings suitable for printing to stdout\n\n[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table)\n\n[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table)\n\n# example\n\n## default align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'master', '0123456789abcdef' ],\n [ 'staging', 'fedcba9876543210' ]\n]);\nconsole.log(t);\n```\n\n```\nmaster 0123456789abcdef\nstaging fedcba9876543210\n```\n\n## left-right align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024' ],\n [ 'boop', '33450' ],\n [ 'foo', '1006' ],\n [ 'bar', '45' ]\n], { align: [ 'l', 'r' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024\nboop 33450\nfoo 1006\nbar 45\n```\n\n## dotted align\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024' ],\n [ 'boop', '334.212' ],\n [ 'foo', '1006' ],\n [ 'bar', '45.6' ],\n [ 'baz', '123.' ]\n], { align: [ 'l', '.' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024\nboop 334.212\nfoo 1006\nbar 45.6\nbaz 123.\n```\n\n## centered\n\n``` js\nvar table = require('text-table');\nvar t = table([\n [ 'beep', '1024', 'xyz' ],\n [ 'boop', '3388450', 'tuv' ],\n [ 'foo', '10106', 'qrstuv' ],\n [ 'bar', '45', 'lmno' ]\n], { align: [ 'l', 'c', 'l' ] });\nconsole.log(t);\n```\n\n```\nbeep 1024 xyz\nboop 3388450 tuv\nfoo 10106 qrstuv\nbar 45 lmno\n```\n\n# methods\n\n``` js\nvar table = require('text-table')\n```\n\n## var s = table(rows, opts={})\n\nReturn a formatted table string `s` from an array of `rows` and some options\n`opts`.\n\n`rows` should be an array of arrays containing strings, numbers, or other\nprintable values.\n\noptions can be:\n\n* `opts.hsep` - separator to use between columns, default `' '`\n* `opts.align` - array of alignment types for each column, default `['l','l',...]`\n* `opts.stringLength` - callback function to use when calculating the string length\n\nalignment types are:\n\n* `'l'` - left\n* `'r'` - right\n* `'c'` - center\n* `'.'` - decimal\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install text-table\n```\n\n# Use with ANSI-colors\n\nSince the string length of ANSI color schemes does not equal the length\nJavaScript sees internally it is necessary to pass the a custom string length\ncalculator during the main function call.\n\nSee the `test/ansi-colors.js` file for an example.\n\n# license\n\nMIT\n",
+ "readmeFilename": "readme.markdown",
+ "bugs": {
+ "url": "https://github.com/substack/text-table/issues"
+ },
+ "_id": "text-table@0.2.0",
+ "_from": "text-table@~0.2.0"
+}
--- /dev/null
+# text-table
+
+generate borderless text table strings suitable for printing to stdout
+
+[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table)
+
+[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table)
+
+# example
+
+## default align
+
+``` js
+var table = require('text-table');
+var t = table([
+ [ 'master', '0123456789abcdef' ],
+ [ 'staging', 'fedcba9876543210' ]
+]);
+console.log(t);
+```
+
+```
+master 0123456789abcdef
+staging fedcba9876543210
+```
+
+## left-right align
+
+``` js
+var table = require('text-table');
+var t = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '33450' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45' ]
+], { align: [ 'l', 'r' ] });
+console.log(t);
+```
+
+```
+beep 1024
+boop 33450
+foo 1006
+bar 45
+```
+
+## dotted align
+
+``` js
+var table = require('text-table');
+var t = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '334.212' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45.6' ],
+ [ 'baz', '123.' ]
+], { align: [ 'l', '.' ] });
+console.log(t);
+```
+
+```
+beep 1024
+boop 334.212
+foo 1006
+bar 45.6
+baz 123.
+```
+
+## centered
+
+``` js
+var table = require('text-table');
+var t = table([
+ [ 'beep', '1024', 'xyz' ],
+ [ 'boop', '3388450', 'tuv' ],
+ [ 'foo', '10106', 'qrstuv' ],
+ [ 'bar', '45', 'lmno' ]
+], { align: [ 'l', 'c', 'l' ] });
+console.log(t);
+```
+
+```
+beep 1024 xyz
+boop 3388450 tuv
+foo 10106 qrstuv
+bar 45 lmno
+```
+
+# methods
+
+``` js
+var table = require('text-table')
+```
+
+## var s = table(rows, opts={})
+
+Return a formatted table string `s` from an array of `rows` and some options
+`opts`.
+
+`rows` should be an array of arrays containing strings, numbers, or other
+printable values.
+
+options can be:
+
+* `opts.hsep` - separator to use between columns, default `' '`
+* `opts.align` - array of alignment types for each column, default `['l','l',...]`
+* `opts.stringLength` - callback function to use when calculating the string length
+
+alignment types are:
+
+* `'l'` - left
+* `'r'` - right
+* `'c'` - center
+* `'.'` - decimal
+
+# install
+
+With [npm](https://npmjs.org) do:
+
+```
+npm install text-table
+```
+
+# Use with ANSI-colors
+
+Since the string length of ANSI color schemes does not equal the length
+JavaScript sees internally it is necessary to pass the a custom string length
+calculator during the main function call.
+
+See the `test/ansi-colors.js` file for an example.
+
+# license
+
+MIT
--- /dev/null
+var test = require('tape');
+var table = require('../');
+
+test('align', function (t) {
+ t.plan(1);
+ var s = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '33450' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45' ]
+ ], { align: [ 'l', 'r' ] });
+ t.equal(s, [
+ 'beep 1024',
+ 'boop 33450',
+ 'foo 1006',
+ 'bar 45'
+ ].join('\n'));
+});
--- /dev/null
+var test = require('tape');
+var table = require('../');
+var color = require('cli-color');
+var ansiTrim = require('cli-color/lib/trim');
+
+test('center', function (t) {
+ t.plan(1);
+ var opts = {
+ align: [ 'l', 'c', 'l' ],
+ stringLength: function(s) { return ansiTrim(s).length }
+ };
+ var s = table([
+ [
+ color.red('Red'), color.green('Green'), color.blue('Blue')
+ ],
+ [
+ color.bold('Bold'), color.underline('Underline'),
+ color.italic('Italic')
+ ],
+ [
+ color.inverse('Inverse'), color.strike('Strike'),
+ color.blink('Blink')
+ ],
+ [ 'bar', '45', 'lmno' ]
+ ], opts);
+ t.equal(ansiTrim(s), [
+ 'Red Green Blue',
+ 'Bold Underline Italic',
+ 'Inverse Strike Blink',
+ 'bar 45 lmno'
+ ].join('\n'));
+});
--- /dev/null
+var test = require('tape');
+var table = require('../');
+
+test('center', function (t) {
+ t.plan(1);
+ var s = table([
+ [ 'beep', '1024', 'xyz' ],
+ [ 'boop', '3388450', 'tuv' ],
+ [ 'foo', '10106', 'qrstuv' ],
+ [ 'bar', '45', 'lmno' ]
+ ], { align: [ 'l', 'c', 'l' ] });
+ t.equal(s, [
+ 'beep 1024 xyz',
+ 'boop 3388450 tuv',
+ 'foo 10106 qrstuv',
+ 'bar 45 lmno'
+ ].join('\n'));
+});
--- /dev/null
+var test = require('tape');
+var table = require('../');
+
+test('dot align', function (t) {
+ t.plan(1);
+ var s = table([
+ [ 'beep', '1024' ],
+ [ 'boop', '334.212' ],
+ [ 'foo', '1006' ],
+ [ 'bar', '45.6' ],
+ [ 'baz', '123.' ]
+ ], { align: [ 'l', '.' ] });
+ t.equal(s, [
+ 'beep 1024',
+ 'boop 334.212',
+ 'foo 1006',
+ 'bar 45.6',
+ 'baz 123.'
+ ].join('\n'));
+});
--- /dev/null
+var test = require('tape');
+var table = require('../');
+
+test('dot align', function (t) {
+ t.plan(1);
+ var s = table([
+ [ '0.1.2' ],
+ [ '11.22.33' ],
+ [ '5.6.7' ],
+ [ '1.22222' ],
+ [ '12345.' ],
+ [ '5555.' ],
+ [ '123' ]
+ ], { align: [ '.' ] });
+ t.equal(s, [
+ ' 0.1.2',
+ '11.22.33',
+ ' 5.6.7',
+ ' 1.22222',
+ '12345.',
+ ' 5555.',
+ ' 123'
+ ].join('\n'));
+});
--- /dev/null
+var test = require('tape');
+var table = require('../');
+
+test('table', function (t) {
+ t.plan(1);
+ var s = table([
+ [ 'master', '0123456789abcdef' ],
+ [ 'staging', 'fedcba9876543210' ]
+ ]);
+ t.equal(s, [
+ 'master 0123456789abcdef',
+ 'staging fedcba9876543210'
+ ].join('\n'));
+});
{
- "version": "1.3.15",
+ "version": "1.3.17",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
"graceful-fs": "~2.0.0",
"minimatch": "~0.2.12",
"nopt": "~2.1.2",
- "rimraf": "~2.2.0",
- "request": "~2.27.0",
+ "rimraf": "~2.2.5",
+ "request": "~2.29.0",
"which": "1",
- "tar": "~0.1.18",
- "fstream": "~0.1.23",
+ "tar": "~0.1.19",
+ "fstream": "~0.1.25",
"block-stream": "0.0.7",
"mkdirp": "~0.3.5",
"read": "~1.0.4",
- "lru-cache": "~2.3.1",
+ "lru-cache": "~2.5.0",
"node-gyp": "~0.12.0",
"fstream-npm": "~0.1.6",
"uid-number": "0",
"chownr": "0",
"npmlog": "0.0.6",
"ansi": "~0.2.1",
- "npm-registry-client": "~0.2.29",
+ "npm-registry-client": "~0.2.30",
"read-package-json": "~1.1.4",
"read-installed": "~0.2.2",
"glob": "~3.2.6",
- "init-package-json": "0.0.13",
+ "init-package-json": "0.0.14",
"osenv": "0",
"lockfile": "~0.4.0",
"retry": "~0.6.0",
"once": "~1.3.0",
- "npmconf": "~0.1.6",
+ "npmconf": "~0.1.7",
"opener": "~1.3.0",
"chmodr": "~0.1.0",
"cmd-shim": "~1.1.1",
"child-process-close": "~0.1.1",
"npm-user-validate": "0.0.3",
"github-url-from-git": "1.1.1",
- "github-url-from-username-repo": "0.0.2"
+ "github-url-from-username-repo": "0.0.2",
+ "text-table": "~0.2.0",
+ "ansicolors": "~0.3.2",
+ "ansistyles": "~0.1.3"
},
"bundleDependencies": [
"semver",
"npm-user-validate",
"github-url-from-git",
"github-url-from-username-repo",
- "normalize-package-data"
+ "normalize-package-data",
+ "text-table",
+ "ansicolors",
+ "ansistyles"
],
"devDependencies": {
"ronn": "~0.3.6",
--- /dev/null
+var common = require('../common-tap')
+ , test = require('tap').test
+ , rimraf = require('rimraf')
+ , npm = require('../../')
+ , mr = require('npm-registry-mock')
+ , pkg = __dirname + '/outdated-depth'
+
+function cleanup () {
+ rimraf.sync(pkg + '/node_modules')
+ rimraf.sync(pkg + '/cache')
+}
+
+test('outdated depth integer', function (t) {
+ // todo: update with test-package-with-one-dep once the new
+ // npm-registry-mock is published
+ var expected = [
+ pkg,
+ 'underscore',
+ '1.3.1',
+ '1.3.1',
+ '1.5.1',
+ '1.3.1'
+ ]
+
+ process.chdir(pkg)
+
+ mr(common.port, function (s) {
+ npm.load({
+ cache: pkg + '/cache'
+ , loglevel: 'silent'
+ , registry: common.registry
+ , depth: 5
+ }
+ , function () {
+ npm.install('request@0.9.0', function (er) {
+ if (er) throw new Error(er)
+ npm.outdated(function (err, d) {
+ if (err) throw new Error(err)
+ t.deepEqual(d[0], expected)
+ s.close()
+ t.end()
+ })
+ })
+ }
+ )
+ })
+})
+
+test("cleanup", function (t) {
+ cleanup()
+ t.end()
+})
\ No newline at end of file
--- /dev/null
+# just a test
--- /dev/null
+module.exports = true
--- /dev/null
+{
+ "name": "whatever",
+ "description": "yeah idk",
+ "version": "1.2.3",
+ "main": "index.js",
+ "dependencies": {
+ "underscore": "1.3.1"
+ },
+ "repository": "git://github.com/luk-/whatever"
+}
+++ /dev/null
-{"name":"startstop"
-,"version":"1.2.3"
-,"scripts":{"start":"echo 'start'","stop":"echo 'stop'"}}
{ "name":"npm-test-blerg"
-, "version" : "0.0.0"
+, "version" : "0.0.1"
, "scripts" : { "test" : "node test.js" }
, "publishConfig": {"tag": "foo"}
}
--- /dev/null
+var test = require("tap").test
+ , fs = require("fs")
+ , path = require("path")
+ , existsSync = fs.existsSync || path.existsSync
+ , npm = require("../../")
+ , rimraf = require("rimraf")
+
+test("dedupe finds the common module and moves it up one level", function (t) {
+ t.plan(1)
+
+ setup(function () {
+ npm.install(".", function (err) {
+ if (err) return t.fail(err)
+ npm.dedupe(function(err) {
+ if (err) return t.fail(err)
+ t.ok(existsSync(path.join(__dirname, "dedupe", "node_modules", "minimist")))
+ })
+ })
+ })
+})
+
+function setup (cb) {
+ process.chdir(path.join(__dirname, "dedupe"))
+ npm.load(function () {
+ rimraf.sync(path.join(__dirname, "dedupe", "node_modules"))
+ fs.mkdirSync(path.join(__dirname, "dedupe", "node_modules"))
+ cb()
+ })
+}
--- /dev/null
+{
+ "author": "Dedupe tester",
+ "name": "dedupe",
+ "version": "0.0.0",
+ "dependencies": {
+ "optimist": "0.6.0",
+ "clean": "2.1.6"
+ }
+}
var common = require("../common-tap.js")
var test = require("tap").test
-var npm = require("../../")
var pkg = './ignore-shrinkwrap'
var mr = require("npm-registry-mock")
var pkg = path.resolve(__dirname, "lifecycle-signal")
test("lifecycle signal abort", function (t) {
+ // windows does not use lifecycle signals, abort
+ if (process.platform === "win32") return t.end()
var child = spawn(node, [npm, "install"], {
cwd: pkg
})
--- /dev/null
+var common = require('../common-tap')
+ , test = require('tap').test
+ , rimraf = require('rimraf')
+ , npm = require('../../')
+ , mr = require('npm-registry-mock')
+ , pkg = __dirname + '/outdated-depth'
+
+function cleanup () {
+ rimraf.sync(pkg + '/node_modules')
+ rimraf.sync(pkg + '/cache')
+}
+
+test('outdated depth zero', function (t) {
+ var expected = [
+ pkg,
+ 'underscore',
+ '1.3.1',
+ '1.3.1',
+ '1.5.1',
+ '1.3.1'
+ ]
+
+ process.chdir(pkg)
+
+ mr(common.port, function (s) {
+ npm.load({
+ cache: pkg + '/cache'
+ , loglevel: 'silent'
+ , registry: common.registry
+ , depth: 0
+ }
+ , function () {
+ npm.install('.', function (er) {
+ if (er) throw new Error(er)
+ npm.outdated(function (err, d) {
+ if (err) throw new Error(err)
+ t.deepEqual(d[0], expected)
+ s.close()
+ t.end()
+ })
+ })
+ }
+ )
+ })
+})
+
+test("cleanup", function (t) {
+ cleanup()
+ t.end()
+})
\ No newline at end of file
--- /dev/null
+# just a test
--- /dev/null
+module.exports = true
--- /dev/null
+{
+ "name": "whatever",
+ "description": "yeah idk",
+ "version": "1.2.3",
+ "main": "index.js",
+ "dependencies": {
+ "underscore": "1.3.1"
+ },
+ "repository": "git://github.com/luk-/whatever"
+}
--- /dev/null
+var common = require("../common-tap.js")
+var test = require("tap").test
+var npm = require("../../")
+var mkdirp = require("mkdirp")
+var rimraf = require("rimraf")
+var mr = require("npm-registry-mock")
+
+// config
+var pkg = __dirname + "/outdated-git"
+mkdirp.sync(pkg + "/cache")
+
+
+test("dicovers new versions in outdated", function (t) {
+ process.chdir(pkg)
+ t.plan(3)
+ npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
+ npm.outdated(function (er, d) {
+ t.equal('git', d[0][3])
+ t.equal('git', d[0][4])
+ t.equal('git://github.com/robertkowalski/foo-private.git', d[0][5])
+ })
+ })
+})
+
+test("cleanup", function (t) {
+ rimraf.sync(pkg + "/cache")
+ t.end()
+})
--- /dev/null
+just a test
--- /dev/null
+{
+ "name": "outdated-git",
+ "author": "Rocko Artischocko",
+ "description": "fixture",
+ "version": "0.0.1",
+ "main": "index.js",
+ "dependencies": {
+ "foo-private": "git://github.com/robertkowalski/foo-private.git"
+ }
+}
--- /dev/null
+var common = require("../common-tap.js")
+ , test = require("tap").test
+ , rimraf = require("rimraf")
+ , npm = require("../../")
+ , mr = require("npm-registry-mock")
+ , path = require("path")
+ , spawn = require('child_process').spawn
+ , node = process.execPath
+ , npmc = require.resolve('../../')
+ , pkg = __dirname + '/outdated-new-versions'
+ , args = [ npmc
+ , 'outdated'
+ , '--json'
+ , '--silent'
+ , '--registry=' + common.registry
+ , '--cache=' + pkg + '/cache'
+ ]
+
+var expected = { underscore:
+ { current: '1.3.3'
+ , wanted: '1.3.3'
+ , latest: '1.5.1'
+ , location: 'node_modules' + path.sep + 'underscore'
+ }
+ , request:
+ { current: '0.9.5'
+ , wanted: '0.9.5'
+ , latest: '2.27.0'
+ , location: 'node_modules' + path.sep + 'request'
+ }
+ }
+
+test("it should log json data", function (t) {
+ cleanup()
+ process.chdir(pkg)
+
+ mr(common.port, function (s) {
+ npm.load({
+ cache: pkg + "/cache",
+ loglevel: 'silent',
+ registry: common.registry }
+ , function () {
+ npm.install(".", function (err) {
+ var child = spawn(node, args)
+ , out = ''
+ child.stdout
+ .on('data', function (buf) {
+ out += buf.toString()
+ })
+ .pipe(process.stdout)
+ child.on('exit', function () {
+ out = JSON.parse(out)
+ t.deepEqual(out, expected)
+ s.close()
+ t.end()
+ })
+ })
+ })
+ })
+})
+
+test("cleanup", function (t) {
+ cleanup()
+ t.end()
+})
+
+function cleanup () {
+ rimraf.sync(pkg + "/node_modules")
+ rimraf.sync(pkg + "/cache")
+}
}
function onend () {
c = c.trim()
- t.equal( c
- , '> npm-test-prepublish@1.2.5 prepublish .' + os.EOL
- + '> echo ok' + os.EOL
- + os.EOL
- + 'ok' + os.EOL
- + 'npm-test-prepublish-1.2.5.tgz')
+ var regex = new RegExp("" +
+ "> npm-test-prepublish@1.2.5 prepublish [^\\r\\n]+\\r?\\n" +
+ "> echo ok\\r?\\n" +
+ "\\r?\\n" +
+ "ok\\r?\\n" +
+ "npm-test-prepublish-1.2.5.tgz", "ig")
+
+ t.ok(c.match(regex))
t.end()
}
})
// itself functions normally.
//
// Make sure that we don't sit around waiting for lock files
- child = spawn(node, [npm, 'publish'], {
+ child = spawn(node, [npm, 'publish', '--email=fancy', '--_auth=feast'], {
cwd: pkg,
env: {
npm_config_cache_lock_stale: 1000,
--- /dev/null
+var common = require('../common-tap')
+ , test = require('tap').test
+ , path = require('path')
+ , spawn = require('child_process').spawn
+ , rimraf = require('rimraf')
+ , mkdirp = require('mkdirp')
+ , pkg = __dirname + '/startstop'
+ , cache = pkg + '/cache'
+ , tmp = pkg + '/tmp'
+ , node = process.execPath
+ , npm = path.resolve(__dirname, '../../cli.js')
+
+function run (command, t, parse) {
+ var c = ''
+ , node = process.execPath
+ , child = spawn(node, [npm, command], {
+ cwd: pkg
+ })
+
+ child.stderr.on('data', function (chunk) {
+ throw new Error('npm ' + command + ' stderr: ' + chunk.toString())
+ })
+
+ child.stdout.on('data', function (chunk) {
+ c += chunk
+ })
+
+ child.stdout.on('end', function () {
+ if (parse) {
+ // custom parsing function
+ c = parse(c)
+ t.equal(c.actual, c.expected)
+ t.end()
+ return
+ }
+
+ c = c.trim().split('\n')
+ c = c[c.length - 1]
+ t.equal(c, command)
+ t.end()
+ })
+
+}
+
+function cleanup () {
+ rimraf.sync(pkg + '/cache')
+ rimraf.sync(pkg + '/tmp')
+}
+
+test('setup', function (t) {
+ cleanup()
+ mkdirp.sync(pkg + '/cache')
+ mkdirp.sync(pkg + '/tmp')
+ t.end()
+
+})
+
+test('npm start', function (t) {
+ run('start', t)
+})
+
+test('npm stop', function (t) {
+ run('stop', t)
+})
+
+test('npm restart', function (t) {
+ run ('restart', t, function (output) {
+ output = output.split('\n').filter(function (val) {
+ return val.match(/^s/)
+ })
+ return {actual: output, expected: output}
+ })
+})
+
+test('cleanup', function (t) {
+ cleanup()
+ t.end()
+})
--- /dev/null
+{"name":"startstop"
+,"version":"1.2.3"
+,"scripts":{
+ "start":"node -e 'console.log(\"start\")'",
+ "stop":"node -e 'console.log(\"stop\")'"
+ }
+}
--- /dev/null
+var common = require('../common-tap.js')
+var test = require('tap').test
+var npm = require('../../')
+var npmc = require.resolve('../../')
+var osenv = require('osenv')
+var path = require('path')
+var fs = require('fs')
+var rimraf = require('rimraf')
+var mkdirp = require('mkdirp')
+var which = require('which')
+var util = require('util')
+var spawn = require('child_process').spawn
+var args = [ npmc
+ , 'version'
+ , 'patch'
+ , '--no-git-tag-version'
+ ]
+var pkg = __dirname + '/version-no-tags'
+
+test("npm version <semver> without git tag", function (t) {
+ setup()
+ npm.load({ cache: pkg + '/cache', registry: common.registry}, function () {
+ which('git', function(err, git) {
+ function tagExists(tag, _cb) {
+ var child = spawn(git, ['tag', '-l', tag])
+ var out = ''
+ child.stdout.on('data', function(d) {
+ out += data.toString()
+ })
+ child.on('exit', function() {
+ return _cb(null, Boolean(~out.indexOf(tag)))
+ })
+ }
+
+ var child = spawn(git, ['init'])
+ child.stdout.pipe(process.stdout)
+ child.on('exit', function() {
+ npm.config.set('git-tag-version', false)
+ npm.commands.version(['patch'], function(err) {
+ if (err) return t.fail('Error perform version patch')
+ var testPkg = require(pkg+'/package')
+ if (testPkg.version !== '0.0.1') t.fail(testPkg.version+' !== \'0.0.1\'')
+ t.ok('0.0.1' === testPkg.version)
+ tagExists('v0.0.1', function(err, exists) {
+ t.equal(exists, false, 'git tag DOES exist')
+ t.pass('git tag does not exist')
+ t.end()
+ })
+ })
+ })
+ })
+ })
+})
+
+test('cleanup', function(t) {
+ rimraf.sync(pkg)
+ t.end()
+})
+
+function setup() {
+ mkdirp.sync(pkg)
+ mkdirp.sync(pkg + '/cache')
+ fs.writeFileSync(pkg + '/package.json', JSON.stringify({
+ author: "Evan Lucas",
+ name: "version-no-tags-test",
+ version: "0.0.0",
+ description: "Test for git-tag-version flag"
+ }), 'utf8')
+ process.chdir(pkg)
+}
\ No newline at end of file