Implement read streaming on HTTPSFutures

Summary: See D7723.

Test Plan:
  <?php

  require_once 'scripts/__init_script__.php';

  $future1 = new HTTPSFuture('https://www.google.com/');
  $future2 = new HTTPSFuture('https://www.facebook.com/');

  $wait = 0.01; // In seconds. This is very small for demo purposes, a value
                 // like "1" is probably better in practice.

  $futures = array('google' => $future1, 'facebook' => $future2);
  foreach (Futures($futures)->setUpdateInterval($wait) as $key => $future) {

    // This might be a periodic update, in which case $future will be null.
    // It might also be a future exiting, in which case $future will not be null.
    // In either case, let's read any data we can first.
    foreach ($futures as $key => $future) {
      $new_data = $future->read();
      // Throw the buffered data away after we read it.
      $future->discardBuffers();

      $len = strlen($new_data);
      echo "Got {$len} bytes from {$key}.\n";
      if (strlen($new_data)) {
        // Do something interesting with the data.
      }
    }

    // Now, check if a future exited.
    if ($future !== null) {
      // This future has exited. We should sleep for a bit and then restart it,
      // or whatever.
      echo "Future {$key} exited!\n";
    }
  }

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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