1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2022, by Samuel Williams.
require 'socket'
require_relative '../../lib/protocol/http1'
def test
# input, output = Socket.pair(Socket::PF_UNIX, Socket::SOCK_STREAM)
server = Protocol::HTTP1::Connection.new($stdin)
# input.write($stdin.read)
# input.close
begin
host, method, path, version, headers, body = server.read_request
body = server.read_request_body(method, headers)
rescue Protocol::HTTP1::InvalidRequest
# Ignore.
end
end
if ENV["_"] =~ /afl/
require 'kisaten'
Kisaten.crash_at [], [], Signal.list['USR1']
while Kisaten.loop 10000
test
end
else
test
end
|