def make_response(self):
        """Build the response : a list of strings or files"""
        if self.method is None: # bad request
            return self.error_resp(400,'Bad request : %s' %self.requestline)
        resp_headers, resp_body, resp_file = '','',None
        if not self.method in ['GET','POST','HEAD']:
            return self.err_resp(501,'Unsupported method (%s)' %self.method)
        else:
            file_name = self.file_name = self.translate_path()
            if not os.path.exists(file_name):
                return self.err_resp(404,'File not found')
            elif self.managed():
                response = self.mngt_method()
            else:
                ext = os.path.splitext(file_name)[1]
                c_type = mimetypes.types_map.get(ext,'text/plain')
                resp_line = "%s 200 Ok\r\n" %self.protocol
                size = os.stat(file_name).st_size
                resp_headers = "Content-Type: %s\r\n" %c_type
                resp_headers += "Content-Length: %s\r\n" %size
                resp_headers += '\r\n'
                if self.method == "HEAD":
                    resp_string = resp_line + resp_headers
                elif size > HTTP.blocksize:
                    resp_string = resp_line + resp_headers
                    resp_file = open(file_name,'rb')
                else:
                    resp_string = resp_line + resp_headers + \
                        open(file_name,'rb').read()
                response = [resp_string]
                if resp_file:
                    response.append(resp_file)
        self.log(200)
        return response
Build the response : a list of strings or files
recipes/Python/511454_asynchronous_HTTP_server_CGI/recipe-511454.py