Sha256: 70260374bd4f3222738cbdfa237f0dd8adf8b894c4fbdd15fcb4eebd0e7c63a6

Contents?: true

Size: 689 Bytes

Versions: 20

Compression:

Stored size: 689 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|
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

20 entries across 20 versions & 1 rubygems

Version Path
polyphony-1.6 examples/io/https_server.rb
polyphony-1.5 examples/io/https_server.rb
polyphony-1.4 examples/io/https_server.rb
polyphony-1.3 examples/io/https_server.rb
polyphony-1.2.1 examples/io/https_server.rb
polyphony-1.2 examples/io/https_server.rb
polyphony-1.1.1 examples/io/https_server.rb
polyphony-1.1 examples/io/https_server.rb
polyphony-1.0.2 examples/io/https_server.rb
polyphony-1.0.1 examples/io/https_server.rb
polyphony-1.0 examples/io/https_server.rb
polyphony-0.99.6 examples/io/https_server.rb
polyphony-0.99.5 examples/io/https_server.rb
polyphony-0.99.4 examples/io/https_server.rb
polyphony-0.99.3 examples/io/https_server.rb
polyphony-0.99.2 examples/io/https_server.rb
polyphony-0.99.1 examples/io/https_server.rb
polyphony-0.99 examples/io/https_server.rb
polyphony-0.98 examples/io/https_server.rb
polyphony-0.97 examples/io/https_server.rb