Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Hello-world-Web-server/Lua/hello-world-web-server.lua
Normal file
10
Task/Hello-world-Web-server/Lua/hello-world-web-server.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local socket = require "socket"
|
||||
local headers = "HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: %d\r\n\r\n%s"
|
||||
local content = "<!doctype html><html><title>Goodbye, World!</title><h1>Goodbye, World!"
|
||||
local server = assert(socket.bind("localhost", 8080))
|
||||
repeat
|
||||
local client = server:accept()
|
||||
local ok = client:send(string.format(headers, #content, content))
|
||||
client:close()
|
||||
until not client or not ok
|
||||
server:close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue