Fixes issue where forced retry would cause timeout. (#241)

Fixes issue where forced retry would cause timeout.

Side note: This also fixes TravisCI builds that have been failing on
Python 3.3.

This fixes https://issuetracker.google.com/issues/111486730 -- if
using an expired access token from a cache, a forced retry will occur
and attempt to re-read bytes from the compression stream. This fails
because the bytes have already been consumed, and the server hangs
waiting for us to send the intended bytes from the first attempt. In
gsutil, this manifested itself as an SSLError with the message 'The read
operation timed out'.

While I'd normally avoid reading in an entire stream all at once, this
edge case should be fine because:

- We start off the entire (uncompressed) byte sequence anyway to begin
  with and only create the stream because that's the format needed for
  compression.
- This is only used for uploads using the SIMPLE strategy. Note that
  this isn't an issue for resumable uploads, since the first request in
  that flow is to create the resumable upload session (which isn't a
  media transfer request, thus it doesn't try to consume any bytes from
  the stream), so the credential refresh (if needed) would happen on that
  request.
3 files changed