improve SeafConnection

We have to format the post request content manually when uploading a file,
because we need the content length in advance. Otherwise the whole post
request would be buffered in memory, which is not acceptable.