Sha256: 75a1c42c698c5d120320573bcec2698e90a5f3e7fb95f1bd8caf40af7cb3a97f
Contents?: true
Size: 655 Bytes
Versions: 46
Compression:
Stored size: 655 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'polyphony' require 'localhost/authority' authority = Localhost::Authority.fetch opts = { reuse_addr: true, dont_linger: true, secure_context: authority.server_context } server = Polyphony::Net.tcp_listen('localhost', 1234, opts) puts 'Serving HTTPS on port 1234' spin_loop(interval: 1) { STDOUT << '.' } # server.accept_loop do |socket| while (socket = server.accept) spin do while (data = socket.gets("\n", 8192)) if data.chomp.empty? socket << "HTTP/1.1 200 OK\nConnection: close\nContent-Length: 4\n\nfoo\n" break end end end end
Version data entries
46 entries across 46 versions & 1 rubygems