Generate a reasonable Diviner book from libphutil

Summary: Ref T988. This isn't pretty or polished, but it has the documentation.

Test Plan: Generated and read the documentation.

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

Differential Revision: https://secure.phabricator.com/D8412
Add assertions to every test in libphutil/

Summary: Ref T4570. Add an assertion to all tests which pass by not exploding, so we can fail tests which make no assertions.

Test Plan: `arc unit --everything` with the test engine set to fail on no assertions.

Reviewers: leebyron, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4570

Differential Revision: https://secure.phabricator.com/D8435
Utilize `assertFalse` and `assertTrue` methods.

Summary:
Ref D8460.

Use $this->assertFalse(...) and $this->assertTrue(...) instead of $this->assertEqual(false, ...) and $this->assertEqual(true, ...) respectively.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8462
Update some libphutil docs

Summary: Improve organization and content of some documentation.

Test Plan: Regenerated and examined docs.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D8479
Don't format "1/" as an ordered list in Remarkup

Summary: See <https://www.facebook.com/dreiss/posts/10152231659206208>. I added this "bizarre Facebook-ism" to the set of ordered list characters in T3797, but apparently the intent of these "1/" lists is to avoid automatic formatting. I don't fully understand any part of this, but this list style is used only at Facebook, and automatically formatting these lists enjoys little support there (25 against, 2 for, 29 neutral).

Test Plan: Updated and executed unit tests.

Reviewers: btrahan, chad, dreiss

Reviewed By: dreiss

Subscribers: aran, epriestley

Differential Revision: https://secure.phabricator.com/D8489
Censor URI credentials in CommandException summaries

Summary:
Fixes T4347. Make a simple effort to mask credentials (e.g., arising from stderr on `git fetch`) when formatting command failures for user consumption.

This isn't perfect, but I think it's a net positive overall.

Test Plan:
Added and executed unit tests. Also triggered a real exception:

  EXCEPTION (CommandException): Command failed with error #1!
  COMMAND
  echo 'http://xxxxx@example.com' && false

  STDOUT
  http://xxxxx@example.com

  STDERR
  (empty)

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4347

Differential Revision: https://secure.phabricator.com/D8546
Filter "javascript:" URIs more aggressively

Summary: Some browsers interpret `javascript\n:` as a Javascript URI. Be significantly more aggressive in normalizing URIs when looking for `javascript:` hrefs.

Test Plan: Added and executed unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8548
Allow multiple LDAP search filters, and complex search queries

Summary: Ref T3208. I'm going to make some people try this before it gets anywhere near landing.

Test Plan: oh man LDAP

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley, frgtn, aran

Maniphest Tasks: T3208

Differential Revision: https://secure.phabricator.com/D8159
Pass an integer to stream_select() for correctness

Summary: Ref T4627. Passing `$timeout_sec` is slightly more correct here, although there is no change to program behavior.

Test Plan:
Used this script to verify that passing `0` and `0.999321` (for example) have the same effect to `stream_select()`:

  <?php

  $spec = array(
    0 => array('pipe', 'r'),
    1 => array('pipe', 'w'),
    2 => array('pipe', 'w'),
  );

  $pipes = array();
  $proc = proc_open('sleep 30', $spec, $pipes);
  list($stdin, $stdout, $stderr) = $pipes;

  $read = array($stdout, $stderr);
  $write = array();
  $except = array();

  $select_start = microtime(true);
  stream_select($read, $write, $except, 0.999321, 80000);
  $select_end = microtime(true);

  printf(
    "select() took %d us to return.\n",
    ($select_end - $select_start) * 1000000);

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4627

Differential Revision: https://secure.phabricator.com/D8567
Put a <span> around "NOTE:" in Remarkup

Summary: I suspect these will look better if we bold/grey the "NOTE:" part.

Test Plan: Ran unit tests. Will try styling next.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8596
Add array method dereference support to xhpast.

Summary: Adds support for array method dereferencing, e.g. `$foo->bar()[0]`. Bumps XHPAST version. Ref T4334.

Test Plan: Wrote two failing unit tests for language parsing abilities using the specific errors mentioned in T4334. Hacked away at the parser importing bits from Zend's zend_language_parser.y until they passed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4334

Differential Revision: https://secure.phabricator.com/D8611
Use new Google+ API for Google auth instead of "userinfo"

Summary:
Google is moving away from the APIs we're using, as described in this timetable:

  https://developers.google.com/+/api/auth-migration#timetable

Although the timetable says the API is good until Sept 1, 2014, we're seeing the API fail on `secure.phabricator.com` and have received user reports of failures as well.

I can't figure out any configuration changes that users can make to keep the current APIs working, so just upgrade to the new ones.

Test Plan: Registered and logged in with Google.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: charles, epriestley

Differential Revision: https://secure.phabricator.com/D8612
Improve instructions for Google auth mess

Summary:
See T4676 for context. @csilvers suggested that these changes would have been helpful in resolving this issue.

If we get like one more report I'll probably try to back this out and phase it in more gradually instead, although we're going to hit something like this on Sept 1 no matter what.

Test Plan:
Faked it.

{F135327}

Reviewers: btrahan, csilvers

Reviewed By: csilvers

Subscribers: csilvers, epriestley

Differential Revision: https://secure.phabricator.com/D8625
Support HTTP basic auth in HTTPFuture

Summary: Ref T4590. We already sort of support this for Conduit, push the support a little bit deeper.

Test Plan: Added basic auth across my entire nginx. Requests with no auth or with the wrong auth failed; requests with the right auth worked.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4590

Differential Revision: https://secure.phabricator.com/D8621
Put rel="noreferrer" on all nonlocal links

Summary:
Ref T4342. By default, insert `rel="noreferrer"` for links. We do not insert this if:

  - The caller provided an explicit "rel" attribute.
  - We recognize the link as an anchor ("#comment-2"), or as local to the current domain ("/path/to/resource").

Otherwise, add it in all cases.

Test Plan: Added and executed unit tests. (The javascript stuff which was touched a little bit has a pile of tests already, too.)

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4342

Differential Revision: https://secure.phabricator.com/D8711
Add an "Always Search" flag to the libphutil LDAP adapter

Summary:
Ref T3208. This adds a flag which acts like the old "Search First" flag did, more or less, probably. LDAP?

Specifically, the issue at heart here is that some LDAP servers require totally uncredentialed binds, some require "anonymous" binds (not sure if this is a term of art or if whoever contributed the first LDAP patch made it up), and some require full DN binds. This flag lets us distinguish between the "full DN" and "completely uncredentialed" use cases, both of which have no "anonymous" credentials.

Test Plan: It compiles!

Reviewers: Firehed

Reviewed By: Firehed

Subscribers: epriestley

Maniphest Tasks: T3208

Differential Revision: https://secure.phabricator.com/D8722
Provide slightly better cURL debugging instructions for custom.pem files

Summary: Some context in IRC. We can slightly improve users' chances of catching issues here, maybe.

Test Plan: read it; ran commands

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8740
Support file attachments on HTTPSFuture

Summary: @zeeg wants this for some build stuff and we'd like it in general to make Mailgun work better. It's a bit messy because of how cURL works. See pages of comments inline.

Test Plan:
  - Added tests for the parser stuff.
  - Made various requests with and without file attachments and saw them encode data as expected.
  - Made some dangerous requests (with "@") and saw them fail.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley, zeeg

Differential Revision: https://secure.phabricator.com/D8831
Censor URIs in service profile log

Summary: Mailgun requests can hit a credentialed URI. Censor credentials from `--trace` URIs.

Test Plan: Ran `bin/mail send-test ... --trace` and saw censored credentials.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8833
Latest xhpast for Windows

Summary: This is the latest version of xhpast built from HEAD using MinGW

Test Plan: Ran 'arc liberate' on Windows, it didn't complain about xhpast missing or out of date

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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