mirror of
https://codeberg.org/bunbun/bunbun.dev
synced 2025-06-07 03:39:55 -07:00
switched to https and added main.md
This commit is contained in:
@ -7,7 +7,9 @@
|
||||
(fn client-handler.handle-client [client]
|
||||
(let [request (client:receive :*l)]
|
||||
|
||||
(print (: "Request from: %s:%s" :format (client:getpeername)))
|
||||
(io.stdout:setvbuf :no)
|
||||
|
||||
(print (: "Request from: %s:%s" :format _G.client-address _G.client-port))
|
||||
(print request)
|
||||
(while true
|
||||
(local request (client:receive :*l))
|
||||
|
5
pages/main.md
Normal file
5
pages/main.md
Normal file
@ -0,0 +1,5 @@
|
||||
<!--
|
||||
# Welcome to my Website
|
||||
|
||||
Hello, I'm Winter (aka bunbun) and this is my website... _Why are you here?_
|
||||
-->
|
21
server.fnl
21
server.fnl
@ -1,16 +1,29 @@
|
||||
(local socket (require :socket))
|
||||
(local ssl (require :ssl))
|
||||
|
||||
(local handle-client (. (require :client-handler) :handle-client))
|
||||
|
||||
(local port 8080)
|
||||
(local port 50625)
|
||||
(local server (socket.tcp))
|
||||
|
||||
(server:bind "*" port)
|
||||
(server:listen)
|
||||
|
||||
(local params {:mode "server"
|
||||
:protocol "tlsv1_2"
|
||||
:key "../privkey.pem"
|
||||
:certificate "../fullchain.pem"
|
||||
:cafile "../chain.pem"
|
||||
:verify "none"
|
||||
:options "all"})
|
||||
|
||||
(while true
|
||||
(local client (server:accept))
|
||||
(var client (server:accept))
|
||||
|
||||
(local co (coroutine.create (fn [] (handle-client client))))
|
||||
(set (_G.client-address _G.client-port) (client:getpeername))
|
||||
|
||||
(coroutine.resume co))
|
||||
(set client (ssl.wrap client params))
|
||||
(client:dohandshake)
|
||||
|
||||
(let [co (coroutine.create (fn [] (handle-client client)))]
|
||||
(coroutine.resume co)))
|
||||
|
Reference in New Issue
Block a user