xe: when uploading a file, allow the contents to be read from a pipe

If we can determine the file length (i.e. the case of a regular file)
then we supply a "Content-length" header. This will allow the Task progress
bar to be kept up to date.

If we cannot determine the file length (e.g. the case of a pipe) then
we rely on EOF to represent the end-of-stream.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>