Optimize environment lookup to happen once only

`process.env` lookup results in a synchronous syscall to `getenv()`,
thus should be avoided in hot code.

Add `request.debug` to allow setting debugging mode at runtime.