[#30408] Ruby 1.8.6 preview2 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 preview2 をリリースしました。

20 messages 2007/02/24
[#30414] fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Hidetoshi NAGAI <nagai@...> 2007/02/25

永井@知能.九工大です.

[#30418] Re: fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Nobuyoshi Nakada <nobu@...> 2007/02/25

なかだです。

[ruby-dev:30279] Re: ftp.rb raises an error that is not an FTPError on certain error conditions

From: Shugo Maeda <shugo@...>
Date: 2007-02-06 02:06:13 UTC
List: ruby-dev #30279
前田です。

net/ftp.rbに対して、EOFErrorをrescueしてFTPProtoErrorをraiseするべき
ではないか、という提案が来ています。
標準ライブラリとしてこういうケースでどう対処すべきという方針を決めて
おいた方がよいように思いますが、どうでしょうか。

個人的には、全部のライブラリでこういった対応をするくらいなら、readlineが
EOFErrorではない例外を返してくれた方がよいように思います。
# そうすべきだと主張したいわけではありません。

noreply@rubyforge.org wrote:
> If the server that ftp.rb is talking to unexpectedly closes the control connection in between responses, ftp.rb ends up raising an EOFError.  This is highly confusing to the user, since any other server error generally causes an FTPError (or one of its subclasses).
> 
> Specifically, if an ftp server is overloaded with open connections such that subsequent connection requests have it accept the connection but immediately close it (this happens easily with inetd-based servers), then FTP.open will raise EOFError.
> 
> This is very confusing, and I think it a bug.
> 
> Therefore, the definition of getline in ftp.rb should be:
> 
>     def getline
>       begin
>         line = @sock.readline # if get EOF, raise EOFError
>       rescue EOFError
>         raise FTPProtoError, "Connection closed unexpectedly"
>       end
>       line.sub!(/(\r\n|\n|\r)\z/n, "")
>       if @debug_mode
>         print "get: ", sanitize(line), "\n"
>       end
>       return line
>     end
>     private :getline
> 
> Instead of what it is now.


-- 
前田 修吾

In This Thread

Prev Next