yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] doc: add session cache usage to OpenSSL example
@ 2016-08-02 19:57 Eric Wong
  2016-08-02 20:00 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2016-08-02 19:57 UTC (permalink / raw)
  To: yahns-public

Sometimes, one process is all you need :>

Fwiw, I am also experimenting with the following in my
yahns.conf.rb file:

scache_stats = lambda do |env|
  s = ctx.session_cache_stats.inspect << "\n"
  [200, [%W(Content-Length #{s.size}), %w(Content-Type text/plain)], [s]]
end
app(:rack, scache_stats, preload: true) do
  listen "unix:/tmp/yahns-scache.#$$.sock"
end

Which allows me to get stats based on the master PID (not worker):

  printf 'GET / HTTP/1.0\r\n\r\n' | socat - UNIX:/tmp/yahns-scache.$PID.sock
---
 Documentation/yahns_config.pod | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/yahns_config.pod b/Documentation/yahns_config.pod
index d8c6801..c519256 100644
--- a/Documentation/yahns_config.pod
+++ b/Documentation/yahns_config.pod
@@ -451,6 +451,9 @@ An example which seems to work is:
   # but disable client certificate verification as it is rare:
   ssl_ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
 
+  # Built-in session cache (only works if worker_processes is nil or 0)
+  ssl_ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_SERVER
+
   app(:rack, "/path/to/my/app/config.ru") do
     listen 443, ssl_ctx: ssl_ctx
   end
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] doc: add session cache usage to OpenSSL example
  2016-08-02 19:57 [PATCH] doc: add session cache usage to OpenSSL example Eric Wong
@ 2016-08-02 20:00 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-08-02 20:00 UTC (permalink / raw)
  To: yahns-public

Eric Wong <e@80x24.org> wrote:
> +++ b/Documentation/yahns_config.pod
> @@ -451,6 +451,9 @@ An example which seems to work is:
>    # but disable client certificate verification as it is rare:
>    ssl_ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
>  
> +  # Built-in session cache (only works if worker_processes is nil or 0)

Ermm.  That should be: "nil or 1" :x
Haven't pushed, yet.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-02 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 19:57 [PATCH] doc: add session cache usage to OpenSSL example Eric Wong
2016-08-02 20:00 ` Eric Wong

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

	http://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).