[前][次][番号順一覧][スレッド一覧]

ruby-changes:5169

From: knu <ko1@a...>
Date: Wed, 28 May 2008 16:16:35 +0900 (JST)
Subject: [ruby-changes:5169] Ruby:r16664 (ruby_1_8_7): Merge from ruby_1_8.

knu	2008-05-28 16:16:25 +0900 (Wed, 28 May 2008)

  New Revision: 16664

  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/error.c
    branches/ruby_1_8_7/lib/singleton.rb
    branches/ruby_1_8_7/lib/webrick/httpservlet/cgihandler.rb

  Log:
    Merge from ruby_1_8.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/lib/singleton.rb?r1=16664&r2=16663&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/ChangeLog?r1=16664&r2=16663&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/lib/webrick/httpservlet/cgihandler.rb?r1=16664&r2=16663&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/error.c?r1=16664&r2=16663&diff_format=u

Index: ruby_1_8_7/error.c
===================================================================
--- ruby_1_8_7/error.c	(revision 16663)
+++ ruby_1_8_7/error.c	(revision 16664)
@@ -30,6 +30,7 @@
 #endif
 
 extern const char ruby_version[], ruby_release_date[], ruby_platform[];
+extern const int ruby_patchlevel;
 
 int ruby_nerrs;
 
@@ -208,8 +209,8 @@
 	va_init_list(args, fmt);
 	vfprintf(out, fmt, args);
 	va_end(args);
-	fprintf(out, "\nruby %s (%s) [%s]\n\n",
-		ruby_version, ruby_release_date, ruby_platform);
+	fprintf(out, "\nruby %s (%s patchlevel %d) [%s]\n\n",
+		ruby_version, ruby_release_date, ruby_patchlevel, ruby_platform);
     }
     abort();
 }
Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 16663)
+++ ruby_1_8_7/ChangeLog	(revision 16664)
@@ -1,3 +1,14 @@
+Wed May 28 16:12:44 2008  Akinori MUSHA  <knu@i...>
+
+	* lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIHandler#do_GET):
+	  Set the HTTP status code to 302 if a Location header field is
+	  present and the status code is not valid as a client
+	  redirection.  cf. RFC 3875 6.2.3, 6.2.4.
+
+Wed May 28 15:18:16 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/singleton.rb (SingletonClassMethods): _load should be public.
+
 Wed May 28 12:52:41 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
@@ -5,6 +16,11 @@
 
 	* object.c (convert_type): ditto.
 
+Tue May 27 23:26:49 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* error.c (rb_bug): description from rb_bug() should include
+	  patchlevel.  [ruby-dev:34826]
+
 Tue May 27 20:19:22 2008  Akinori MUSHA  <knu@i...>
 
 	* array.c (rb_ary_slice_bang): Return an empty array instead of
Index: ruby_1_8_7/lib/webrick/httpservlet/cgihandler.rb
===================================================================
--- ruby_1_8_7/lib/webrick/httpservlet/cgihandler.rb	(revision 16663)
+++ ruby_1_8_7/lib/webrick/httpservlet/cgihandler.rb	(revision 16664)
@@ -85,6 +85,10 @@
             res.status = $1.to_i
             header.delete('status')
           end
+          if header.has_key?('location')
+            # RFC 3875 6.2.3, 6.2.4
+            res.status = 302 unless (300...400) === res.status
+          end
           if header.has_key?('set-cookie')
             header['set-cookie'].each{|k|
               res.cookies << Cookie.parse_set_cookie(k)
Index: ruby_1_8_7/lib/singleton.rb
===================================================================
--- ruby_1_8_7/lib/singleton.rb	(revision 16663)
+++ ruby_1_8_7/lib/singleton.rb	(revision 16664)
@@ -30,7 +30,7 @@
 # *  Klass.new and Klass.allocate - as private
 #
 # Providing (or modifying) the class methods
-# *  Klass.inherited(sub_klass) and Klass.clone()  - 
+# *  Klass.inherited(sub_klass) and Klass.clone()  -
 #    to ensure that the Singleton pattern is properly
 #    inherited and cloned.
 #
@@ -70,10 +70,10 @@
   def dup
     raise TypeError, "can't dup instance of singleton #{self.class}"
   end
-  
-  private 
+
+  private
   #  default marshalling strategy
-  def _dump(depth=-1) 
+  def _dump(depth=-1)
     ''
   end
 end
@@ -104,7 +104,7 @@
         end
       end
     elsif  _instantiate?()
-      Thread.critical = false    
+      Thread.critical = false
     else
       @__instance__  = false
       Thread.critical = false
@@ -123,26 +123,26 @@
     end
     @__instance__
   end
-  
-  module SingletonClassMethods  
+
+  module SingletonClassMethods
     # properly clone the Singleton pattern - did you know
-    # that duping doesn't copy class methods?  
+    # that duping doesn't copy class methods?
     def clone
       Singleton.__init__(super)
     end
-    
+
+    def _load(str)
+      instance
+    end
+
     private
-    
-    #  ensure that the Singleton pattern is properly inherited   
+
+    #  ensure that the Singleton pattern is properly inherited
     def inherited(sub_klass)
       super
       Singleton.__init__(sub_klass)
     end
-    
-    def _load(str) 
-      instance 
-    end
-    
+
     # waiting-loop hook
     def _instantiate?()
       while false.equal?(@__instance__)
@@ -153,7 +153,7 @@
       @__instance__
     end
   end
-  
+
   def __init__(klass)
     klass.instance_eval { @__instance__ = nil }
     class << klass
@@ -161,11 +161,11 @@
     end
     klass
   end
-  
+
   private
   #  extending an object with Singleton is a bad idea
   undef_method :extend_object
-  
+
   def append_features(mod)
     #  help out people counting on transitive mixins
     unless mod.instance_of?(Class)
@@ -173,7 +173,7 @@
     end
     super
   end
-  
+
   def included(klass)
     super
     klass.private_class_method  :new, :allocate
@@ -181,21 +181,21 @@
     Singleton.__init__(klass)
   end
 end
- 
 
 
+
 if __FILE__ == $0
 
 def num_of_instances(klass)
     "#{ObjectSpace.each_object(klass){}} #{klass} instance(s)"
-end 
+end
 
 # The basic and most important example.
 
 class SomeSingletonClass
   include Singleton
 end
-puts "There are #{num_of_instances(SomeSingletonClass)}" 
+puts "There are #{num_of_instances(SomeSingletonClass)}"
 
 a = SomeSingletonClass.instance
 b = SomeSingletonClass.instance # a and b are same object
@@ -218,23 +218,23 @@
     puts "initialize called by thread ##{Thread.current[:i]}"
   end
 end
-  
+
 class << Ups
   def _instantiate?
     @enter.push Thread.current[:i]
     while false.equal?(@__instance__)
       Thread.critical = false
-      sleep 0.08 
+      sleep 0.08
       Thread.critical = true
     end
     @leave.push Thread.current[:i]
     @__instance__
   end
-  
+
   def __sleep
     sleep(rand(0.08))
   end
-  
+
   def new
     begin
       __sleep
@@ -246,12 +246,12 @@
       end
     end
   end
-  
+
   def instantiate_all
     @enter = []
     @leave = []
-    1.upto(9) {|i|  
-      Thread.new { 
+    1.upto(9) {|i|
+      Thread.new {
         begin
           Thread.current[:i] = i
           __sleep
@@ -341,7 +341,7 @@
 class Down < Middle; end
 
 puts  "and basic \"Down test\" is #{Down.instance == Down.instance}\n
-Various exceptions"  
+Various exceptions"
 
 begin
   module AModule

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]