mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
o pop.rb: accept illegal timestamp (reported by WATANABE Hirofumi)
o http.rb: when body was chunked, does not set 'Content-Length' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
861e4ba6b3
commit
6d77e51b17
3 changed files with 11 additions and 14 deletions
|
@ -170,6 +170,7 @@ All "key" is case-insensitive.
|
||||||
resp
|
resp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def post( path, data, u_header = nil, dest = nil, &block )
|
def post( path, data, u_header = nil, dest = nil, &block )
|
||||||
u_header = procheader( u_header )
|
u_header = procheader( u_header )
|
||||||
dest, ret = HTTP.procdest( dest, block )
|
dest, ret = HTTP.procdest( dest, block )
|
||||||
|
@ -193,6 +194,7 @@ All "key" is case-insensitive.
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# not tested because I could not setup apache (__;;;
|
# not tested because I could not setup apache (__;;;
|
||||||
def put( path, src, u_header = nil )
|
def put( path, src, u_header = nil )
|
||||||
u_header = procheader( u_header )
|
u_header = procheader( u_header )
|
||||||
|
@ -592,7 +594,7 @@ All "key" is case-insensitive.
|
||||||
str = @socket.readline
|
str = @socket.readline
|
||||||
m = /\AHTTP\/(\d+\.\d+)?\s+(\d\d\d)\s*(.*)\z/i.match( str )
|
m = /\AHTTP\/(\d+\.\d+)?\s+(\d\d\d)\s*(.*)\z/i.match( str )
|
||||||
unless m then
|
unless m then
|
||||||
raise HTTPBadResponse, "wrong status line format: #{str}"
|
raise HTTPBadResponse, "wrong status line: #{str}"
|
||||||
end
|
end
|
||||||
@http_version = m[1]
|
@http_version = m[1]
|
||||||
status = m[2]
|
status = m[2]
|
||||||
|
@ -605,7 +607,6 @@ All "key" is case-insensitive.
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_chunked( ret, header )
|
def read_chunked( ret, header )
|
||||||
line = nil
|
|
||||||
len = nil
|
len = nil
|
||||||
total = 0
|
total = 0
|
||||||
|
|
||||||
|
@ -613,20 +614,16 @@ All "key" is case-insensitive.
|
||||||
line = @socket.readline
|
line = @socket.readline
|
||||||
m = /[0-9a-hA-H]+/.match( line )
|
m = /[0-9a-hA-H]+/.match( line )
|
||||||
unless m then
|
unless m then
|
||||||
raise HTTPBadResponse, "chunk size not given"
|
raise HTTPBadResponse, "wrong chunk size line: #{line}"
|
||||||
end
|
end
|
||||||
len = m[0].hex
|
len = m[0].hex
|
||||||
break if len == 0
|
break if len == 0
|
||||||
@socket.read( len, ret ); total += len
|
@socket.read( len, ret ); total += len
|
||||||
@socket.read 2 # \r\n
|
@socket.read 2 # \r\n
|
||||||
end
|
end
|
||||||
while true do
|
until @socket.readline.empty? do
|
||||||
line = @socket.readline
|
;
|
||||||
break if line.empty?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
header.delete 'transfer-encoding'
|
|
||||||
header[ 'content-length' ] = total.to_s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -644,7 +641,7 @@ All "key" is case-insensitive.
|
||||||
|
|
||||||
def chunked?( header )
|
def chunked?( header )
|
||||||
str = header[ 'transfer-encoding' ]
|
str = header[ 'transfer-encoding' ]
|
||||||
if str and /(\A|\s+)chunked(?:\s+|\z)/i === str then
|
if str and /(?:\A|\s+)chunked(?:\s+|\z)/i === str then
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
|
@ -329,11 +329,11 @@ Net::POP3
|
||||||
def initialize( sock )
|
def initialize( sock )
|
||||||
rep = super( sock )
|
rep = super( sock )
|
||||||
|
|
||||||
/<[^@]+@[^@>]+>/o === rep.msg
|
m = /<.+>/.match( rep.msg )
|
||||||
@stamp = $&
|
unless m then
|
||||||
unless @stamp then
|
|
||||||
raise ProtoAuthError, "This is not APOP server: can't login"
|
raise ProtoAuthError, "This is not APOP server: can't login"
|
||||||
end
|
end
|
||||||
|
@stamp = m[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ require 'socket'
|
||||||
|
|
||||||
module Net
|
module Net
|
||||||
|
|
||||||
Version = '1.1.12'
|
Version = '1.1.13'
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue