[#26966] Time & Date — " たけ (tk)" <ggb03124@...>

Time と Date についていくつか質問させてください。

29 messages 2001/01/01
[#26975] Re: Time & Date — Tadayoshi Funaba <tadf@...> 2001/01/03

ふなばです。

[#26976] Re: Time & Date — " たけ (tk)" <ggb03124@...> 2001/01/04

たけ(tk)です。

[#26979] Re: Time & Date — Tadayoshi Funaba <tadf@...> 2001/01/04

ふなばです。

[#26983] Re: Time & Date — " たけ (tk)" <ggb03124@...> 2001/01/04

たけ(tk)です。

[#26985] Re: Time & Date — matz@... (Yukihiro Matsumoto) 2001/01/04

まつもと ゆきひろです

[#26990] Re: Time & Date — " たけ (tk)" <ggb03124@...> 2001/01/05

たけ(tk)です。

[#27006] $= — "TAKAGI, Hiromitsu" <takagi@...>

ごぶさたです。

52 messages 2001/01/05
[#27008] Re: $= — Koji Arai <JCA02266@...> 2001/01/05

新井です。

[#27109] Re: $= — Koji Arai <JCA02266@...> 2001/01/13

新井です。

[#27111] RWiki (Re: $=) — WATANABE Hirofumi <eban@...> 2001/01/14

わたなべです.

[#27114] Re: RWiki (Re: $=) — Koji Arai <JCA02266@...> 2001/01/14

新井です。

[#27116] Re: RWiki (Re: $=) — rubikitch <rubikitch@...> 2001/01/14

From: Koji Arai <JCA02266@nifty.ne.jp>

[#27118] Re: RWiki (Re: $=) — Koji Arai <JCA02266@...> 2001/01/14

新井です。

[#27121] Re: RWiki (Re: $=) — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/01/14

なひです。

[#27129] Re: RWiki (Re: $=) — matz@... (Yukihiro Matsumoto) 2001/01/14

まつもと ゆきひろです

[#27133] Re: RWiki (Re: $=) — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/01/14

なひです。

[#27061] Ruby/Python with ruby 1.6.2 — akira yamada / やまだあきら <akira@...>

13 messages 2001/01/09

[#27219] do ... end & { ... } — "K.Kosako" <kosako@...>

ブロックを構成するdo ... end と{ ... } の違いについて、

17 messages 2001/01/18
[#27220] Re: do ... end & { ... } — Yasushi Shoji <yashi@...> 2001/01/18

At Thu, 18 Jan 2001 13:32:24 +0900,

[#27221] Re: do ... end & { ... } — matz@... (Yukihiro Matsumoto) 2001/01/18

まつもと ゆきひろです

[#27271] media watch 2001.01.18 — Noritsugu Nakamura <nnakamur@...>

25 messages 2001/01/21
[#27284] Re: media watch 2001.01.18 — WATANABE Tetsuya <tetsu@...> 2001/01/22

渡辺哲也です。

[#27325] Re: media watch 2001.01.18 — Yasunari Momoi <momo@...> 2001/01/26

From: WATANABE Tetsuya <tetsu@jpn.hp.com>

[#27334] Re: media watch 2001.01.18 — Masaki Suketa <CQN02273@...> 2001/01/27

助田です。

[#27286] Ruby -e "puts '["]' " — "たけ(tk)" <ggb03124@...>

Ruby -e "puts '["]' "

20 messages 2001/01/23
[#27288] Re: Ruby -e "puts '["]' " — "U.Nakamura" <usa@...> 2001/01/23

こんにちは、なかむら(う)です。

[#27290] Re: Ruby -e "puts '["]' " — " たけ (tk)" <ggb03124@...> 2001/01/23

たけ(tk)です。

[#27292] Re: Ruby -e "puts '["]' " — matz@... (Yukihiro Matsumoto) 2001/01/23

まつもと ゆきひろです

[#27349] NHK 放映 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

49 messages 2001/01/28
[#27354] Re: NHK 放映 — "K.Kosako" <kosako@...> 2001/01/29

Yukihiro Matsumotoさんの

[#27365] Re: NHK 放映 — "Akinori MUSHA" <knu@...> 2001/01/29

At Mon, 29 Jan 2001 10:27:37 +0900,

[#27366] Re: NHK 放映 — IWAOKA Masahiro <iwaoka@...> 2001/01/29

In the message <86snm2obtz.wl@archon.local.idaemons.org>,

[#27391] Re: NHK 放映 — Shin-ichiro HARA <sinara@...> 2001/01/30

原です。

[#27394] Re: NHK 放映 — SHUDO Kazuyuki <shudoh@...> 2001/01/30

原さん wrote:

[#27395] Re: NHK 放映 — Shin-ichiro Hara <sinara@...> 2001/01/30

原です。

[#27399] Re: NHK 放映 — Nakamura Akifumi <BXQ04723@...> 2001/01/30

[ruby-list:27179] [PATCH] net/http 1.2.0

From: OHSHIMA Ryunosuke <ryu@...>
Date: 2001-01-15 23:21:13 UTC
List: ruby-list #27179
大島です。

net/http version 1.2.0 でいくつかの不具合を発見しました。その報告と
パッチです。

1. Net::HTTP#get() で u_header が有効になりません。以下が例です。

% ruby -v -r net/http -e 'http = Net::HTTP.new("macky.nifty.com", 80); http.set_pipe($stdout); http.get("/i/", {"User-Agent" => "rubot/0.3"});'
ruby 1.7.0 (2001-01-15) [sparc-solaris2.7]
write "GET /i/ HTTP/1.1\r\n"
write "Accept: */*\r\n"
write "Host: macky.nifty.com\r\n"
write "Connection: Keep-Alive\r\n"
write "\r\n"
read  "HTTP/1.1 200 OK\r\n"
read  "Server: Netscape-Enterprise/3.6 SP3\r\n"
read  "Date: Mon, 15 Jan 2001 22:20:25 GMT\r\n"
read  "Content-type: text/html\r\n"
read  "Etag: "2465a-241-3a2edc4d"\r\n"
read  "Last-modified: Thu, 07 Dec 2000 00:39:41 GMT\r\n"
read  "Content-length: 577\r\n"
read  "Accept-ranges: bytes\r\n"
read  "Connection: close\r\n"
read  "\r\n"
reading 577 bytes...
read 577 bytes
state: 0(0)

2. サーバの応答に header と body の区切りである CRLF が含まれない場
   合、 Net::HTTP#get() で失敗します。 RFC2616 からするとサーバが悪
   いのですが、対応しておいた方が良いと思われます。以下が失敗例です。 
   (1. の不具合を修正後の例です。)

% ruby -v -r net/http -e 'http = Net::HTTP.new("macky.nifty.com", 80); http.set_pipe($stdout); http.get("/i/", {"User-Agent" => "rubot/0.3"});'
ruby 1.7.0 (2001-01-15) [sparc-solaris2.7]
write "GET /i/ HTTP/1.1\r\n"
write "User-Agent: rubot/0.3\r\n"
write "Accept: */*\r\n"
write "Host: macky.nifty.com\r\n"
write "Connection: Keep-Alive\r\n"
write "\r\n"
read  "HTTP/1.0 302 Found\r\n"
read  "Location: http://macky.nifty.com/\r\n"
state: 6(0)
lib/net/protocol.rb:593:in `sysread': End of file reached (EOFError)
        from lib/net/protocol.rb:593:in `fill_rbuf'
        from lib/net/protocol.rb:540:in `readuntil'
        from lib/net/protocol.rb:550:in `readline'
        from lib/net/http.rb:686:in `rdresp0'
        from lib/net/http.rb:677:in `read_response'
        from lib/net/http.rb:663:in `do_dispatch'
        from lib/net/http.rb:726:in `dispatch'
        from lib/net/http.rb:331:in `get2'
        from lib/net/http.rb:330:in `common_oper'
        from lib/net/http.rb:337:in `new_get'
        from lib/net/http.rb:330:in `get2'
        from lib/net/http.rb:315:in `get'
        from -e:1

3. サーバの応答の Content-length ヘッダの値が、実際に読み出せた値よ
   り大きい場合、 Net::HTTP#get() で、失敗します。 RFC2616 の 4.4
   Message Length の最後には、ヘッダの値と実際の大きさが異なる場合は、
   ユーザに知らせるようにとありますが、エラーにまでする必要はないと
   思います。以下が失敗例です。

% ruby -v -r net/http -e 'http = Net::HTTP.new("copa.org", 80); http.set_pipe($stdout); http.get("/robots.txt");'
ruby 1.7.0 (2001-01-15) [sparc-solaris2.7]
write "GET /robots.txt HTTP/1.1\r\n"
write "Accept: */*\r\n"
write "Host: copa.org\r\n"
write "Connection: Keep-Alive\r\n"
write "\r\n"
read  "HTTP/1.0 200 OK\r\n"
read  "MIME-Version: 1.0\r\n"
read  "Server: Web_Server_4D/2.0.2/001403/Macintosh\r\n"
read  "Date: Monday, 15-Jan-01 11:51:47 GMT\r\n"
read  "Last-Modified: Monday, 03-Aug-98 09:16:25 GMT\r\n"
read  "Accept-Ranges: bytes\r\n"
read  "Content-type: text/plain\r\n"
read  "Content-length: 1513\r\n"
read  "\r\n"
reading 1513 bytes...
state: 6(0)
lib/net/protocol.rb:593:in `sysread': End of file reached (EOFError)
        from lib/net/protocol.rb:593:in `fill_rbuf'
        from lib/net/protocol.rb:509:in `read'
        from lib/net/http.rb:981:in `read_body_0'
        from lib/net/http.rb:951:in `read_body'
        from lib/net/http.rb:318:in `get'
        from lib/net/http.rb:315:in `get2'
        from lib/net/http.rb:330:in `common_oper'
        from lib/net/http.rb:337:in `new_get'
        from lib/net/http.rb:330:in `get2'
        from lib/net/http.rb:315:in `get'
        from -e:1

上記の 1, 2, 3 の不具合にとりあえず対応したパッチが以下です。


Index: lib/net/http.rb
===================================================================
RCS file: /ruby/ruby/lib/net/http.rb,v
retrieving revision 1.42
diff -p -u -r1.42 http.rb
--- lib/net/http.rb	2001/01/13 19:07:15	1.42
+++ lib/net/http.rb	2001/01/15 23:15:53
@@ -597,8 +597,8 @@ S
         key = canonical(k)
         if tmp.key? key then
           $stderr.puts "WARNING: duplicated HTTP header: #{k}" if $VERBOSE
-          tmp[ key ] = v.strip
         end
+        tmp[ key ] = v.strip
       end
       @u_header.update tmp
     end
Index: lib/net/protocol.rb
===================================================================
RCS file: /ruby/ruby/lib/net/protocol.rb,v
retrieving revision 1.38
diff -p -u -r1.38 protocol.rb
--- lib/net/protocol.rb	2001/01/13 19:07:15	1.38
+++ lib/net/protocol.rb	2001/01/15 23:15:53
@@ -504,9 +504,13 @@ module Net
       @pipe << "reading #{len} bytes...\n" if @pipe; pipeoff
 
       rsize = 0
-      while rsize + @buffer.size < len do
-        rsize += writeinto( dest, @buffer.size )
-        fill_rbuf
+      begin
+        while rsize + @buffer.size < len do
+          rsize += writeinto( dest, @buffer.size )
+          fill_rbuf
+        end
+      rescue EOFError
+        len = rsize
       end
       writeinto( dest, len - rsize )
 
@@ -534,14 +538,17 @@ module Net
 
 
     def readuntil( target )
-      while true do
-        idx = @buffer.index( target )
-        break if idx
-        fill_rbuf
-      end
-
       dest = ''
-      writeinto( dest, idx + target.size )
+      begin
+        while true do
+          idx = @buffer.index( target )
+          break if idx
+          fill_rbuf
+        end
+        writeinto( dest, idx + target.size )
+      rescue EOFError
+        writeinto( dest, @buffer.size )
+      end
       dest
     end
 


以上です。

大島 龍之介     ryu@jaist.ac.jp

In This Thread

Prev Next