From e3600ad7beb7cb4a067038d750e530a64fd1e93a Mon Sep 17 00:00:00 2001 From: Sabari Kumar Murugesan Date: Thu, 18 Dec 2014 16:52:07 -0800 Subject: [PATCH] Fix broken-pipe seen in glance-api When file size is an exact multiple of chunk_size, glance client is processing EOF in image-data as a chunk and sends to glance-api. The server treats this as the end of chunked transmission and sends a http response. When the actual last chunk is sent by the 'requests' library, the server sends a 400 response and tracebacks with broken pipe as the client has already closed the socket. Closes-Bug: #1342080 Change-Id: Icdbff838450db1c252ddc919a230a7d3ca16765f --- glanceclient/common/http.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 0909e959..16d09933 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -168,6 +168,8 @@ class HTTPClient(object): chunk = body while chunk: chunk = body.read(CHUNKSIZE) + if chunk == '': + break yield chunk data = kwargs.pop("data", None)