Rearrange requires to prepare for fixing debug code

If we load request.js right at the top of index.js, this creates a
circular dependency (index.js -> request.js -> lib/debug.js and back
again).

If index.js has not exported request and request.debug by the time
request.js is loaded, then lib/debug.js will never see them.  So, we
need to ensure that request.debug is set before requiring lib/debug.js.
Avoid lots of lookups to process.env

See b85bf633 for details - process.env results in a synchronous syscall
to `getenv()` and this was happening at least a few times per request.
Expand debugging tests
Document debug options
Merge pull request #1033 from nylen/debug-fixes

Improve and document debug options