summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-08 08:39:40 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-08 08:39:40 +0000
commit4dae731bbd067cd1cae8ecf42ede0a4ac7c16bc8 (patch)
tree41aa2cc002acd295032914aab61a26d6f3d683ba /lib/net
parentfc07b3b0ad1415ab93352246474251dd97700423 (diff)
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
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/http.rb37
-rw-r--r--lib/net/protocol.rb3
2 files changed, 22 insertions, 18 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 76cf25e..473cf5d 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 bed9463..7018158 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