Do not close socket before detaching transaction

Summary:
Following up on https://phabricator.fb.com/D1707999.

Shutdown test was failing because interchanging the order of
sock_->closeWithReset() and onError callbacks () resulted in
sock_->closeNow() being called due to onError() -> ~CallbackGuard() ->
HTTPSession::detach() -> HTTPSession::checkForShutdown(). This is fixed
now.

Found another similar scenario in shutdownTransport() where we could
close the socket before onError()/detachTransaction callbacks.

I looked into the other solution of lazily copying the necessary info,
but to do that within handler's detachTransaction, we need to anyway
ensure that the socket is not closed until detachTransaction(). The
other option is to do the lazy copy within HTTPSession, but that doesn't
seem ideal given this is only for logging, and most of the copied info
will anyway be wasted due to sampling.

Either way, I feel it's a good approach to ensure that the socket is not
closed until the transaction is detached.

Test Plan: fbmake runtests --extended, will update with canary results.

Reviewed By: afrind@fb.com

Subscribers: trunkagent, bmatheny, praveenr, ajitb

FB internal diff: D1712415

Signature: t1:1712415:1417549423:77b29c6497256f601394313edaf245bf6d42c2b8
enforce limit on the total size of the decoded headers

Summary: besides the per-header limit we must also have a limit on the total uncompressed size, which can bypass the per-header limit by sending a large number of small headers

Test Plan: unit test that was failing before enforcing the limit

Reviewed By: afrind@fb.com

Subscribers: trunkagent, doug, bmatheny, cgheorghe

FB internal diff: D1709825

Tasks: 4193845

Signature: t1:1709825:1417480532:bd600182cf8b431f12f90aa6ec3a05317bd7ba50
make StaticHeaderTable exit()-safe

Summary: this is a common issue on mobile, where the app calls exit() from a different thread causing the static variables to be destructed while other threads are still executing. This crash is not worrisome since the app is crashing anyway, but it helps to clear our stack traces

Test Plan: ran the unit test, will also canary

Reviewed By: seanc@fb.com

Subscribers: trunkagent, doug, bmatheny, neal, erling, cgheorghe

FB internal diff: D1714117

Tasks: 5734251

Signature: t1:1714117:1417627360:d40b0e1fae4a90482043d6930bcadecf54a0f195
add consumeUntilDrained API to NotificationQueue::Consumer

Summary:
... and employ it in EventBase's destructor to stop leaking memory from unexecuted NotificationQueue-variety runInEventBaseThread() callbacks

in addition to the attached task, this should also fix the root cause of the already-worked-around #5564342

Test Plan:
test no longer leaks.* on the other hand, IOThreadPoolExecutor::stop() no longer actually stops, it joins. I added comments to stop() in headers indicating that it should be treated as best-effort.

* hilariously, this actually isn't true - there's a new leak of a thread local inside the io pool because callbacks can outlive the pool now. i'll leave a full explanation for the upcoming patch.

Reviewed By: davejwatson@fb.com

Subscribers: alandau, bmatheny, mshneer, trunkagent, fugalh, njormrod, folly-diffs@

FB internal diff: D1682860

Tasks: 5336655

Signature: t1:1682860:1416347774:ac5f31fb72373992f425c93ac284a0cd27608db4
make the static Huffman trees exit()-safe

Summary: allocate the static trees using unions and placement new. Also copy tables in the HuffTree constructor, to avoid using static vars that would get deleted on exit()

Test Plan: ran unit tests

Reviewed By: seanc@fb.com

Subscribers: trunkagent, doug, bmatheny, cgheorghe

FB internal diff: D1714717

Signature: t1:1714717:1417650644:b984a23a2b132bbb29e6a4bdb24bfaccb722bd1c
Change http to https, make installation of glog, gflags and double-conversion consistent; use github url for double-conversion

Summary:
To fix the error:

sudo: apt-get: command not found
fetching glog from svn (apt-get fails)
svn: E175002: Unable to connect to a repository at URL 'http://google-glog.googlecode.com/svn/trunk'
svn: E175002: OPTIONS of 'http://google-glog.googlecode.com/svn/trunk': Could not read status line: connection was closed by server (http://google-glog.googlecode.com)
Closes https://github.com/facebook/proxygen/pull/23
Github Author: NagaChaitanya Vellanki <me@chaitanyavellanki.com>

{sync, type="child", parent="github", parentrepo="facebook/proxygen", parentprnum="23", parentprfbid="567899116687621"}

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Reviewed By: woo@fb.com

Subscribers: bmatheny

FB internal diff: D1712402

Signature: t1:1712402:1417720645:519ebd9aaea051b0ad529752f1b8b6cea546ab5d
Added Logging to persistent cache

Summary: Added logging to the cache so that we can see hit rates and such.

Test Plan: added tests

Reviewed By: fma@fb.com

Subscribers: ps, bmatheny, seanc

FB internal diff: D1709547

Signature: t1:1709547:1417725205:39e20a70061f3c3fa89d2c98f9d3962274421b46
Bump version to 6:0