Capturing bound InetSocketAddress after starting the server to allow binding to port 0
Using port 0 when cloning if proxy was created with port 0
Variable rename
Merge pull request #163 from jekh/allow-port-zero

Allow port zero
Stripping HOST from Connect even in transparent mode.

Some websites (i.e. "nytimes.com") seem to have issues loading when using
LittleProxy in transparent mode.

The reason is down to the "URI" header containing the full URL (instead of just
the path) when using in Transparent mode.
While most webservers online are OK with that, some old servers seem to respond
with malformed "Location" headers when the Proxy is behaving in
"transparent mode" and it doesn't strip the Host from the URI.

So we are going to always strip the Host from the URI (transparent or not) and
ensure the Host header is present (added if missing).

This should ensure preservetion of correct behaviour with old clients and
old servers.
Gitignore littleproxy_cert file
Shutdown Hook switch + UncaughtExceptionHandler.

So far, LittleProxy registered 2 important things
automatically, relying on the assumption that only
1, or just few, Proxy instances would be created
with a process. And that the end of the hosting
process would mean also the end of LittleProxy
instances.

This was translated with “hardcoded” shutdown hooks
registered on the Runtime, as well as UncaughtExceptionHander
for the Proxy Thread pool.

The issue with those are 1) making it impossible
for the host project to handle the lifecycle
fully 2) a memory leak building over time, when
multiple instances of LittleProxy got created and
destroyed in the lifetime of the host application.

Now it’s possible to control this aspect.
Adding byte send/receive hooks to HttpFilters.
JKS cert files should not be in the repo
Making HTTPS play ball with Netty 4.0.23.Final
Handle case where parsing port from malformed URL is impossible.

It will LOG a warning, and default to 80.
Upgrading to use Netty 4.0.24.Final