yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] yahns 1.5.0 - initial OpenSSL support and bugfixes
@ 2014-12-21  2:25  4% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-12-21  2:25 UTC (permalink / raw)
  To: yahns-public

This release adds basic OpenSSL support for HTTPS connections.

Users must supply a OpenSSL::SSL::SSLContext object which yahns will use
as-is.  yahns will only support HTTPS on Ruby 2.1 and later, as we rely
on "exception: false" in the read_nonblock and write_nonblock methods in
OpenSSL::SSL::SSLSocket.

See the Ruby standard library documentation on how to configure
OpenSSL::SSL::SSLContext objects to pass to the yahns "listen" directive
Editing the yahns config file to use OpenSSL goes something like this:

    require 'openssl' # we will not do this for the user, even
    ctx = OpenSSL::SSL::SSLContext.new
    # user must configure ctx here...

    listen 443, ssl_ctx: ctx

Note: yahns developers are not responsible for bugs in OpenSSL itself
or misconfigured SSLContext objects created by users.  However, our
support of OpenSSL sockets is barely-tested and likely buggy, too.

Furthermore, the "sendfile" (or "kgio-sendfile") gem is no longer a
required dependency.  It is currently impossible to use zero-copy
system calls with TLS sockets.

There are also minor cleanups and a bugfix to ensure body#close is
called for folks using body#to_path where `body' is the Rack
response body.  This bug affected logging using the 'clogger' gem
when serving static files.

Shortlog of changes since 1.4.0

      save around 1500 bytes of memory on x86-64
      http_response: remove arg for Array#join
      remove unused client_max_header_size config
      config: use literal symbol array for now
      http_response: reduce constants for 100 responses
      favor Array#map! for freshly-split arrays
      sendfile_compat: remove dependency on pread
      extras/autoindex: simplify checking non-.gz
      Rakefile: kill more useless gsub use
      initial cut at OpenSSL support
      test/test_ssl: skip test if SSL on older Rubies
      wbuf_common: close body proxies on sendfile abort
      bump published Ruby version requirement to 2.0
      make sendfile an optional dependency
      openssl_client: ignore SSL_accept errors during negotiation

Disclaimer: the yahns project does not and will never endorse
any commercial entities, including certificate authorities.

Shpx Nhgubevgl.

-- 
EW

^ permalink raw reply	[relevance 4%]

* [PATCH 2/2] make sendfile an optional dependency
@ 2014-12-16 22:54  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-12-16 22:54 UTC (permalink / raw)
  To: yahns-public

Not everybody needs to serve or even buffer to regular files,
so make sendfile optional to avoid the extra memory use and
relocations.
---
 lib/yahns/wbuf_common.rb | 7 ++++---
 yahns.gemspec            | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb
index 69fd00d..0ce4526 100644
--- a/lib/yahns/wbuf_common.rb
+++ b/lib/yahns/wbuf_common.rb
@@ -1,10 +1,11 @@
 # -*- encoding: binary -*-
 # Copyright (C) 2009-2013, Eric Wong <normalperson@yhbt.net> et. al.
 # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
-if ENV["SENDFILE_BROKEN"]
-  require_relative 'sendfile_compat'
-else
+begin
+  raise LoadError, "SENDFILE_BROKEN env set" if ENV["SENDFILE_BROKEN"]
   require 'sendfile'
+rescue LoadError
+  require_relative 'sendfile_compat'
 end
 
 module Yahns::WbufCommon # :nodoc:
diff --git a/yahns.gemspec b/yahns.gemspec
index db1d50e..120dc46 100644
--- a/yahns.gemspec
+++ b/yahns.gemspec
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
   s.files = manifest
   s.add_dependency(%q<kgio>, '~> 2.9')
   s.add_dependency(%q<sleepy_penguin>, '~> 3.2')
-  s.add_dependency(%q<kgio-sendfile>, '~> 1.2')
   s.add_dependency(%q<unicorn>, '~> 4.6', '>= 4.6.3')
+  # s.add_dependency(%q<kgio-sendfile>, '~> 1.2') # optional
 
   # minitest is standard in Ruby 2.0, 4.3 is packaged with Ruby 2.0.0,
   # 4.7.5 with 2.1.  We work with minitest 5, too.  6.x does not exist
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-12-16 22:54  7% [PATCH 2/2] make sendfile an optional dependency Eric Wong
2014-12-21  2:25  4% [ANN] yahns 1.5.0 - initial OpenSSL support and bugfixes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).