3 ms·
TCL: proc webServer {chan addr port} { while {[gets $chan] ne ""} {} puts $chan "HTTP/1.1 200 OK\n Connection: close\nContent-Type: tex
by doublerabbit 3y ago
TCL:
proc webServer {chan addr port} {
while {[gets $chan] ne ""} {}
puts $chan "HTTP/1.1 200 OK\n Connection: close\nContent-Type: text/plain\n"
puts $chan "Hello World!"
close $chan
}
socket -server webServer 8080
vwait forever
- mg 3y agoThat lacks a few things: 1: The comment 2: Printing the status message ("Listening on ...") 3: Outputting "Hello world, got {request.path}!" Aka http request parsing and string extrapolation.