(PUP-1151) Environment enumeration authorization test.

Add a test that unauthorized requests to the environment enumeration
endpoint receive a 403 response.

Check for the hardcoded endpoint in Puppet::Network::HTTP::Handler and
raise a not authorized error no matter what.
(PUP-1151) Factor out v1 HTTP request processing into own request processor.

The end goal is to have v1 and v2 API endpoints in their own processors,
with the routes registered on a shared handler that performs client
authentication and dispatch.

This commit rips out the v1 endpoints to their own processor, but does
not define anything about the handler including registration.

v1-related behavorial tests have been moved from the handler spec to the
v1 spec.
(maint) Get rid of http handler's initialize_for_puppet method.

It doesn't seem to be used anywhere except in some tests that expect it
to be called.

Also rescue any exception when processing a request in the http handler,
and respond with a 500(!).
(PUP-1151) Add routing framework.

Add a routing framework for the HTTP module that routes requests to
either the V1 or V2 API as appropriate (first it sees if the V2 API
would like to handle a request, and if not it's passed off to the V1
API).

To support the routing framework, several new classes in the HTTP module
are introduced: Request, Route, Response, and MemoryResponse (for
testing).

The V2 API is implemented in lib/puppet/network/http/api/v2.rb.

Change the method to handle the request from process to call, which
allows using lamdbas and procs as route handlers.

Change the require path in the HTTP module to break a cycle, which
necessitates changing requires in a few other files to just require the
entire Puppet::Network::HTTP module (rather than just the V1 API class).

Delete Puppet::Network::HTTP:RackHttpHandler because it was useless.

Change the initialize method of Puppet::Network::HTTP::WEBrickRest to
omit the unused handler argument.
(PUP-1151) Add a 405 error class to http handler

Now that we can actually dispatch based on path and HTTP verb, we can
reasonably respond with 405 for verbs that aren't supported.
(PUP-1151) Change Route matching semantic specs.

Rather than Routes having to match on path and method, they match only
on path and can then decide whether the method is allowed or raise
a method not allowed error.

Most of the handler routing spec tests are really route spec tests, so
those have been moved over.
(PUP-1151) Implement Route changes.

Rather than creating a route with a path and method, routes are created
with just a patch matcher and method handlers can be added by calling
the HTTP method-named methods on the route. By default, handlers for all
methods just raise a method not allowed error; user-defined handlers
replace those.

When the handler is given a list of routes to register, it checks to see
if any of them have identical path matching regexes and throws an error
if they do. However, it is still entirely possible for regexes that do
not compare as equal to express the same regular language, so users
still bear responsibility to ensure their routes cooperate.
Merge pull request #2239 from zaphod42/feature/master/pup-536-environment-enumeration

(PUP-1151) Take a first step toward a new HTTP API