@@ -204,14 +204,14 @@ func sendResponse(w http.ResponseWriter, req cmds.Request, res cmds.Response) {
204
204
h .Set (streamHeader , "1" )
205
205
h .Set (transferEncodingHeader , "chunked" )
206
206
207
- if err := copyChunks (status , w , out ); err != nil {
207
+ if err := writeResponse (status , w , out ); err != nil {
208
208
log .Error ("error while writing stream" , err )
209
209
}
210
210
}
211
211
212
212
// Copies from an io.Reader to a http.ResponseWriter.
213
213
// Flushes chunks over HTTP stream as they are read (if supported by transport).
214
- func copyChunks (status int , w http.ResponseWriter , out io.Reader ) error {
214
+ func writeResponse (status int , w http.ResponseWriter , out io.Reader ) error {
215
215
// hijack the connection so we can write our own chunked output and trailers
216
216
hijacker , ok := w .(http.Hijacker )
217
217
if ! ok {
@@ -283,19 +283,3 @@ func sanitizedErrStr(err error) string {
283
283
s = strings .Split (s , "\r " )[0 ]
284
284
return s
285
285
}
286
-
287
- type flushResponse struct {
288
- W http.ResponseWriter
289
- }
290
-
291
- func (fr * flushResponse ) Write (buf []byte ) (int , error ) {
292
- n , err := fr .W .Write (buf )
293
- if err != nil {
294
- return n , err
295
- }
296
-
297
- if flusher , ok := fr .W .(http.Flusher ); ok {
298
- flusher .Flush ()
299
- }
300
- return n , err
301
- }
0 commit comments