[ARVADOS] created: 1.1.2-135-ga66f3d0

Git user git at public.curoverse.com
Tue Jan 30 16:05:34 EST 2018


        at  a66f3d0a7fdde832826c3223c83aeaf7389c1459 (commit)


commit a66f3d0a7fdde832826c3223c83aeaf7389c1459
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Tue Jan 30 16:04:34 2018 -0500

    13011: Fix 411 error when writing empty block to Azure storage.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keepstore/azure_blob_volume.go b/services/keepstore/azure_blob_volume.go
index c64ac7a..8ca9b6f 100644
--- a/services/keepstore/azure_blob_volume.go
+++ b/services/keepstore/azure_blob_volume.go
@@ -402,7 +402,17 @@ func (v *AzureBlobVolume) Put(ctx context.Context, loc string, block []byte) err
 	}()
 	errChan := make(chan error)
 	go func() {
-		errChan <- v.bsClient.CreateBlockBlobFromReader(v.ContainerName, loc, uint64(len(block)), bufr, nil)
+		var body io.Reader = bufr
+		if len(block) == 0 {
+			// We must send a "Content-Length: 0" header,
+			// but the http client interprets
+			// ContentLength==0 as "unknown" unless it can
+			// confirm by introspection that Body will
+			// read 0 bytes.
+			body = http.NoBody
+			bufr.Close()
+		}
+		errChan <- v.bsClient.CreateBlockBlobFromReader(v.ContainerName, loc, uint64(len(block)), body, nil)
 	}()
 	select {
 	case <-ctx.Done():

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list