Fix two more bugs.

Unfortunately, two more subtle bugs to fix:

- If the encoded protobuf message is only three bytes long (or less),
  not only the whole protobuf will fit into headerBuf, but also the
  beginning of the next length varint. This will completely wreak
  havoc in the read process. (This bug never bit us in Prometheus
  because the protobuf messages were all long enough. But protobufs in
  general can be very small (0 bytes in fact). I added a test for
  that.)

- If the reader stops in the middle of a length varint, it will
  interpret the null byte that is already in headerBuf as the final
  byte of the varint, which again wreaks havoc. (This bug only shows
  up in Prometheus after
  https://github.com/prometheus/prometheus/commit/dfb9c2a072d5c1003e78c4921988c21bc76ab07a
  , and it is very rare... needs very unlucky fragmentation on the
  network.)

Solution to the first bug is to read byte-wise, which is slightly less
effective, but simplifies the code later, because we don't "overshoot"
anymore. Solution to the second bug is to only read the parts of
headerBuf that have been written to.
No worries, you didn't catch it before because it's OK.
According to the reader contract, if `n, err := Read(...)` returns n>0 AND err!=nil, you must _first_ process the n bytes read and then you _may_ consider the error. You could also just call Read(...) again, which will then return the same error again together with 0 bytes read.

Concrete scenario:

We read from the network. The only proto message in the stream is the "Empty" one, which takes 0 bytes. The "header" just contains a null byte to encode that. After that, the end of the stream is reached. The network reader (for a purpose) would read that one null byte and return (1, io.EOF). Everything is fine.

Look at the implementation of io.ReadAtLeast to see a similar thing in action. If n is at least as large as the requested amount of bytes to read, err is just forcefully set to nil before returned to the caller.