lib/waxx/res.rb in waxx-0.1.2 vs lib/waxx/res.rb in waxx-0.1.3
- old
+ new
@@ -82,11 +82,23 @@
# Output the headers and the body
def complete
re = out.join
headers["Content-Length"] = re.bytesize
- server.print head
- server.print re
+ begin
+ server.print head
+ server.print re
+ # Connection reset by peer
+ rescue Errno::ECONNRESET => e
+ Waxx.debug(e.class)
+ Waxx.debug(e)
+ Waxx.debug(e.backtrace.join("\n"))
+ # Broken pipe
+ rescue Errno::EPIPE => e
+ Waxx.debug(e.class)
+ Waxx.debug(e)
+ Waxx.debug(e.backtrace.join("\n"))
+ end
end
def cookie(name:"", value:nil, domain:nil, expires:nil, path:"/", secure:true, http_only: false, same_site: "Lax")
expires = expires.nil? ? "" : "expires=#{Time === expires ? expires.rfc2822 : expires}; "
cookies << "#{name}=#{Waxx::Http.escape(value.to_s)}; #{expires}#{";domain=#{domain}" if domain}; path=#{path}#{"; secure" if secure}#{"; HttpOnly" if http_only}; SameSite=#{same_site}"