[#2367] Standard libraries — Dave Thomas <dave@...>

From ruby-dev summary:

60 messages 2004/02/11

[#2397] PATCH: deprecate cgi-lib, getopts, importenv, parsearg from standard library — Gavin Sinclair <gsinclair@...>

Index: cgi-lib.rb

15 messages 2004/02/12

[#2465] PATCH: OpenStruct#initialize to yield self — Gavin Sinclair <gsinclair@...>

This is a common approach I use to object initialization; I don't know

24 messages 2004/02/19

[PATCH] Use the BasicSocket#do_not_reverse_lookup flag in Webrick

From: Thomas Uehlinger <uehli@...>
Date: 2004-02-07 09:45:31 UTC
List: ruby-core #2357
Hi

With this patch you can make use of the new per-socket do_not_reverse_lookup flag in Webrick.
I wonder if it would make sense to even set :DoNotReverseLookup to true as the standard configuration because reverse lookup just slows down the server in normal operation.

-- Thomas Uehlinger


Index: config.rb
===================================================================
RCS file: /src/ruby/lib/webrick/config.rb,v
retrieving revision 1.2
diff -u -r1.2 config.rb
--- config.rb   8 Sep 2003 09:52:33 -0000       1.2
+++ config.rb   7 Feb 2004 09:39:31 -0000
@@ -33,6 +33,7 @@
       :StartCallback  => nil,
       :StopCallback   => nil,
       :AcceptCallback => nil,
+      :DoNotReverseLookup => false,
     }
  
     # for HTTPServer, HTTPRequest, HTTPResponse ...
Index: server.rb
===================================================================
RCS file: /src/ruby/lib/webrick/server.rb,v
retrieving revision 1.5
diff -u -r1.5 server.rb
--- server.rb   4 Dec 2003 00:12:14 -0000       1.5
+++ server.rb   7 Feb 2004 09:39:32 -0000
@@ -90,6 +90,9 @@
                 @tokens.pop          # blocks while no token is there.
                 sock = svr.accept
                 sock.sync = true
+                if @config[:DoNotReverseLookup]
+                  sock.do_not_reverse_lookup = true if sock.respond_to?(:do_not_reverse_lookup=)
+                end
                 Utils::set_close_on_exec(sock)
                 th = start_thread(sock, &block)
                 th[:WEBrickThread] = true

In This Thread

Prev Next