'Alternative to the common request method, which sends the
body with chunked encoding and not as one block'

def request_chunked(self, method, url, body=None, headers=None):

    headers = HTTPHeaderDict((headers if (headers is not None) else {}))
    skip_accept_encoding = ('accept-encoding' in headers)
    skip_host = ('host' in headers)
    self.putrequest(method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host)
    for (header, value) in headers.items():
        self.putheader(header, value)
    if ('transfer-encoding' not in headers):
        self.putheader('Transfer-Encoding', 'chunked')
    self.endheaders()
    if (body is not None):
        stringish_types = (six.string_types + (six.binary_type,))
        if isinstance(body, stringish_types):
            body = (body,)
        for chunk in body:
            if (not chunk):
                continue
            if (not isinstance(chunk, six.binary_type)):
                chunk = chunk.encode('utf8')
            len_str = hex(len(chunk))[2:]
            self.send(len_str.encode('utf-8'))
            self.send('\r\n')
            self.send(chunk)
            self.send('\r\n')
    self.send('0\r\n\r\n')
