mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
aamine
* lib/net/protocol.rb: ignore EOFError on only specified case. * lib/net/http.rb: take HTTP 1.0 server into account. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c9d8c38153
commit
ab65e3df29
3 changed files with 31 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Feb 6 21:01:29 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||
|
||||
* lib/net/protocol.rb: ignore EOFError on only specified case.
|
||||
|
||||
* lib/net/http.rb: take HTTP 1.0 server into account.
|
||||
|
||||
Fri Feb 3 00:48:50 2001 Usaku Nakamura <usa@osb.att.ne.jp>
|
||||
|
||||
* win32/win32.c (isInternalCmd): ignore case for shell's internal
|
||||
|
|
|
@ -432,6 +432,14 @@ module Net
|
|||
private
|
||||
|
||||
|
||||
def do_start
|
||||
@seems_1_0 = false
|
||||
end
|
||||
|
||||
def do_finish
|
||||
end
|
||||
|
||||
|
||||
def common_oper( u_header, body_exist, block )
|
||||
header = procheader( u_header )
|
||||
recv = err = nil
|
||||
|
@ -460,10 +468,18 @@ module Net
|
|||
elsif @socket.closed? then
|
||||
@socket.reopen
|
||||
end
|
||||
if @seems_1_0 then
|
||||
header['Connection'] = 'close'
|
||||
end
|
||||
|
||||
resp = yield
|
||||
|
||||
unless keep_alive? header, resp then
|
||||
if keep_alive? header, resp then
|
||||
if @socket.closed? then
|
||||
@seems_1_0 = true
|
||||
@socket.close
|
||||
end
|
||||
else
|
||||
@socket.close
|
||||
end
|
||||
end
|
||||
|
@ -511,10 +527,6 @@ module Net
|
|||
ret
|
||||
end
|
||||
|
||||
|
||||
def do_finish
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
HTTPSession = HTTP
|
||||
|
@ -864,7 +876,8 @@ module Net
|
|||
resp = get_reply
|
||||
|
||||
while true do
|
||||
line = @socket.readline
|
||||
line = @socket.readuntil( "\n", true ) # ignore EOF
|
||||
line.sub!( /\s+\z/, '' ) # don't use chop!
|
||||
break if line.empty?
|
||||
|
||||
m = /\A([^:]+):\s*/.match( line )
|
||||
|
@ -964,7 +977,7 @@ module Net
|
|||
else
|
||||
clen = content_length( resp )
|
||||
if clen then
|
||||
@socket.read clen, dest
|
||||
@socket.read clen, dest, true
|
||||
else
|
||||
clen = range_length( resp )
|
||||
if clen then
|
||||
|
|
|
@ -500,7 +500,7 @@ module Net
|
|||
|
||||
CRLF = "\r\n"
|
||||
|
||||
def read( len, dest = '' )
|
||||
def read( len, dest = '', igneof = false )
|
||||
@pipe << "reading #{len} bytes...\n" if @pipe; pipeoff
|
||||
|
||||
rsize = 0
|
||||
|
@ -509,10 +509,10 @@ module Net
|
|||
rsize += writeinto( dest, @buffer.size )
|
||||
fill_rbuf
|
||||
end
|
||||
writeinto( dest, len - rsize )
|
||||
rescue EOFError
|
||||
len = rsize
|
||||
raise unless igneof
|
||||
end
|
||||
writeinto( dest, len - rsize )
|
||||
|
||||
@pipe << "read #{len} bytes\n" if pipeon
|
||||
dest
|
||||
|
@ -537,7 +537,7 @@ module Net
|
|||
end
|
||||
|
||||
|
||||
def readuntil( target )
|
||||
def readuntil( target, igneof = false )
|
||||
dest = ''
|
||||
begin
|
||||
while true do
|
||||
|
@ -547,6 +547,7 @@ module Net
|
|||
end
|
||||
writeinto( dest, idx + target.size )
|
||||
rescue EOFError
|
||||
raise unless igneof
|
||||
writeinto( dest, @buffer.size )
|
||||
end
|
||||
dest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue