[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Fix for the Webrick "Errno::EINVAL: Invalid argument" error

Kloubakov, Yura

5/11/2005 11:51:00 PM


It turns out that the problem is with the following HTTPServer#run code:

while timeout > 0
break if IO.select([sock], nil, nil, 0.5)
timeout = 0 if @status != :Running
timeout -= 0.5
end
raise HTTPStatus::EOFError if timeout <= 0
req.parse(sock)

where parse(sock) throws StandardError exception.
It happens because IO.select returns [[sock], [], []] while client has
closed its side of the connection. The fix can be as simple as adding
test for the sock.eof to the raise statement:

raise HTTPStatus::EOFError if timeout <= 0 || sock.eof?

Or may be it should be:

break if timeout <= 0 || sock.eof?

Regards,
Yura.



1 Answer

GOTOU Yuuzou

5/13/2005 4:00:00 AM

0