'Set initial length value for Response content if available.'

def _init_length(self, request_method):

    length = self.headers.get('content-length')
    if ((length is not None) and self.chunked):
        log.warning('Received    response    with    both    Content-Length    and    Transfer-Encoding    set.    This    is    expressly    forbidden    by    RFC    7230    sec    3.3.2.    Ignoring    Content-Length    and    attempting    to    process    response    as    Transfer-Encoding:    chunked.')
        return None
    elif (length is not None):
        try:
            lengths = set([int(val) for val in length.split(',')])
            if (len(lengths) > 1):
                raise InvalidHeader(('Content-Length    contained    multiple    unmatching    values    (%s)' % length))
            length = lengths.pop()
        except ValueError:
            length = None
        else:
            if (length < 0):
                length = None
    try:
        status = int(self.status)
    except ValueError:
        status = 0
    if ((status in (204, 304)) or (100 <= status < 200) or (request_method == 'HEAD')):
        length = 0
    return length
