[#11569] sprintf: Format specifier tokens aren't checked well enough — Florian Gross <florgro@...>

Hi,

12 messages 2007/07/01

[#11611] Import gem to Ruby 1.9 — SASADA Koichi <ko1@...>

Hi,

130 messages 2007/07/08
[#11625] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/07/09

On Jul 8, 2007, at 00:49, SASADA Koichi wrote:

[#11727] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/17

-----BEGIN PGP SIGNED MESSAGE-----

[#11738] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/07/17

On Jul 17, 2007, at 01:26, NAKAMURA, Hiroshi wrote:

[#11752] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/18

-----BEGIN PGP SIGNED MESSAGE-----

[#11794] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/24

-----BEGIN PGP SIGNED MESSAGE-----

[#11820] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/07/26

-----BEGIN PGP SIGNED MESSAGE-----

[#12323] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/01

-----BEGIN PGP SIGNED MESSAGE-----

[#12330] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/01

On Sep 30, 2007, at 22:56 , NAKAMURA, Hiroshi wrote:

[#12637] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 1, 2007, at 09:57 , Eric Hodel wrote:

[#12642] Re: Import gem to Ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/10/13

Hi,

[#12643] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/13

-----BEGIN PGP SIGNED MESSAGE-----

[#12645] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 02:00 , NAKAMURA, Hiroshi wrote:

[#12652] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/13

-----BEGIN PGP SIGNED MESSAGE-----

[#12656] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 08:00 , NAKAMURA, Hiroshi wrote:

[#12691] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/15

-----BEGIN PGP SIGNED MESSAGE-----

[#12712] Re: Import gem to Ruby 1.9 — Eric Hodel <drbrain@...7.net> 2007/10/16

On Oct 15, 2007, at 07:14 , NAKAMURA, Hiroshi wrote:

[#12717] Re: Import gem to Ruby 1.9 — "Leonard Chin" <l.g.chin@...> 2007/10/17

On 10/17/07, Eric Hodel <drbrain@segment7.net> wrote:

[#12729] Re: Import gem to Ruby 1.9 — Charles Oliver Nutter <charles.nutter@...> 2007/10/17

Leonard Chin wrote:

[#12766] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/19

In article <4710890A.3020009@sarion.co.jp>,

[#12768] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/19

-----BEGIN PGP SIGNED MESSAGE-----

[#12771] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/19

In article <4718708D.3050001@sarion.co.jp>,

[#12792] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/20

-----BEGIN PGP SIGNED MESSAGE-----

[#12798] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/21

In article <471A1720.4080606@sarion.co.jp>,

[#12827] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/22

-----BEGIN PGP SIGNED MESSAGE-----

[#12852] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/23

In article <471CAFE0.2070104@sarion.co.jp>,

[#12853] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/23

-----BEGIN PGP SIGNED MESSAGE-----

[#12854] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/23

In article <471D4D1F.5050006@sarion.co.jp>,

[#12857] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/23

-----BEGIN PGP SIGNED MESSAGE-----

[#12896] Re: Import gem to Ruby 1.9 — Tanaka Akira <akr@...> 2007/10/24

In article <471D5665.5040209@sarion.co.jp>,

[#12914] Re: Import gem to Ruby 1.9 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/25

-----BEGIN PGP SIGNED MESSAGE-----

[#11642] Re: Proposal: runtime-modifying Kernel methods should be keywords — "Marcel Molina Jr." <marcel@...>

On Fri, Jul 13, 2007 at 03:02:06PM +0900, Charles Oliver Nutter wrote:

21 messages 2007/07/13
[#11671] Re: Proposal: runtime-modifying Kernel methods should be keywords — Ryan Davis <ryand-ruby@...> 2007/07/13

[#11645] Re: Proposal: runtime-modifying Kernel methods should be keywords — Charles Oliver Nutter <charles.nutter@...>

Charles Oliver Nutter wrote:

20 messages 2007/07/13
[#11646] Re: Proposal: runtime-modifying Kernel methods should be keywords — Yukihiro Matsumoto <matz@...> 2007/07/13

Hi,

[#11647] Re: Proposal: runtime-modifying Kernel methods should be keywords — Charles Oliver Nutter <charles.nutter@...> 2007/07/13

Yukihiro Matsumoto wrote:

[#11650] Re: Proposal: runtime-modifying Kernel methods should be keywords — Nobuyoshi Nakada <nobu@...> 2007/07/13

Hi,

[#11756] threads and heavy io on osx and linux — "ara.t.howard" <Ara.T.Howard@...>

15 messages 2007/07/18

[#11795] What libraries to be unbundled? — "NAKAMURA, Hiroshi" <nakahiro@...>

-----BEGIN PGP SIGNED MESSAGE-----

27 messages 2007/07/24
[#11797] Re: What libraries to be unbundled? — David Flanagan <david@...> 2007/07/24

I don't think that json should be unbundled. It is the interchange

[PATCH] XMLRPC::ModRubyServer

From: Chris Wailes <cwailes2@...>
Date: 2007-07-16 22:49:16 UTC
List: ruby-core #11720
Made some changes to the XMLRPC::ModRubyServer class that allows it to be loaded as a RubyHandler by ModRuby and prevent it from being reloaded every time a request is made.  This can greatly improve performance when the server takes a while to load, such as when it is establishing database connections or loading lots of libraries.

As well, I modified the way that the `XMLRPC::Server.dispatch` method calls the  service_hook Proc object so that it also passes the name of the XML-RPC method that is called along with the Proc object associated with the name, and the arguments for the method.

Sincerely,
Chris Wailes

Attachments (1)

ruby-changes.patch (4.16 KB, text/x-diff)
Index: lib/xmlrpc/server.rb
===================================================================
--- lib/xmlrpc/server.rb	(revision 12809)
+++ lib/xmlrpc/server.rb	(working copy)
@@ -129,9 +129,9 @@
     The service-hook is called with a (({Proc})) object and with the parameters for this (({Proc})).
     An example:
 
-       server.set_service_hook {|obj, *args|
+       server.set_service_hook {|method_name, method_obj, *args|
          begin
-           ret = obj.call(*args)  # call the original service-method
+           ret = method_obj.call(*args)  # call the original service-method
            # could convert the return value 
          resuce
            # rescue exceptions
@@ -333,7 +333,7 @@
         if @service_hook.nil?
           return obj.call(*args) 
         else
-          return @service_hook.call(obj, *args)
+          return @service_hook.call(methodname, obj, *args)
         end
       end
     end 
@@ -498,44 +498,91 @@
 
 =begin
 = XMLRPC::ModRubyServer
-== Description
-Implements a XML-RPC server, which works with Apache mod_ruby.
+== Synopsis
+ruby_file.rb:
+	def make_server
+		server = XMLRPC::ModRubyServer.new()
 
-Use it in the same way as CGIServer!
+		server.add_handler("michael.add") do |a,b|
+			a + b
+		end
 
+		server.add_handler("michael.div") do |a,b|
+			if b == 0
+				raise XMLRPC::FaultException.new(1, "division by zero")
+			else
+				a / b
+			end
+		end
+
+		server.set_default_handler do |name, *args|
+			raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!")
+		end
+
+		return server
+	end
+
+ruby.conf:
+#This is your mod_ruby configuration file.
+	LoadModule ruby_module modules/mod_ruby.so
+
+	DirectoryIndex index.rb
+
+	AddType text/html.rb
+	<IfModule mod_ruby.c>
+		RubyRequire apache/ruby-run
+
+		#If your file is at /path/to/your/ruby_file.rb
+		RubyAddPath /path/to/your
+		RubyRequire ruby_file
+
+		# Exec *.rb as ruby scripts.
+		<Files *.rb>
+			SetHandler ruby-object
+			RubyHandler Apache::RubyRun.instance
+			Options +ExecCGI
+		</Files>
+	</IfModule>
+
+	#This location doesn't actually corispond to any file so you can make it any path you want.
+	#This example makes the server address http://example.com/xmlrpcserver
+	<Location /xmlrpcserver>
+		SetHandler ruby-object
+		RubyHandler make_server
+
+		Order allow,deny
+		Allow from all
+	</Location>
+
+== Description
+Implements a XML-RPC server, which works with Apache mod_ruby.  By providing the 'handler' method a ModRubyServer object
+can be used as a RubyHandler by mod_ruby.  This prevents the server from being instantiated every time a request is made.
 == Superclass
 ((<XMLRPC::BasicServer>))
-=end 
+=end
 
 class ModRubyServer < BasicServer
+	def handler(apache_request)
+		@ap = apache_request
 
-  def initialize(*a)
-    @ap = Apache::request
-    super(*a)
-  end
+		header = Hash.new
+		@ap.headers_in.each {|key, value| header[key.capitalize] = value}
 
-  def serve
-    catch(:exit_serve) {
-      header = {}
-      @ap.headers_in.each {|key, value| header[key.capitalize] = value}
+		length = header['Content-length'].to_i
 
-      length = header['Content-length'].to_i
+		http_error(405, "Method Not Allowed") unless @ap.request_method  == "POST"
+		http_error(400, "Bad Request")        unless parse_content_type(header['Content-type']).first == "text/xml"
+		http_error(411, "Length Required")    unless length > 0
 
-      http_error(405, "Method Not Allowed") unless @ap.request_method  == "POST" 
-      http_error(400, "Bad Request")        unless parse_content_type(header['Content-type']).first == "text/xml"
-      http_error(411, "Length Required")    unless length > 0 
+		@ap.binmode
+		data = apache_request.read(length)
 
-      # TODO: do we need a call to binmode?
-      @ap.binmode
-      data = @ap.read(length)
+		http_error(400, "Bad Requiest") if data.nil? or data.size != length
 
-      http_error(400, "Bad Request")        if data.nil? or data.size != length
+		http_write(process(data), 200, "Content-type" => "text/xml; charset=utf-8")
 
-      http_write(process(data), 200, "Content-type" => "text/xml; charset=utf-8")
-    }
-  end
-
-
+		return Apache::OK
+	end
   private
 
   def http_error(status, message)

In This Thread

Prev Next