Update server.py
This commit is contained in:
parent
d5dbab890e
commit
3dfa15ad16
1 changed files with 4 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
import asyncio, traceback, socket, ssl, zipfile, random, string, io
|
import asyncio, traceback, socket, ssl, zipfile, random, string, io
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
from urllib.parse import urlparse, quote
|
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.config import Config
|
||||||
from hypercorn.asyncio import serve
|
from hypercorn.asyncio import serve
|
||||||
from pathlib import Path
|
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))),
|
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)))]:
|
('privkey.pem', io.BytesIO(crypto.dump_privatekey(crypto.FILETYPE_PEM, k)))]:
|
||||||
zip_file.writestr(file_name, data.getvalue())
|
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")
|
@app.route("/style.css")
|
||||||
def style():
|
def style():
|
||||||
return send_file("style.css")
|
return send_file("style.css")
|
||||||
|
|
Loading…
Add table
Reference in a new issue