Update server.py
This commit is contained in:
parent
1718891a06
commit
26f72c6fb0
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
import asyncio, traceback, socket, ssl
|
||||
from urllib.parse import urlparse
|
||||
from flask import Flask, request, redirect
|
||||
from hypercorn.config import Config
|
||||
from hypercorn.asyncio import serve
|
||||
|
@ -34,8 +35,9 @@ def relay():
|
|||
title = "Something went wrong..."
|
||||
try:
|
||||
gsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
gemsocket = ssl.create_default_context().wrap_socket(gsocket)
|
||||
gemsocket.connect((url, 1965))
|
||||
fulladdr = "gemini://" + url
|
||||
gemsocket = ssl.create_default_context().wrap_socket(gsocket, server_hostname=urlparse(fulladdr).hostname)
|
||||
gemsocket.connect((urlparse(fulladdr).hostname, 1965))
|
||||
gemsocket.send(bytes("gemini://" + url + "\r\n", "UTF-8"))
|
||||
received = ""
|
||||
while True:
|
||||
|
|
Loading…
Add table
Reference in a new issue