summaryrefslogtreecommitdiff
path: root/lib/webrick/utils.rb
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-14 23:00:22 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-14 23:00:22 +0000
commitc7070bdc480332a73e2d6bcc5095d9d0cf40d03a (patch)
tree1c48728f5855a463fb756f289c56b7f9228d0176 /lib/webrick/utils.rb
parentf07aefe54f20e64e41a04a9fe32abb7a8aa732f3 (diff)
* lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
sockets should be non-blocking mode. [ruby-dev:26405] * lib/webrick/utils.rb (WEBrick::Utils.set_non_blocking): new method. * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#read_chunked): should call sock.read repeatedly until the preferred size data is obtained. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/utils.rb')
-rw-r--r--lib/webrick/utils.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb
index 7283704c1d..cf9da6f2ce 100644
--- a/lib/webrick/utils.rb
+++ b/lib/webrick/utils.rb
@@ -18,6 +18,14 @@ end
module WEBrick
module Utils
+ def set_non_blocking(io)
+ flag = File::NONBLOCK
+ if defined?(Fcntl::F_GETFL)
+ flag |= io.fcntl(Fcntl::F_GETFL)
+ end
+ io.fcntl(Fcntl::F_SETFL, flag)
+ end
+ module_function :set_non_blocking
def set_close_on_exec(io)
if defined?(Fcntl::FD_CLOEXEC)