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.12.1 -_- sleepy app server for Ruby
  @ 2016-02-22  0:43  6% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-02-22  0:43 UTC (permalink / raw)
  To: ruby-talk, yahns-public

A Free Software, multi-threaded, non-blocking network
application server designed for low _idle_ power consumption.
It is primarily optimized for applications with occasional users
which see little or no traffic.  yahns currently hosts Rack/HTTP
applications, but may eventually support other application
types.  Unlike some existing servers, yahns is extremely
sensitive to fatal bugs in the applications it hosts.

Changes:

    yahns 1.12.1 - more TLS fixes

    Most notably release fixes TLS output buffering for large
    responses to slow clients.  For Rack HTTPS users,
    env['SERVER_PORT'] also defaults to 443 properly unless the
    Host: request header specifies differently.

    Also, the extras/autoindex change is to make our own directory
    listing look nicer as we use Let's Encrypt and don't want to
    waste space listing ".well-known/" directory contents on:

	https://yahns.yhbt.net/

    Yes, we really do care how our homepage looks!

    6 changes since v1.12.0:
          extras/autoindex: support hiding dotfiles
          fix output buffering with SSL_write
          https: ensure SERVER_PORT defaults to 443
          test_ssl: check SERVER_PORT when parsed from Host: header
          doc: mention kqueue/kevent alongside epoll
          doc: more minor updates

Please note the disclaimer:

  yahns is extremely sensitive to fatal bugs in the apps it hosts.  There
  is no (and never will be) any built-in "watchdog"-type feature to kill
  stuck processes/threads.  Each yahns process may be handling thousands
  of clients; unexpectedly killing the process will abort _all_ of those
  connections.  Lives may be lost!

  yahns hackers are not responsible for your application/library bugs.
  Use an application server which is tolerant of buggy applications
  if you cannot be bothered to fix all your fatal bugs.

* git clone git://yhbt.net/yahns
* http://yahns.yhbt.net/README
* http://yahns.yhbt.net/NEWS.atom.xml
* we only accept plain-text email yahns-public@yhbt.net
* and archive all the mail we receive: http://yhbt.net/yahns-public/
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns

^ permalink raw reply	[relevance 6%]

* [PATCH] extras/autoindex: support hiding dotfiles
@ 2016-02-14 22:02  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-02-14 22:02 UTC (permalink / raw)
  To: yahns-public

Switch option initialization to using a keyword hash
since yet-another boolean is too much.

Using kwargs won't work under Ruby 1.9.3 which we still
support (for now).

Note: being a part of extras/, there's no API stability
guarantees but this should've maintained it.
---
 extras/autoindex.rb | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index e84aa7b..4deb3ef 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.rb
@@ -14,13 +14,29 @@ class Autoindex
   FN = %{<a href="%s">%s</a>}
   TFMT = "%Y-%m-%d %H:%M"
 
-  def initialize(app, index = %w(index.html), skip_gzip_static = true)
+  def initialize(app, *args)
     app.respond_to?(:root) or raise ArgumentError,
-       "wrapped app #{app.inspect} does not respond to :root"
+       "wrapped app #{app.inspect} does not respond to #root"
     @app = app
     @root = app.root
-    @index = index
-    @skip_gz = skip_gzip_static
+
+    @index = case args[0]
+    when Array then args.shift
+    when String then Array(args.shift)
+    else
+      %w(index.html)
+    end
+
+    @skip_gzip_static = @skip_dotfiles = nil
+    case args[0]
+    when Hash
+      @skip_gzip_static = args[0][:skip_gzip_static]
+      @skip_dotfiles = args[0][:skip_dotfiles]
+    when true, false
+      @skip_gzip_static = args.shift
+    end
+    @skip_gzip_static = true if @skip_gzip_static.nil?
+    @skip_dotfiles = false if @skip_dotfiles.nil?
   end
 
   def redirect_slash(env)
@@ -69,13 +85,15 @@ def call(env)
       # generate the index, show directories first
       dirs = []
       files = []
-      ngz_idx = {} if @skip_gz # used to avoid redundant stat()
+      ngz_idx = {} if @skip_gzip_static # used to avoid redundant stat()
       dir.each do |base|
         case base
         when "."
           next
         when ".."
           next if path_info == "/"
+        when /\A\./
+          next if @skip_dotfiles
         end
 
         begin
-- 
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 --
2016-02-14 22:02  7% [PATCH] extras/autoindex: support hiding dotfiles Eric Wong
2016-02-14 22:37     [ANN] yahns 1.12.0 -_- sleepy app server for Ruby Eric Wong
2016-02-22  0:43  6% ` [ANN] yahns 1.12.1 " 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).