1
0
Эх сурвалжийг харах

Add ranged requests suport to transports

DarthSim 2 жил өмнө
parent
commit
913cfb22ca

+ 1 - 0
stream.go

@@ -37,6 +37,7 @@ var (
 		"Content-Type",
 		"Content-Type",
 		"Content-Encoding",
 		"Content-Encoding",
 		"Content-Range",
 		"Content-Range",
+		"Accept-Ranges",
 	}
 	}
 
 
 	streamBufPool = sync.Pool{
 	streamBufPool = sync.Pool{

+ 1 - 0
transport/fs/fs.go

@@ -91,6 +91,7 @@ func (t transport) RoundTrip(req *http.Request) (resp *http.Response, err error)
 		}
 		}
 	}
 	}
 
 
+	header.Set("Accept-Ranges", "bytes")
 	header.Set("Content-Length", strconv.Itoa(int(size)))
 	header.Set("Content-Length", strconv.Itoa(int(size)))
 
 
 	return &http.Response{
 	return &http.Response{

+ 1 - 0
transport/gcs/gcs.go

@@ -129,6 +129,7 @@ func (t transport) RoundTrip(req *http.Request) (*http.Response, error) {
 		size = reader.Attrs.Size
 		size = reader.Attrs.Size
 	}
 	}
 
 
+	header.Set("Accept-Ranges", "bytes")
 	header.Set("Content-Length", strconv.Itoa(int(size)))
 	header.Set("Content-Length", strconv.Itoa(int(size)))
 	header.Set("Content-Type", reader.Attrs.ContentType)
 	header.Set("Content-Type", reader.Attrs.ContentType)
 	header.Set("Cache-Control", reader.Attrs.CacheControl)
 	header.Set("Cache-Control", reader.Attrs.CacheControl)