diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-08 08:39:40 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-08 08:39:40 +0000 |
commit | 4dae731bbd067cd1cae8ecf42ede0a4ac7c16bc8 (patch) | |
tree | 41aa2cc002acd295032914aab61a26d6f3d683ba | |
parent | fc07b3b0ad1415ab93352246474251dd97700423 (diff) | |
download | ruby-4dae731bbd067cd1cae8ecf42ede0a4ac7c16bc8.tar.gz |
aamine
* lib/net/protocol.rb: one write(2) per one line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/net/http.rb | 37 | ||||
-rw-r--r-- | lib/net/protocol.rb | 3 |
3 files changed, 26 insertions, 18 deletions
@@ -1,3 +1,7 @@ +Thu Mar 8 17:45:19 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp> + + * lib/net/protocol.rb: one write(2) per one line. + Wed Mar 7 14:26:11 2001 WATANABE Hirofumi <eban@ruby-lang.org> * math.c (math_log, math_log10): should return NaN if x < 0.0 diff --git a/lib/net/http.rb b/lib/net/http.rb index 76cf25e15a..473cf5d8a3 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -124,15 +124,21 @@ == class Net::HTTP::Get, Head, Post HTTP request classes. These classes wraps request header and -entity path. All "key" is case-insensitive. +entity path. All arguments named "key" is case-insensitive. + +=== Class Methods + +: new + creats HTTP request object. === Methods : self[ key ] - returns header field for "key". + returns the header field corresponding to the case-insensitive key. + For example, a key of "Content-Type" might return "text/html" : self[ key ] = val - set header to "val". + sets the header field corresponding to the case-insensitive key. == class Net::HTTPResponse @@ -143,15 +149,14 @@ All arguments named KEY is case-insensitive. === Methods : self[ key ] - returns header field for KEY. - for HTTP, value is a string like 'text/plain' (for Content-Type), - '2045' (for Content-Length), 'bytes 0-1024/10024' (for Content-Range). + returns the header field corresponding to the case-insensitive key. + For example, a key of "Content-Type" might return "text/html". + A key of "Content-Length" might do "2045". + More than one fields which has same names are joined with ','. - KEY is case insensitive. : self[ key ] = val - set field value for KEY. - KEY is inseisitive. + sets the header field corresponding to the case-insensitive key. : key?( key ) true if key exists. @@ -183,7 +188,7 @@ All arguments named KEY is case-insensitive. and returns it. -== Swithing Net::HTTP versions +== Switching Net::HTTP versions You can use Net::HTTP 1.1 features by calling HTTP.version_1_1 . And calling Net::HTTP.version_1_2 allows you to use 1.2 features @@ -654,9 +659,9 @@ module Net d1 = m[1].to_i d2 = m[2].to_i - if m[1] and m[2] then arr.push d1 .. d2 - elsif m[1] then arr.push d1 .. -1 - elsif m[2] then arr.push -d2 .. -1 + if m[1] and m[2] then arr.push (d1 .. d2) + elsif m[1] then arr.push (d1 .. -1) + elsif m[2] then arr.push (-d2 .. -1) else raise HTTPHeaderSyntaxError, 'range is not specified' end @@ -1028,12 +1033,12 @@ module Net # header (for backward compatibility) # - def read_header + def response self end - alias header read_header - alias response read_header + alias header response + alias read_header response # # body diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index bed94634be..7018158315 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -696,8 +696,7 @@ module Net def writeline( str ) writing { - do_write str - do_write "\r\n" + do_write str + "\r\n" } end |