Always use SSLv3 for HTTPSFuture

Summary:
A couple of users are encoutering an issue which is fixed by adding an explicit SSLv3:

https://github.com/facebook/libphutil/issues/17

Since v3 is 16 years old and I can't find anyone on the internet saying that swithching to v2 solved a problem, let's see if we can get away without adding a bunch of configuration for this or writing our own SSL library.

Test Plan: Made this diff. Googled for discussion of this option. :/

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3767
Upgrade access to undefined property from log to exception

Summary: Just like accessing an undefined variable, this always indicates a serious error in the Phabricator codebase.

Test Plan: Ran a script which accesses an undefined property, got an exception.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3779
Allow async prompting in console server

Test Plan: Will use it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3785
Allow symbol loader path prefix to use \

Test Plan: Ran Phabricator unit tests under Windows.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3815
Install an evil Windows virus in the heart of libphutil

Summary: Created by `mingw32-make` after deleting `needparserscanner` from `Makefile`.

Test Plan:
Made lint error, then:

  $ arc lint # Under Windows!
  >>> Lint for src\parser\xhpast\bin\xhpast_parse.php:
     Error  (XHP4) Use of extract()
      Avoid extract(). It is confusing and hinders static analysis.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3824
Allow Windows directories in console highlighter

Test Plan:
  lang=text
  C:\Windows\ $ cmd
  Microsoft Windows

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3857
Support reading random bytes on Windows

Summary:
We use this quite extensively, e.g. in `PhutilOpaqueEnvelope`.
`Filesystem` is not the best location for this but I'm not in a mood of renaming it everywhere.
It doesn't work by default but better than nothing.

Test Plan:
  phabricator\src\infrastructure\storage\ $ arc unit __tests__

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3860
Update src/future/http/HTTPFuture.php

D3875 ghetto style.
Specify config for text editors

Test Plan: D3865

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3880
Recognize flex35 in xhpast

Test Plan:
  support/xhpast/ $ make scanner

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3888
Delete license headers from files

Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in LICENSE file.

Reviewers: epriestley, davidrecordon

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2035

Differential Revision: https://secure.phabricator.com/D3887
Add final newline to Remarkup tests

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3885
Fix undefined index in console syntax highlighter
Allow filtering iterator results

Summary: See D3940 for usage.

Test Plan: New test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3944
Allow chunking iterator results

Summary:
I'll use it in `save_lint.php`.
It could also return iterators but this is fine for me.

Test Plan: New test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3945
Statically link xhpast.exe

Summary:
Some users reported that this virus doesn't always work.
Re-compiled by adding `-static` to `xhpast` in `Makefile`.

Test Plan:
Renamed MinGW directory which previously triggered the problem. Then:

  $ xhpast.exe < xhpast_parse.php
  {"tree":[9000, 0, 291, [...]]}

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3950
Add PhutilKeyValueCache and some implementations

Summary:
This is basically a slightly-more-abstract version of Facebook's cache stack, without any of the cachekey callbacks (in SocialBB, I implemented something similar above this).

  - `PhutilKeyValueCache` defines an abstract key-value cache interface with get/set/delete operations.
  - `PhutilKeyValueCacheStack` allows you to compose several caches so they behave like a single cache with readthrough semantics (like request -> APC -> Memcache at Facebook).

Then there are cache implementations:

  - `PhutilKeyValueCacheAPC` implements an APC-based cache.
  - `PhutilKeyValueCacheMemcache` implements a memcache-backed cache.
  - `PhutilKeyValueCacheInRequest` is like Facebook's $GLOBALS['CACHE'] (i.e., kind of a bad idea).
  - `PhutilKeyValueCacheOnDisk` implements a disk-based cache. With clever use of `getmypid()` / `posix_getppid()` and such we can reasonably fake something like APC for non-APC installs.

Test Plan: Ran unit tests. This is a slightly modified version of code that worked correctly in SocialBB.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2062

Differential Revision: https://secure.phabricator.com/D3974
Print request size when debugging Conduit calls

Summary:
See https://github.com/facebook/phabricator/issues/233

This is hopefully of general use when debugging the various crazy request size bugs we hit.

Test Plan: Ran `arc diff --trace`, saw request sizes.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3980
Clean up Key-Value Cache diff

Summary:
Feedback from D3974.

  - Make $profiler private and provide getProfiler().
  - Document `PhutilKeyValueCache`.
  - Document `$ttl`.
  - Move `$ttl` from `getKey()` signature to `setNextTTL($ttl)` on `PhutilKeyValueCacheStack`.
  - Make return values for kvimpl methods more consistent.
  - Fix `apc_clear_cache()` -> `apc_clear_cache('user')`.
  - Test for invalid memcache TTL.
  - Document memcache server specification.
  - Use `PhutilFileLock` to control access to the cachefile in `PhutilKeyValueCacheOnDisk`.
  - Write the new disk cache to the same place as the old disk cache. The write is now protected by a lock.
  - Document `PhutilKeyValueCacheStack->setCaches()`.
  - Remove redundant method definitions in `PhutilKeyValueCacheStack`.
  - Unrelated, update documentation of PhutilFileLock.

Test Plan: Ran unit tests. Ran slow TTL unit tests.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2062

Differential Revision: https://secure.phabricator.com/D3978
Mark memcache_pconnect as an external function for static analysis

Summary:
If you don't have the memcache extension installed, this function won't exist.

We have only one callsite from the extension and are unlikely (probably?) to accumulate more, so just external it rather than whitelisting the whole extension in arc.

Test Plan: idk shrugz~

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3989