Stability fixes

These patches fix two major stability issues:

1. hang if HTTP 500 is received when uploading a file and
2. crash if invalid XML is received when uploading a file.

Without these patches, I was able to upload only around 5-50 files before grive hangs or crashes. With these patches I was able to upload around 20,000 files (20 gigs) before grive crashes or goes into an eternal loop.