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

ruby-changes:14318

From: nahi <ko1@a...>
Date: Tue, 22 Dec 2009 11:01:47 +0900 (JST)
Subject: [ruby-changes:14318] Ruby:r26146 (ruby_1_8): * test/net/http/test_post_io.rb: parse chunked stream to avoid client

nahi	2009-12-22 11:01:34 +0900 (Tue, 22 Dec 2009)

  New Revision: 26146

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26146

  Log:
    * test/net/http/test_post_io.rb: parse chunked stream to avoid client 
              side connection error raised.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/test/net/http/test_post_io.rb

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 26145)
+++ ruby_1_8/ChangeLog	(revision 26146)
@@ -1,3 +1,8 @@
+Tue Dec 22 10:59:56 2009  NAKAMURA, Hiroshi  <nahi@r...>
+
+	* test/net/http/test_post_io.rb: parse chunked stream to avoid client
+	  side connection error raised.
+
 Mon Dec 21 15:27:48 2009  NAKAMURA, Hiroshi  <nahi@r...>
 
 	* ext/stringio/stringio.c (strio_getline): fix for "" as separator.
Index: ruby_1_8/test/net/http/test_post_io.rb
===================================================================
--- ruby_1_8/test/net/http/test_post_io.rb	(revision 26145)
+++ ruby_1_8/test/net/http/test_post_io.rb	(revision 26146)
@@ -14,7 +14,7 @@
           req.body_stream = StringIO.new("\0" * (16 * 1024 + 1))
           http = Net::HTTP.new("127.0.0.1", port)
           res = http.start { |http| http.request(req) }
-        rescue EOFError, Errno::EPIPE
+        rescue EOFError
         end
       }
       sock = serv.accept
@@ -22,6 +22,12 @@
         assert_match(/chunked/, sock.gets("\r\n\r\n"))
         chunk_header = sock.gets.chomp
         assert_equal(16 * 1024, chunk_header.to_i(16))
+        sock.read(chunk_header.to_i(16))
+        # parse chunked stream to the end
+        assert_equal("\r\n", sock.read(2))
+        assert_equal("1\r\n", sock.read(3))
+        assert_equal("\0\r\n", sock.read(3))
+        assert_equal("0\r\n\r\n", sock.read(5))
       ensure
         sock.close
       end

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

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