Skip to content
This repository
Browse code

Merge branch 'master', remote-tracking branch 'origin' into 2.0.testing

  • Loading branch information...
commit 163857dd7b33e11cf671ff407a05c5a8a3f005d6 2 parents 53263c0 + 31cc036
Brian Shirai authored July 26, 2012

Showing 100 changed files with 1,700 additions and 750 deletions. Show diff stats Hide diff stats

  1. 2  .gitignore
  2. 4  .travis.yml
  3. 92  Rakefile
  4. 1  bin/gem
  5. 1  bin/irb
  6. 1  bin/rake
  7. 1  bin/rbx
  8. 10  bin/rbx-build
  9. 1  bin/rdoc
  10. 1  bin/ri
  11. 1  bin/ruby
  12. 251  configure
  13. 4  kernel/bootstrap/proc.rb
  14. 1  kernel/bootstrap/thread.rb
  15. 10  kernel/common/array.rb
  16. 10  kernel/common/array18.rb
  17. 42  kernel/common/array19.rb
  18. 14  kernel/common/binding.rb
  19. 5  kernel/common/codeloader.rb
  20. 7  kernel/common/eval.rb
  21. 4  kernel/common/exception.rb
  22. 68  kernel/common/io19.rb
  23. 1  kernel/common/math19.rb
  24. 2  kernel/common/module19.rb
  25. 23  kernel/common/proc.rb
  26. 2  kernel/common/proc18.rb
  27. 2  kernel/common/proc19.rb
  28. 2  kernel/delta/rubinius.rb
  29. 20  kernel/loader.rb
  30. 2  lib/18/mkmf.rb
  31. 4  lib/18/net/ftp.rb
  32. 21  lib/18/net/http.rb
  33. 2  lib/18/net/https.rb
  34. 61  lib/18/net/imap.rb
  35. 9  lib/18/net/pop.rb
  36. 2  lib/18/net/protocol.rb
  37. 26  lib/18/net/smtp.rb
  38. 2  lib/18/net/telnet.rb
  39. 2  lib/{ → 18}/timeout.rb
  40. 2  lib/19/mkmf.rb
  41. 2  lib/19/net/http.rb
  42. 4  lib/19/net/pop.rb
  43. 2  lib/19/net/protocol.rb
  44. 4  lib/19/net/smtp.rb
  45. 2  lib/19/net/telnet.rb
  46. 197  lib/19/timeout.rb
  47. 8  lib/rbconfig.rb
  48. 9  lib/rubinius/configuration.rb
  49. 6  lib/rubygems/defaults/rbx.rb
  50. 4  rakelib/ext_helper.rb
  51. 80  rakelib/extensions.rake
  52. 29  rakelib/gems.rake
  53. 323  rakelib/install.rake
  54. 59  rakelib/kernel.rake
  55. 80  rakelib/package.rake
  56. 36  rakelib/package.rb
  57. 57  rakelib/release.rake
  58. 34  rakelib/vm.rake
  59. 40  spec/ruby/core/array/sample_spec.rb
  60. 5  spec/ruby/core/array/shared/join.rb
  61. 19  spec/ruby/core/array/shuffle_spec.rb
  62. 4  spec/ruby/core/exception/system_call_error_spec.rb
  63. BIN  spec/ruby/core/io/fixtures/bom_UTF-16BE.txt
  64. BIN  spec/ruby/core/io/fixtures/bom_UTF-16LE.txt
  65. BIN  spec/ruby/core/io/fixtures/bom_UTF-32BE.txt
  66. BIN  spec/ruby/core/io/fixtures/bom_UTF-32LE.txt
  67. 1  spec/ruby/core/io/fixtures/bom_UTF-8.txt
  68. 1  spec/ruby/core/io/fixtures/no_bom_UTF-8.txt
  69. 31  spec/ruby/core/io/read_spec.rb
  70. 9  spec/ruby/core/proc/allocate_spec.rb
  71. 16  spec/ruby/library/timeout/error_spec.rb
  72. 1  spec/tags/18/ruby/library/zlib/inflate/inflate_tags.txt
  73. 1  spec/tags/19/ruby/core/io/new_tags.txt
  74. 1  spec/tags/19/ruby/core/kernel/autoload_tags.txt
  75. 2  spec/tags/19/ruby/library/drb/start_service_tags.txt
  76. 1  spec/tags/19/ruby/library/zlib/inflate/inflate_tags.txt
  77. 56  vm/agent.cpp
  78. 1  vm/builtin/nativefunction.cpp
  79. 4  vm/builtin/nativemethod.hpp
  80. 48  vm/builtin/proc.cpp
  81. 6  vm/builtin/string.cpp
  82. 1  vm/builtin/system.cpp
  83. 12  vm/builtin/tuple.cpp
  84. 44  vm/capi/array.cpp
  85. 62  vm/capi/io.cpp
  86. 62  vm/capi/string.cpp
  87. 50  vm/drivers/cli.cpp
  88. 183  vm/environment.cpp
  89. 25  vm/environment.hpp
  90. 13  vm/gc/gc.cpp
  91. 5  vm/llvm/jit_compiler.cpp
  92. 38  vm/ontology.cpp
  93. 1  vm/oop.cpp
  94. 15  vm/shared_state.cpp
  95. 13  vm/shared_state.hpp
  96. 6  vm/signature.h
  97. 4  web/_site/doc/en/how-to/commit-to-github/index.html
  98. 8  web/_site/doc/en/how-to/write-a-ticket/index.html
  99. 5  web/_site/projects/index.html
  100. 4  web/projects.markdown
2  .gitignore
@@ -48,6 +48,7 @@ tmtags
48 48
 /lib/site
49 49
 /share
50 50
 /work
  51
+/staging
51 52
 
52 53
 # ignore gems and commands installed by gems
53 54
 /gems/*
@@ -63,7 +64,6 @@ tmtags
63 64
 !/bin/mkspec
64 65
 !/bin/mspec
65 66
 !/bin/prof.rb
66  
-!/bin/rbx
67 67
 
68 68
 # don't ignore spec/tags
69 69
 !/spec/tags
4  .travis.yml
@@ -15,4 +15,6 @@ notifications:
15 15
   email:
16 16
     on_success: change
17 17
     on_failure: always
18  
-  webhooks: http://elle.fallingsnow.net:13424/
  18
+rvm:
  19
+  - 1.8.7
  20
+  - 1.9.3
92  Rakefile
... ...
@@ -1,9 +1,23 @@
1 1
 # NOTE! When updating this file, also update INSTALL, if necessary.
2 2
 # NOTE! Please keep your tasks grouped together.
3 3
 
  4
+include Rake::DSL if Rake.const_defined? :DSL
  5
+
4 6
 if ENV["RUBYLIB"]
5  
-  STDERR.puts "ERROR: Please unset RUBYLIB to build Rubinius"
6  
-  exit 1
  7
+  STDERR.puts <<-EOM
  8
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  9
+WARNING                                                                 WARNING
  10
+WARNING   You have the RUBYLIB environment variable set. This can       WARNING
  11
+WARNING   cause serious problems building Rubinius, including but       WARNING
  12
+WARNING   not limited to causing the build to fail or specs to fail     WARNING
  13
+WARNING   or your computer to randomly emit strange beeping sounds      WARNING
  14
+WARNING   or burst into flames. Not all these possible catastrophic     WARNING
  15
+WARNING   effects have been observed in the wild, but you have been     WARNING
  16
+WARNING   warned. We reccomend unsetting this environment variable      WARNING
  17
+WARNING   and running the build again.                                  WARNING
  18
+WARNING                                                                 WARNING
  19
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  20
+  EOM
7 21
 end
8 22
 
9 23
 # Wipe out CDPATH, it interferes with building in some cases,
@@ -22,18 +36,24 @@ end
22 36
 
23 37
 $:.unshift File.expand_path("../", __FILE__)
24 38
 
25  
-config_rb = File.expand_path "../config.rb", __FILE__
26  
-config_h  = File.expand_path "../vm/gen/config.h", __FILE__
  39
+BUILD_CONFIG = {} unless Object.const_defined? :BUILD_CONFIG
27 40
 
28  
-unless File.exists?(config_rb) and File.exists?(config_h)
29  
-  STDERR.puts "Please run ./configure first"
30  
-  exit 1
  41
+def load_configuration
  42
+  config_rb = File.expand_path "../config.rb", __FILE__
  43
+  config_h  = File.expand_path "../vm/gen/config.h", __FILE__
  44
+
  45
+  unless File.exists?(config_rb) and File.exists?(config_h)
  46
+    STDERR.puts "Please run ./configure first"
  47
+    exit 1
  48
+  end
  49
+
  50
+  load config_rb
  51
+  BUILD_CONFIG.replace Rubinius::BUILD_CONFIG
31 52
 end
32 53
 
33  
-require config_rb
34  
-BUILD_CONFIG = Rubinius::BUILD_CONFIG
  54
+load_configuration
35 55
 
36  
-unless BUILD_CONFIG[:config_version] == 158
  56
+unless BUILD_CONFIG[:config_version] == 160
37 57
   STDERR.puts "Your configuration is outdated, please run ./configure first"
38 58
   exit 1
39 59
 end
@@ -44,6 +64,14 @@ unless BUILD_CONFIG[:which_ruby] == :ruby or BUILD_CONFIG[:which_ruby] == :rbx
44 64
   exit 1
45 65
 end
46 66
 
  67
+def libprefixdir
  68
+  if BUILD_CONFIG[:stagingdir]
  69
+    "#{BUILD_CONFIG[:stagingdir]}#{BUILD_CONFIG[:libdir]}"
  70
+  else
  71
+    "#{BUILD_CONFIG[:sourcedir]}/lib"
  72
+  end
  73
+end
  74
+
47 75
 # Records the full path to the ruby executable that runs this configure
48 76
 # script. That path will be made available to the rest of the build system
49 77
 # so the same version of ruby is invoked as needed.
@@ -93,6 +121,10 @@ class SpecRunner
93 121
   @at_exit_handler_set = false
94 122
   @at_exit_status = 0
95 123
 
  124
+  def self.at_exit_status
  125
+    @at_exit_status
  126
+  end
  127
+
96 128
   def self.set_at_exit_handler
97 129
     return if @at_exit_handler_set
98 130
 
@@ -105,7 +137,7 @@ class SpecRunner
105 137
   end
106 138
 
107 139
   def initialize
108  
-    unless File.directory? BUILD_CONFIG[:runtime]
  140
+    unless File.directory? BUILD_CONFIG[:runtimedir]
109 141
       # Setting these enables the specs to run when rbx has been configured
110 142
       # to be installed, but rake install has not been run yet.
111 143
       ENV["RBX_RUNTIME"] = File.expand_path "../runtime", __FILE__
@@ -127,7 +159,15 @@ class SpecRunner
127 159
   end
128 160
 end
129 161
 
130  
-task :default => :spec
  162
+if BUILD_CONFIG[:stagingdir]
  163
+  task :default => [:spec, :check_status, :install]
  164
+else
  165
+  task :default => :spec
  166
+end
  167
+
  168
+task :check_status do
  169
+  exit unless SpecRunner.at_exit_status == 0
  170
+end
131 171
 
132 172
 task :github do
133 173
   cur = `git config remote.origin.url`.strip
@@ -141,8 +181,8 @@ task :github do
141 181
 end
142 182
 
143 183
 # See vm.rake for more information
144  
-desc "Build everything that needs to be built at default level."
145  
-task :build => ["build:build", "gem_bootstrap"]
  184
+desc "Build Rubinius"
  185
+task :build => %w[build:build gems:install]
146 186
 
147 187
 desc "Recompile all ruby system files"
148 188
 task :rebuild => %w[clean build]
@@ -204,30 +244,6 @@ namespace :clean do
204 244
   end
205 245
 end
206 246
 
207  
-desc 'Install the pre-installed gems'
208  
-task :gem_bootstrap do
209  
-  STDOUT.puts "Installing pre-installed gems..."
210  
-  ENV['GEM_HOME'] = ENV['GEM_PATH'] = nil
211  
-
212  
-  rbx = "#{BUILD_CONFIG[:bindir]}/#{BUILD_CONFIG[:program_name]}"
213  
-  gems = Dir["preinstalled-gems/*.gem"]
214  
-  options = "--local --conservative --ignore-dependencies --no-rdoc --no-ri"
215  
-
216  
-  BUILD_CONFIG[:version_list].each do |ver|
217  
-    gems.each do |gem|
218  
-      parts = File.basename(gem, ".gem").split "-"
219  
-      gem_name = parts[0..-2].join "-"
220  
-      gem_version = parts[-1]
221  
-
222  
-      system "#{rbx} -X#{ver} -S gem query --name-matches #{gem_name} --installed --version #{gem_version} > #{DEV_NULL}"
223  
-
224  
-      unless $?.success?
225  
-        sh "#{rbx} -X#{ver} -S gem install #{options} #{gem}"
226  
-      end
227  
-    end
228  
-  end
229  
-end
230  
-
231 247
 desc "Run the Rubinius documentation website"
232 248
 task :docs do
233 249
   require 'kernel/delta/options'
1  bin/gem
1  bin/irb
1  bin/rake
1  bin/rbx
10  bin/rbx-build
... ...
@@ -1,10 +0,0 @@
1  
-#!/bin/sh
2  
-
3  
-BIN_DIR=$(dirname $0)
4  
-BASE_DIR=$(dirname $BIN_DIR)
5  
-
6  
-export RBX_RUNTIME="$BASE_DIR/runtime"
7  
-export RBX_LIB="$BASE_DIR/lib"
8  
-export RBX_CAPI_DIR=$BASE_DIR
9  
-
10  
-exec $BIN_DIR/../vm/vm "$*"
1  bin/rdoc
1  bin/ri
1  bin/ruby
251  configure
@@ -19,6 +19,9 @@ class Configure
19 19
   def initialize(root)
20 20
     @log = Logger.new "configure.log"
21 21
 
  22
+    @command_line = ARGV.dup
  23
+    @log.log "Command line: #{@command_line.join(" ").inspect}"
  24
+
22 25
     @defines = []
23 26
     @config = File.join(root, "config.rb")
24 27
 
@@ -49,7 +52,6 @@ class Configure
49 52
     @rake = ENV['RAKE'] || 'rake'
50 53
     @tar = ENV['TAR'] || (@windows ? 'bsdtar' : 'tar')
51 54
     @perl = ENV['PERL'] || 'perl'
52  
-    @install = false
53 55
     @default_version = "18"
54 56
     @version_list = ["18", "19"]
55 57
     @supported_versions = ["18", "19", "20"]
@@ -98,22 +100,27 @@ class Configure
98 100
     @lib_dirs     = []
99 101
 
100 102
     # File system paths
101  
-    @bindir       = root + "/bin"
102  
-    @include18dir = root + "/vm/capi/18/include"
103  
-    @include19dir = root + "/vm/capi/19/include"
104  
-    @include20dir = root + "/vm/capi/19/include"
105  
-    @libdir       = root
106  
-    @runtime      = @libdir + "/runtime"
107  
-    @kernel_path  = @libdir + "/kernel"
108  
-    @lib_path     = @libdir + "/lib"
109  
-    @mandir       = root + "/man"
110  
-    @gemsdir      = root + "/gems"
111  
-
112  
-    # Some simple defaults for when running directly out of the build dir
113  
-    @sitedir      = @lib_path + "/site"
114  
-    @vendordir    = @lib_path + "/vendor"
  103
+    @sourcedir    = root
  104
+    @prefixdir    = nil
  105
+    @bindir       = nil
  106
+    @libdir       = nil
  107
+    @runtimedir   = nil
  108
+    @kerneldir    = nil
  109
+    @sitedir      = nil
  110
+    @vendordir    = nil
  111
+    @mandir       = nil
  112
+    @gemsdir      = nil
  113
+
  114
+    # TODO: fix this
  115
+    @include18dir = nil # root + "/vm/capi/18/include"
  116
+    @include19dir = nil # root + "/vm/capi/19/include"
  117
+    @include20dir = nil # root + "/vm/capi/19/include"
  118
+
  119
+    @preserve_prefix = false
115 120
 
116 121
     @program_name = "rbx"
  122
+    @bin_links = ["rbx", "ruby", "rake", "gem", "irb", "rdoc", "ri"]
  123
+    @use_bin_links = true
117 124
 
118 125
     # Library configuration
119 126
     @rb_readline = false
@@ -123,7 +130,7 @@ class Configure
123 130
     @libversion = "2.0"
124 131
     @version = "#{@libversion}.0dev"
125 132
     @release_date = "yyyy-mm-dd"
126  
-    @config_version = 158
  133
+    @config_version = 160
127 134
 
128 135
     # TODO: add conditionals for platforms
129 136
     if RbConfig::CONFIG["build_os"] =~ /darwin/
@@ -159,6 +166,55 @@ class Configure
159 166
     File.expand_path(path)
160 167
   end
161 168
 
  169
+  def expand_install_dir(dir)
  170
+    dir = expand dir
  171
+    if File.directory?(dir) and dir !~ /(rubinius|rbx).*\/?$/
  172
+      original = dir
  173
+      dir + "/rubinius/#{@libversion}"
  174
+      @log.write "The directory #{original} already exists, installing to #{dir}"
  175
+    end
  176
+    dir
  177
+  end
  178
+
  179
+  def set_filesystem_paths
  180
+    @prefixdir    = @sourcedir unless @prefixdir
  181
+    @bindir       = @prefixdir + "/bin" unless @bindir
  182
+    @libdir       = @prefixdir + "/lib" unless @libdir
  183
+    @runtimedir   = @prefixdir + "/runtime" unless @runtimedir
  184
+    @kerneldir    = @prefixdir + "/kernel" unless @kerneldir
  185
+    @sitedir      = @prefixdir + "/site" unless @sitedir
  186
+    @vendordir    = @prefixdir + "/vendor" unless @vendordir
  187
+    @mandir       = @prefixdir + "/man" unless @mandir
  188
+    @gemsdir      = @prefixdir + "/gems" unless @gemsdir
  189
+    @include18dir = @prefixdir + "/vm/capi/18/include" unless @include18dir
  190
+    @include19dir = @prefixdir + "/vm/capi/19/include" unless @include19dir
  191
+    @include20dir = @prefixdir + "/vm/capi/19/include" unless @include20dir
  192
+
  193
+    dirs = [@bindir, @libdir, @runtimedir, @kerneldir, @sitedir, @vendordir,
  194
+            @mandir, @gemsdir, @include18dir, @include19dir, @include20dir]
  195
+
  196
+    parts = dirs.map { |d| d.split "/" }
  197
+
  198
+    i = 0
  199
+    total = parts[0].size
  200
+    prefix = []
  201
+
  202
+    while i < total
  203
+      part = parts[0][i]
  204
+      break unless parts.all? { |p| p[i] == part }
  205
+      prefix << part
  206
+      i += 1
  207
+    end
  208
+
  209
+    @prefixdir = prefix.join "/"
  210
+    size = @prefixdir.size
  211
+
  212
+    dirs.each { |d| d.replace d[size..-1] }
  213
+
  214
+    @stagingdir = "#{@sourcedir}/staging" unless @prefixdir == @sourcedir
  215
+    @stagingdir = File.join @stagingdir, @prefixdir if @preserve_prefix
  216
+  end
  217
+
162 218
   def options
163 219
     o = Rubinius::Options.new "Usage: configure [options]", 30
164 220
     o.left_align
@@ -269,77 +325,68 @@ class Configure
269 325
       @libc = name
270 326
     end
271 327
 
272  
-    o.doc "\n File system paths for installing Rubinius"
  328
+    o.doc "\n Program names"
273 329
 
274  
-    o.on "-P", "--prefix", "PATH", "Install Rubinius in subdirectories of PATH" do |dir|
275  
-      @install = true
276  
-      dir = File.expand_path dir
  330
+    o.on "--program-name", "NAME", "Build Rubinius executable as NAME" do |name|
  331
+      @program_name = name
  332
+    end
277 333
 
278  
-      if !ENV['RELEASE'] and File.directory? dir and dir !~ /(rubinius|rbx).*\/?$/
279  
-        old = dir
280  
-        dir += "/rubinius/#{@libversion}"
281  
-        @log.write "The directory #{old} already exists, installing to #{dir}"
282  
-      end
  334
+    o.on "--bin-link", "NAME", "Create NAME as binary symlink to program name" do |name|
  335
+      @bin_links << name
  336
+    end
283 337
 
284  
-      @bindir       = dir + "/bin"
285  
-      @include18dir = dir + "/18/include"
286  
-      @include19dir = dir + "/19/include"
287  
-      @include20dir = dir + "/19/include"
288  
-      @libdir       = dir
289  
-      @runtime      = @libdir + "/runtime"
290  
-      @kernel_path  = @libdir + "/kernel"
291  
-      @lib_path     = @libdir + "/lib"
292  
-      @mandir       = dir + "/man"
293  
-      @gemsdir      = dir + "/gems"
  338
+    o.on "--no-bin-links", "Do not create any symlinks to program name" do
  339
+      @use_bin_links = false
  340
+    end
294 341
 
295  
-      @sitedir      = dir + "/site"
296  
-      @vendordir    = dir + "/vendor"
  342
+    o.doc "\n File system paths for installing Rubinius"
  343
+
  344
+    o.on "-P", "--prefix", "PATH", "Install Rubinius in subdirectories of PATH" do |dir|
  345
+      @prefixdir = expand_install_dir dir
297 346
     end
298 347
 
299 348
     o.on "-B", "--bindir", "PATH", "Install Rubinius executable in PATH" do |dir|
300  
-      @install = true
301 349
       @bindir = expand dir
302 350
     end
303 351
 
304 352
     o.on "-I", "--includedir", "PATH", "Install Rubinius C-API include files in PATH" do |dir|
305  
-      @install = true
306  
-      path = expand dir
307  
-      @include18dir = path + "/18"
308  
-      @include19dir = path + "/19"
309  
-      @include20dir = path + "/20"
  353
+      dir = expand dir
  354
+      @include18dir = dir + "/18"
  355
+      @include19dir = dir + "/19"
  356
+      @include20dir = dir + "/20"
310 357
     end
311 358
 
312 359
     o.on "-L", "--libdir", "PATH", "Install Ruby library in PATH" do |dir|
313  
-      @install      = true
314  
-      @libdir       = expand(dir) + "/rubinius/#{@libversion}"
315  
-      @runtime      = @libdir + "/runtime"
316  
-      @kernel_path  = @libdir + "/kernel"
317  
-      @lib_path     = @libdir + "/lib"
  360
+      dir = expand_install_dir dir
318 361
 
319  
-      @sitedir      = @libdir + "/site"
320  
-      @vendordir    = @libdir + "/vendor"
  362
+      @libdir       = dir
  363
+      @runtime      = dir + "/runtime"
  364
+      @kernel_path  = dir + "/kernel"
  365
+      @lib_path     = dir + "/lib"
  366
+      @sitedir      = dir + "/site"
  367
+      @vendordir    = dir + "/vendor"
321 368
     end
322 369
 
323 370
     o.on "-M", "--mandir", "PATH", "Install man pages in PATH" do |dir|
324  
-      @install = true
325 371
       @mandir = expand dir
326 372
     end
327 373
 
328 374
     o.on "-G", "--gemsdir", "PATH", "Install gems in PATH" do |dir|
329  
-      @install = true
330 375
       @gemsdir = expand dir
331 376
     end
332 377
 
333 378
     o.on "--sitedir", "PATH", "Install site-specific Ruby code in PATH" do |dir|
334  
-      @install = true
335 379
       @sitedir = expand dir
336 380
     end
337 381
 
338 382
     o.on "--vendordir", "PATH", "Install vendor-specific Ruby code in PATH" do |dir|
339  
-      @install = true
340 383
       @vendordir = expand dir
341 384
     end
342 385
 
  386
+    o.on "--preserve-prefix", "Use the configure prefix for staging Rubinius to install" do
  387
+      @preserve_prefix = true
  388
+    end
  389
+
343 390
     o.doc "\n Optional features"
344 391
 
345 392
     @options = o
@@ -1185,15 +1232,19 @@ int main() { return tgetnum(""); }
1185 1232
   # Checks whether the given config file is a Perl script by checking its first
1186 1233
   # line for a Perl hashbang.
1187 1234
   def llvm_config_cmd(config)
1188  
-    first_line = File.open(config).lines.first
1189  
-    if first_line =~ /^#! ?\/usr(\/local)?\/bin\/(env )?perl/
1190  
-      "#{@perl} #{config}"
1191  
-    else
  1235
+    begin
  1236
+      File.open(config, "r") do |f|
  1237
+        first_line = f.readline
  1238
+        if first_line =~ /^#! ?\/usr(\/local)?\/bin\/(env )?perl/
  1239
+          "#{@perl} #{config}"
  1240
+        else
  1241
+          config
  1242
+        end
  1243
+      end
  1244
+    rescue Errno::ENOENT, ArgumentError
  1245
+      # The file doesn't exist (ENOENT) or it's a binary file (ArgumentError).
1192 1246
       config
1193 1247
     end
1194  
-  rescue Errno::ENOENT, ArgumentError
1195  
-    # The file doesn't exist (ENOENT) or it's a binary file (ArgumentError).
1196  
-    config
1197 1248
   end
1198 1249
 
1199 1250
   def get_system_name
@@ -1262,12 +1313,16 @@ int main() { return tgetnum(""); }
1262 1313
       @llvm_configure = ""
1263 1314
     end
1264 1315
 
  1316
+    @bin_links.delete @program_name
  1317
+
1265 1318
     # Write the config file used by the build system and rbconfig.rb.
1266 1319
     File.open @config, "wb" do |f|
1267 1320
       # TODO: Make this the actual data structure that is written out.
1268 1321
       f.puts <<-EOC
1269 1322
 module Rubinius
  1323
+  # Make this reload friendly without silly constant defined warnings.
1270 1324
   BUILD_CONFIG = {
  1325
+    :command_line   => #{@command_line.join(" ").inspect},
1271 1326
     :which_ruby     => :#{which_ruby},
1272 1327
     :build_ruby     => "#{build_ruby}",
1273 1328
     :build_rake     => "#{@rake}",
@@ -1292,19 +1347,23 @@ module Rubinius
1292 1347
     :x86_32         => #{@x86_32},
1293 1348
     :x86_64         => #{@x86_64},
1294 1349
     :fibers         => #{@fibers},
  1350
+    :sourcedir      => "#{@sourcedir}",
  1351
+    :stagingdir     => #{@stagingdir.inspect},
  1352
+    :prefixdir      => "#{@prefixdir}",
1295 1353
     :bindir         => "#{@bindir}",
1296 1354
     :libdir         => "#{@libdir}",
1297  
-    :runtime        => "#{@runtime}",
1298  
-    :kernel_path    => "#{@kernel_path}",
1299  
-    :lib_path       => "#{@lib_path}",
  1355
+    :runtimedir     => "#{@runtimedir}",
  1356
+    :kerneldir      => "#{@kerneldir}",
  1357
+    :sitedir        => "#{@sitedir}",
  1358
+    :vendordir      => "#{@vendordir}",
1300 1359
     :include18dir   => "#{@include18dir}",
1301 1360
     :include19dir   => "#{@include19dir}",
1302 1361
     :include20dir   => "#{@include20dir}",
1303 1362
     :mandir         => "#{@mandir}",
1304 1363
     :gemsdir        => "#{@gemsdir}",
1305  
-    :sitedir        => "#{@sitedir}",
1306  
-    :vendordir      => "#{@vendordir}",
1307 1364
     :program_name   => "#{@program_name}",
  1365
+    :bin_links      => #{@bin_links.inspect},
  1366
+    :use_bin_links  => #{@use_bin_links},
1308 1367
     :version        => "#{@version}",
1309 1368
     :libversion     => "#{@libversion}",
1310 1369
     :release_date   => "#{@release_date}",
@@ -1335,11 +1394,12 @@ end
1335 1394
 #define RBX_CPU              "#{@cpu}"
1336 1395
 #define RBX_VENDOR           "#{@vendor}"
1337 1396
 #define RBX_OS               "#{@os}"
  1397
+#define RBX_PREFIX_PATH      "#{@prefixdir}"
1338 1398
 #define RBX_BIN_PATH         "#{@bindir}"
1339 1399
 #define RBX_GEMS_PATH        "#{@gemsdir}"
1340  
-#define RBX_RUNTIME          "#{@runtime}"
1341  
-#define RBX_KERNEL_PATH      "#{@kernel_path}"
1342  
-#define RBX_LIB_PATH         "#{@lib_path}"
  1400
+#define RBX_RUNTIME_PATH     "#{@runtimedir}"
  1401
+#define RBX_KERNEL_PATH      "#{@kerneldir}"
  1402
+#define RBX_LIB_PATH         "#{@libdir}"
1343 1403
 #define RBX_HDR18_PATH       "#{@include18dir}"
1344 1404
 #define RBX_HDR19_PATH       "#{@include19dir}"
1345 1405
 #define RBX_HDR20_PATH       "#{@include20dir}"
@@ -1354,12 +1414,6 @@ end
1354 1414
 #define RBX_LIBC             "#{@libc}"
1355 1415
       EOC
1356 1416
 
1357  
-      if @vendor_zlib
1358  
-        f.puts %[#define RBX_ZLIB_PATH        "#{@lib_path}/zlib/"]
1359  
-      else
1360  
-        f.puts %[#define RBX_ZLIB_PATH        ""]
1361  
-      end
1362  
-
1363 1417
       @supported_versions.each do |ver|
1364 1418
         f.puts "#define RBX_DEFAULT_#{ver}       #{ver == @default_version}"
1365 1419
       end
@@ -1594,6 +1648,8 @@ end
1594 1648
     options
1595 1649
     parse ARGV
1596 1650
 
  1651
+    set_filesystem_paths
  1652
+
1597 1653
     if File.join(@bindir, @program_name) == build_ruby
1598 1654
       @log.error "\nYou are attempting to build using the instance of Rubinius that you are building.\n\n"
1599 1655
 
@@ -1630,19 +1686,48 @@ irc.freenode.net and provide the following system information:
1630 1686
       EOM
1631 1687
     end
1632 1688
 
1633  
-    if @install
1634  
-      @log.write "\nConfigured. Run 'rake install' to install Rubinius."
  1689
+    unless @stagingdir
  1690
+      build_msg = <<-EOM
  1691
+Rubinius has been configured.
  1692
+
  1693
+Run 'rake' to build and test Rubinius.
  1694
+      EOM
1635 1695
     else
1636  
-      @log.write <<-EOM
  1696
+      build_msg = <<-EOM
  1697
+Rubinius has been configured for the following paths:
  1698
+
  1699
+prefix:  #{@prefixdir}
  1700
+bin:     #{@bindir}
  1701
+lib:     #{@libdir}
  1702
+runtime: #{@runtimedir}
  1703
+kernel:  #{@kerneldir}
  1704
+site:    #{@sitedir}
  1705
+vendor:  #{@vendordir}
  1706
+man:     #{@mandir}
  1707
+gems:    #{@gemsdir}
  1708
+
  1709
+Run 'rake' to build, test and install Rubinius.
  1710
+      EOM
  1711
+    end
  1712
+
  1713
+    links = (@bin_links + [@program_name]).uniq
1637 1714
 
1638  
-Configured. Run 'rake' to build and run VM tests and rubyspecs.
  1715
+    @log.write <<-EOM
  1716
+------------------------------------------------------------------
1639 1717
 
1640  
-After building, you may add '#{@bindir}' to your PATH or run commands directly from that directory. Available commands are:
  1718
+#{build_msg}
  1719
+After building, you may add
1641 1720
 
1642  
-  #{@program_name}, ruby, rake, gem, irb, rdoc, ri
  1721
+'#{@prefixdir}#{@bindir}'
1643 1722
 
1644  
-      EOM
1645  
-    end
  1723
+to your PATH or run commands directly from that directory.
  1724
+
  1725
+Available commands are:
  1726
+
  1727
+  #{links.join(", ")}
  1728
+
  1729
+------------------------------------------------------------------
  1730
+    EOM
1646 1731
   end
1647 1732
 
1648 1733
   # Handles user output and logging while running configure.
4  kernel/bootstrap/proc.rb
@@ -2,6 +2,10 @@
2 2
 
3 3
 class Proc
4 4
   def self.allocate
  5
+    raise TypeError, "allocator undefined for Proc"
  6
+  end
  7
+
  8
+  def self.__allocate__
5 9
     Rubinius.primitive :proc_allocate
6 10
     raise PrimitiveFailure, "Proc#allocate failed"
7 11
   end
1  kernel/bootstrap/thread.rb
@@ -162,6 +162,7 @@ def kill
162 162
     @dying = true
163 163
     @sleep = false
164 164
     self.raise Die
  165
+    self
165 166
   end
166 167
 
167 168
   alias_method :exit, :kill
10  kernel/common/array.rb
@@ -935,16 +935,6 @@ def drop(n)
935 935
     new_range n, new_size
936 936
   end
937 937
 
938  
-  def shuffle!
939  
-    Rubinius.check_frozen
940  
-
941  
-    size.times do |i|
942  
-      r = i + Kernel.rand(size - i)
943  
-      @tuple.swap(@start + i, @start + r)
944  
-    end
945  
-    self
946  
-  end
947  
-
948 938
   def sort(&block)
949 939
     dup.sort_inplace(&block)
950 940
   end
10  kernel/common/array18.rb
@@ -379,6 +379,16 @@ def shuffle
379 379
     dup.shuffle!
380 380
   end
381 381
 
  382
+  def shuffle!
  383
+    Rubinius.check_frozen
  384
+
  385
+    size.times do |i|
  386
+      r = i + Kernel.rand(size - i)
  387
+      @tuple.swap(@start + i, @start + r)
  388
+    end
  389
+    self
  390
+  end
  391
+
382 392
   def slice!(start, length=undefined)
383 393
     Rubinius.check_frozen
384 394
 
42  kernel/common/array19.rb
@@ -449,17 +449,26 @@ def rotate!(cnt=1)
449 449
     replace ary
450 450
   end
451 451
 
452  
-  def sample(n=undefined)
453  
-    return at(Kernel.rand(size)) if n.equal? undefined
  452
+  def sample(*args)
  453
+    random_generator = Kernel
  454
+    n = nil
454 455
 
455  
-    n = Rubinius::Type.coerce_to(n, Fixnum, :to_int)
456  
-    raise ArgumentError, "negative array size" if n < 0
  456
+    args.each do |a|
  457
+      if options = Rubinius::Type.check_convert_type(a, Hash, :to_hash)
  458
+        random_generator = options[:random] if options[:random].respond_to?(:rand)
  459
+      else
  460
+        n = Rubinius::Type.coerce_to(a, Fixnum, :to_int)
  461
+        raise ArgumentError, "negative array size" if n < 0
  462
+      end
  463
+    end
  464
+
  465
+    return at(random_generator.rand(size)) unless n
457 466
 
458 467
     n = size if n > size
459 468
     result = Array.new(self)
460 469
 
461 470
     n.times do |i|
462  
-      r = i + Kernel.rand(size - i)
  471
+      r = i + random_generator.rand(size - i)
463 472
       result.tuple.swap(i, r)
464 473
     end
465 474
 
@@ -476,9 +485,26 @@ def select!(&block)
476 485
     replace ary unless size == ary.size
477 486
   end
478 487
 
479  
-  def shuffle
480  
-    return dup.shuffle! if instance_of? Array
481  
-    Array.new(self).shuffle!
  488
+  def shuffle(options = undefined)
  489
+    return dup.shuffle!(options) if instance_of? Array
  490
+    Array.new(self).shuffle!(options)
  491
+  end
  492
+
  493
+  def shuffle!(options = undefined)
  494
+    Rubinius.check_frozen
  495
+
  496
+    random_generator = Kernel
  497
+
  498
+    unless options.equal? undefined
  499
+      options = Rubinius::Type.coerce_to options, Hash, :to_hash
  500
+      random_generator = options[:random] if options[:random].respond_to?(:rand)
  501
+    end
  502
+
  503
+    size.times do |i|
  504
+      r = i + random_generator.rand(size - i)
  505
+      @tuple.swap(@start + i, @start + r)
  506
+    end
  507
+    self
482 508
   end
483 509
 
484 510
   def slice!(start, length=undefined)
14  kernel/common/binding.rb
@@ -6,7 +6,7 @@ class Binding
6 6
   attr_accessor :constant_scope
7 7
   attr_accessor :proc_environment
8 8
   attr_accessor :self
9  
-  attr_accessor :line_number
  9
+  attr_accessor :location
10 10
 
11 11
   def from_proc?
12 12
     @proc_environment
@@ -30,16 +30,24 @@ def self.setup(variables, code, constant_scope, recv=nil, location=nil)
30 30
     bind.variables = variables
31 31
     bind.code = code
32 32
     bind.constant_scope = constant_scope
33  
-    bind.line_number = location ? location.line : 1
  33
+    bind.location = location
34 34
 
35 35
     return bind
36 36
   end
37 37
 
  38
+  def line_number
  39
+    if proc_environment
  40
+      proc_environment.line
  41
+    else
  42
+      location ? location.line : 1
  43
+    end
  44
+  end
  45
+
38 46
   # Evaluates the Ruby expression(s) in string, in the binding‘s context.
39 47
   # If the optional filename and lineno parameters are present,
40 48
   # they will be used when reporting syntax errors.
41 49
   def eval(expr, filename=nil, lineno=nil)
42  
-    lineno ||= filename ? 1 : self.line_number
  50
+    lineno ||= filename ? 1 : line_number
43 51
 
44 52
     Kernel.eval(expr, self, filename, lineno)
45 53
   end
5  kernel/common/codeloader.rb
@@ -230,9 +230,8 @@ def require(name)
230 230
 
231 231
     # Returns true if the path exists, is a regular file, and is readable.
232 232
     def loadable?(path)
233  
-      return false unless File.exists? path
234  
-
235  
-      @stat = File.stat path
  233
+      @stat = File::Stat.stat path
  234
+      return false unless @stat
236 235
       @stat.file? and @stat.readable?
237 236
     end
238 237
 
7  kernel/common/eval.rb
@@ -45,9 +45,10 @@ def binding
45 45
 
46 46
   # Evaluate and execute code given in the String.
47 47
   #
48  
-  def eval(string, binding=nil, filename=nil, lineno=1)
  48
+  def eval(string, binding=nil, filename=nil, lineno=nil)
49 49
     filename = StringValue(filename) if filename
50  
-    lineno = Rubinius::Type.coerce_to lineno, Fixnum, :to_i
  50
+    lineno = Rubinius::Type.coerce_to lineno, Fixnum, :to_i if lineno
  51
+    lineno = 1 if filename && !lineno
51 52
 
52 53
     if binding
53 54
       binding = Rubinius::Type.coerce_to_binding binding
@@ -61,6 +62,8 @@ def eval(string, binding=nil, filename=nil, lineno=1)
61 62
       filename ||= "(eval)"
62 63
     end
63 64
 
  65
+    lineno ||= binding.line_number
  66
+
64 67
     existing_scope = binding.constant_scope
65 68
     binding.constant_scope = existing_scope.dup
66 69
 
4  kernel/common/exception.rb
@@ -400,7 +400,9 @@ class << self
400 400
     alias_method :exception, :new
401 401
   end
402 402
 
403  
-  def initialize(message, errno)
  403
+  # Use splat args here so that arity returns -1 to match MRI.
  404
+  def initialize(*args)
  405
+    message, errno = args
404 406
     @errno = errno
405 407
 
406 408
     msg = "unknown error"
68  kernel/common/io19.rb
@@ -292,6 +292,10 @@ def autoclose?
292 292
     @autoclose
293 293
   end
294 294
 
  295
+  def autoclose=(autoclose)
  296
+    @autoclose = !!autoclose
  297
+  end
  298
+
295 299
   # Argument matrix for IO#gets and IO#each:
296 300
   #
297 301
   #  separator / limit | nil | >= 0 | < 0
@@ -552,10 +556,18 @@ def set_encoding(external, internal=nil)
552 556
 
553 557
     if external.kind_of? String
554 558
       external, internal = external.split(':') unless internal
  559
+      if external.downcase.start_with? "bom|"
  560
+        use_bom = true
  561
+        external = external.gsub /\Abom\|/i, ""
  562
+      end
555 563
     end
556 564
 
557 565
     internal = nil if internal == "-"
558 566
 
  567
+    if use_bom && encoding = strip_bom
  568
+      external = encoding
  569
+    end
  570
+
559 571
     external = Encoding.find external if external.kind_of? String
560 572
     internal = Encoding.find internal if internal.kind_of? String
561 573
 
@@ -563,6 +575,62 @@ def set_encoding(external, internal=nil)
563 575
     @internal = internal unless internal == external
564 576
   end
565 577
 
  578
+  def strip_bom
  579
+    chars = []
  580
+    chars << (c = getc)
  581
+
  582
+    if c == 0x00
  583
+      chars << (c = getc)
  584
+      if c == 0x00
  585
+        chars << (c = getc)
  586
+        if c == 0xFE
  587
+          chars << (c = getc)
  588
+          if c == 0xFF
  589
+            return "UTF-32BE"
  590
+          end
  591
+        end
  592
+      end
  593
+    end
  594
+
  595
+    if c == 0xFF
  596
+      chars << (c = getc)
  597
+      if c == 0xFE
  598
+        chars << (c = getc)
  599
+        if c == 0x00
  600
+          chars << (c = getc)
  601
+          if c == 0x00
  602
+            return "UTF-32LE"
  603
+          end
  604
+        else
  605
+          ungetc c
  606
+          return "UTF-16LE"
  607
+        end
  608
+      end
  609
+    end
  610
+
  611
+    if c == 0xFE
  612
+      chars << (c = getc)
  613
+      if c == 0xFF
  614
+        return "UTF-16BE"
  615
+      end
  616
+    end
  617
+
  618
+    if c == 0xEF
  619
+      chars << (c = getc)
  620
+      if c == 0xBB
  621
+        chars << (c = getc)
  622
+        if c == 0xBF
  623
+          return "UTF-8"
  624
+        end
  625
+      end
  626
+    end
  627
+
  628
+    chars.reverse_each do |c|
  629
+      ungetc c
  630
+    end
  631
+    nil
  632
+  end
  633
+
566 634
   def external_encoding
567 635
     @external
568 636
   end
1  kernel/common/math19.rb
@@ -68,6 +68,7 @@ def lgamma(x)
68 68
     end
69 69
 
70 70
     FFI::MemoryPointer.new :int do |sign|
  71
+      sign.write_int 1
71 72
       result = FFI::Platform::Math.lgamma_r x, sign
72 73
       [result, sign.read_int]
73 74
     end
2  kernel/common/module19.rb
@@ -107,6 +107,8 @@ def autoload(name, path)
107 107
     end
108 108
 
109 109
     constant_table[name] = Autoload.new(name, self, path)
  110
+    Object.singleton_class.constant_table[name] = constant_table[name] if self == Kernel
  111
+
110 112
     Rubinius.inc_global_serial
111 113
     return nil
112 114
   end
23  kernel/common/proc.rb
@@ -109,6 +109,29 @@ def to_proc
109 109
   alias_method :[], :call
110 110
   alias_method :yield, :call
111 111
 
  112
+  def clone
  113
+    copy = self.class.__allocate__
  114
+    Rubinius.invoke_primitive :object_copy_object, copy, self
  115
+    Rubinius.invoke_primitive :object_copy_singleton_class, copy, self
  116
+
  117
+    Rubinius.privately do
  118
+      copy.initialize_copy self
  119
+    end
  120
+
  121
+    copy.freeze if frozen?
  122
+    copy
  123
+  end
  124
+
  125
+  def dup
  126
+    copy = self.class.__allocate__
  127
+    Rubinius.invoke_primitive :object_copy_object, copy, self
  128
+
  129
+    Rubinius.privately do
  130
+      copy.initialize_copy self
  131
+    end
  132
+    copy
  133
+  end
  134
+
112 135
   class Method < Proc
113 136
     attr_accessor :bound_method
114 137
 
2  kernel/common/proc18.rb
@@ -9,7 +9,7 @@ def to_s
9 9
 
10 10
   class Method < Proc
11 11
     def self.__from_method__(meth)
12  
-      obj = allocate()
  12
+      obj = __allocate__
13 13
       obj.bound_method = meth
14 14
 
15 15
       return obj
2  kernel/common/proc19.rb
@@ -62,7 +62,7 @@ def to_s
62 62
 
63 63
   class Method < Proc 
64 64
     def self.__from_method__(meth)
65  
-      obj = allocate()
  65
+      obj = __allocate__
66 66
       obj.bound_method = meth
67 67
       obj.lambda_style!
68 68
 
2  kernel/delta/rubinius.rb
@@ -273,6 +273,6 @@ def self.allocation_site(obj)
273 273
   #
274 274
   def self.current_file
275 275
     cs = Rubinius::ConstantScope.of_sender
276  
-    return ss.absolute_active_path
  276
+    return cs.absolute_active_path
277 277
   end
278 278
 end
20  kernel/loader.rb
@@ -77,25 +77,7 @@ def preamble
77 77
     def system_load_path
78 78
       @stage = "setting up system load path"
79 79
 
80  
-      if env_lib = ENV['RBX_LIB'] and File.exists?(env_lib)
81  
-        @main_lib = File.expand_path(env_lib)
82  
-      else
83  
-        # use configured library path and check its existence
84  
-        @main_lib = Rubinius::LIB_PATH
85  
-
86  
-        unless File.exists?(@main_lib)
87  
-          STDERR.puts <<-EOM
88  
-Rubinius was configured to find standard library files at:
89  
-
90  
-  #{@main_lib}
91  
-
92  
-but that directory does not exist.
93  
-
94  
-Set the environment variable RBX_LIB to the directory
95  
-containing the Rubinius standard library files.
96  
-          EOM
97  
-        end
98  
-      end
  80
+      @main_lib = Rubinius::LIB_PATH
99 81
 
100 82
       @main_lib_bin = File.join @main_lib, "bin"
101 83
       Rubinius.const_set :PARSER_EXT_PATH, "#{@main_lib}/ext/melbourne/rbx/melbourne20"
2  lib/18/mkmf.rb
@@ -1722,7 +1722,7 @@ def init_mkmf(config = CONFIG)
1722 1722
   # that built in extensions will also find them if they have been configured
1723 1723
   # at build time for Rubinius.
1724 1724
   Rubinius::BUILD_CONFIG[:include_dirs].each do |inc|
1725  
-    $INCFLAGS << inc
  1725
+    $INCFLAGS << " -I#{inc.quote}"
1726 1726
   end
1727 1727
   Rubinius::BUILD_CONFIG[:lib_dirs].each do |lib|
1728 1728
     $DEFLIBPATH << lib
4  lib/18/net/ftp.rb
@@ -346,9 +346,9 @@ def transfercmd(cmd, rest_offset = nil)
346 346
     private :transfercmd
347 347
     
348 348
     def getaddress
349  
-      thishost = Socket.gethostname
  349
+      thishost = Socket.gethostname rescue ""
350 350
       if not thishost.index(".")
351  
-	thishost = Socket.gethostbyname(thishost)[0]
  351
+        thishost = Socket.gethostbyname(thishost)[0] rescue ""
352 352
       end
353 353
       if ENV.has_key?("LOGNAME")
354 354
 	realuser = ENV["LOGNAME"]
21  lib/18/net/http.rb
@@ -22,7 +22,7 @@
22 22
 # http://www.ruby-lang.org/ja/man/?cmd=view;name=net%2Fhttp.rb
23 23
 #
24 24
 #--
25  
-# $Id: http.rb 13657 2007-10-08 11:16:54Z gotoyuzo $
  25
+# $Id$
26 26
 #++
27 27
 
28 28
 require 'net/protocol'
@@ -278,7 +278,7 @@ class HTTPHeaderSyntaxError < StandardError; end
278 278
   class HTTP < Protocol
279 279
 
280 280
     # :stopdoc:
281  
-    Revision = %q$Revision: 13657 $.split[1]
  281
+    Revision = %q$Revision$.split[1]
282 282
     HTTPVersion = '1.1'
283 283
     @newimpl = true
284 284
     # :startdoc:
@@ -1044,7 +1044,8 @@ def request(req, body = nil, &block)  # :yield: +response+
1044 1044
       end
1045 1045
 
1046 1046
       req.set_body_internal body
1047  
-      begin_transport req
  1047
+      begin
  1048
+        begin_transport req
1048 1049
         req.exec @socket, @curr_http_version, edit_path(req.path)
1049 1050
         begin
1050 1051
           res = HTTPResponse.read_new(@socket)
@@ -1052,7 +1053,12 @@ def request(req, body = nil, &block)  # :yield: +response+
1052 1053
         res.reading_body(@socket, req.response_body_permitted?) {
1053 1054
           yield res if block_given?
1054 1055
         }
1055  
-      end_transport req, res
  1056
+        end_transport req, res
  1057
+      rescue => exception
  1058
+        D "Conn close because of error #{exception}"
  1059
+        @socket.close if @socket and not @socket.closed?
  1060
+        raise exception
  1061
+      end
1056 1062
 
1057 1063
       res
1058 1064
     end
@@ -1224,6 +1230,7 @@ def each_header   #:yield: +key+, +value+
1224 1230
 
1225 1231
     # Iterates for each header names.
1226 1232
     def each_name(&block)   #:yield: +key+
  1233
+      return to_enum(__method__) unless block_given?
1227 1234
       @header.each_key(&block)
1228 1235
     end
1229 1236
 
@@ -1467,6 +1474,8 @@ class HTTPGenericRequest
1467 1474
 
1468 1475
     include HTTPHeader
1469 1476
 
  1477
+    BUFSIZE = 16*1024
  1478
+
1470 1479
     def initialize(m, reqbody, resbody, path, initheader = nil)
1471 1480
       @method = m
1472 1481
       @request_has_body = reqbody
@@ -1552,12 +1561,12 @@ def send_request_with_body_stream(sock, ver, path, f)
1552 1561
       supply_default_content_type
1553 1562
       write_header sock, ver, path
1554 1563
       if chunked?
1555  
-        while s = f.read(1024)
  1564
+        while s = f.read(BUFSIZE)
1556 1565
           sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
1557 1566
         end
1558 1567
         sock.write "0\r\n\r\n"
1559 1568
       else
1560  
-        while s = f.read(1024)
  1569
+        while s = f.read(BUFSIZE)
1561 1570
           sock.write s
1562 1571
         end
1563 1572
       end
2  lib/18/net/https.rb
@@ -16,7 +16,7 @@
16 16
   You can get it from RAA or Ruby's CVS repository.
17 17
 
18 18
 == Version