     return
 
   # Prevent long-running requests.
-  if @_timeout > 0
-    req.setTimeout onTimeout, @_timeout
+  if app._timeout > 0
+    req.setTimeout onTimeout, app._timeout
 
   # Attempt to handle the request.
-  @_layer.try req, res
+  app._layer.try req, res
 
   # Wait for the response to finish.
   .then ->


# The root request handler.
onRequest = (req, res) ->
  req.timestamp = now()

  parts = req.url.split "?"
  req.path = parts[0]
  req.query = parseQuery parts[1]

  req.app = this
  req.res = res
  setProto req, Request

  res.app = this
  res.req = req
  setProto res, Response



# TODO: Support custom "500 Internal Error" page.

assertTypes = require "assertTypes"
