Last active
May 1, 2021 01:43
-
-
Save creadone/9b6c93a785e1a871f137738fc2287dc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'socket' | |
trap('SIGINT') { exit }; | |
Socket.tcp_server_loop(3000) do |conn| | |
sleep 0.5 | |
ts = "ts: #{Time.now.utc.to_i}\n" | |
puts ts | |
puts '-' * ts.size | |
puts conn.gets("\r\n\r\n") | |
conn.puts "HTTP/1.1 200 OK" | |
conn.puts "\r\n\r\n" | |
conn.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment