def send_not_valid_html_and_okay_header(self): content = bytes(HTMLUtils.get_file_text('/html/not_valid.html'), "UTF-8") self.send_response(200) self.send_header("Content-type", "text/html") self.send_header("Content-Length", len(content)) self.end_headers() #print(self.rfile.read().decode("UTF-8")) self.wfile.write(content)
def send_css_and_okay_header(self): """ This function will send the response and the headers. :return: Void. """ content = bytes(HTMLUtils.get_file_text(self.path), "UTF-8") self.send_response(200) self.send_header("Content-type", "text/css") self.send_header("Content-Length", len(content)) self.end_headers() #print(self.rfile.read().decode("UTF-8")) self.wfile.write(content)
def send_js_and_okay_header(self): """ This function will send the response and the headers. :return: Void. """ print("Path: " + HTMLUtils.base_directory + self.path) content = bytes(HTMLUtils.get_file_text(self.path), "UTF-8") self.send_response(200) self.send_header("Content-type", "application/javascript") self.send_header("Content-Length", len(content)) self.end_headers() #print(self.rfile.read().decode("UTF-8")) self.wfile.write(content)
def send_html_and_okay_header(self): """ This function will send the response and the headers. :return: Void. """ if self.path == '/register.html' or self.path == '/index.html' or self.path == '/not_valid.html': content = bytes(HTMLUtils.get_file_text('/html' + self.path), "UTF-8") self.send_response(200) self.send_header("Content-type", "text/html") self.send_header("Content-Length", len(content)) self.end_headers() #print(self.rfile.read().decode("UTF-8")) self.wfile.write(content) Logger.log('Sending a valid url.') else: Logger.log('Sending not valid url.') self.send_not_valid_html_and_okay_header()