lib/pitchfork/http_server.rb in pitchfork-0.12.0 vs lib/pitchfork/http_server.rb in pitchfork-0.13.0
- old
+ new
@@ -1,6 +1,8 @@
# -*- encoding: binary -*-
+# frozen_string_literal: true
+
require 'pitchfork/pitchfork_http'
require 'pitchfork/flock'
require 'pitchfork/soft_timeout'
require 'pitchfork/shared_memory'
require 'pitchfork/info'
@@ -89,11 +91,11 @@
# all bound listener sockets
# note: this is public used by raindrops, but not recommended for use
# in new projects
LISTENERS = []
- NOOP = '.'.freeze
+ NOOP = '.'
# :startdoc:
# This Hash is considered a stable interface and changing its contents
# will allow you to switch between different installations of Pitchfork
# or even different installations of the same applications without
@@ -510,10 +512,11 @@
next_sleep = time_left
end
next
else # worker is out of time
next_sleep = 0
+ child.deadline = now + 1
hard_timeout(child)
end
end
next_sleep <= 0 ? 1 : next_sleep
@@ -694,11 +697,11 @@
rescue
end
def e103_response_write(client, headers)
rss = @request.response_start_sent
- buf = rss ? "103 Early Hints\r\n" : "HTTP/1.1 103 Early Hints\r\n"
+ buf = (rss ? "103 Early Hints\r\n" : "HTTP/1.1 103 Early Hints\r\n").b
headers.each { |key, value| append_header(buf, key, value) }
buf << (rss ? "\r\nHTTP/1.1 ".freeze : "\r\n".freeze)
client.write(buf)
end
@@ -708,10 +711,10 @@
# constant table sizes even for Ruby 2.0 users who'll hit extra
# allocations here.
client.write(@request.response_start_sent ?
"100 Continue\r\n\r\nHTTP/1.1 ".freeze :
"HTTP/1.1 100 Continue\r\n\r\n".freeze)
- env.delete('HTTP_EXPECT'.freeze)
+ env.delete('HTTP_EXPECT')
end
# once a client is accepted, it is processed in its entirety here
# in 3 easy steps: read request, call app, write app response
def process_client(client, worker, timeout_handler)