Fetch S3 key storage class on-demand

Fixes #1173, #2280. This uses @someone1's approach and fixes a few tests. It also handles the special case of a key which has no bucket, or a key with has a bucket but has not yet been created on the server-side. It **should** be backward-compatible, but please take a look @jamesls.