From 3dfa15ad168fb445c897b59a2f3a8314fb85ba0c Mon Sep 17 00:00:00 2001 From: swee Date: Tue, 14 Jan 2025 19:32:36 -0800 Subject: [PATCH] Update server.py --- server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index b52e990..35ce921 100644 --- a/server.py +++ b/server.py @@ -2,7 +2,7 @@ import asyncio, traceback, socket, ssl, zipfile, random, string, io from OpenSSL import crypto from urllib.parse import urlparse, quote -from flask import Flask, request, redirect, send_file, Response +from flask import Flask, request, redirect, send_file, Response make_response from hypercorn.config import Config from hypercorn.asyncio import serve from pathlib import Path @@ -45,7 +45,9 @@ def gencert(): for file_name, data in [('cert.pem', io.BytesIO(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))), ('privkey.pem', io.BytesIO(crypto.dump_privatekey(crypto.FILETYPE_PEM, k)))]: zip_file.writestr(file_name, data.getvalue()) - return Response(zip_buffer.getvalue(), mimetype="application/zip") + resp = make_response(zip_buffer.getvalue(), mimetype="application/zip") + resp.set_cookie('GFG','ComputerScience Portal') + return resp @app.route("/style.css") def style(): return send_file("style.css")