1924件ヒット
[1-100件を表示]
(0.105秒)
クラス
-
Net
:: HTTP (1095) -
Net
:: HTTPGenericRequest (88) -
Net
:: HTTPRequest (11) -
Net
:: HTTPResponse (165)
モジュール
-
Net
:: HTTPExceptions (11) -
Net
:: HTTPHeader (429)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
CODE
_ CLASS _ TO _ OBJ (11) -
CODE
_ TO _ OBJ (11) - HTTPHeader (11)
- HTTPMultiStatus (11)
- HTTPNonAuthoritativeInformation (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) - OCSP (11)
- Proxy (11)
- [] (11)
- []= (11)
- active? (11)
-
add
_ field (11) - address (11)
-
basic
_ auth (11) - body (22)
-
body
_ exist? (11) -
body
_ permitted? (11) -
body
_ stream (11) -
body
_ stream= (11) -
ca
_ file (11) -
ca
_ path (11) -
canonical
_ each (11) - cert (11)
-
cert
_ store (11) - chunked? (11)
- ciphers (11)
-
close
_ on _ empty _ response (11) - code (11)
-
content
_ length (11) -
content
_ length= (11) -
content
_ range (11) -
content
_ type (11) -
content
_ type= (11) -
continue
_ timeout (11) - copy (11)
-
default
_ port (11) - delete (22)
- each (11)
-
each
_ capitalized (11) -
each
_ capitalized _ name (11) -
each
_ header (11) -
each
_ key (11) -
each
_ name (11) -
each
_ value (11) - entity (11)
- fetch (33)
- finish (11)
-
form
_ data= (11) - get (44)
- get2 (22)
-
get
_ fields (11) -
get
_ print (22) -
get
_ response (22) - head (11)
- head2 (22)
- header (11)
-
http
_ default _ port (11) -
http
_ version (11) -
https
_ default _ port (11) -
is
_ version _ 1 _ 1? (11) -
is
_ version _ 1 _ 2? (11) -
keep
_ alive _ timeout (11) -
keep
_ alive _ timeout= (11) - key (11)
- key? (11)
- length (11)
-
local
_ host (11) -
local
_ port (11) - lock (11)
-
main
_ type (11) - method (22)
- mkcol (11)
- move (11)
- msg (11)
- new (22)
-
open
_ timeout (11) - patch (22)
- path (11)
-
peer
_ cert (11) - port (11)
- post (22)
- post2 (22)
-
post
_ form (11) - propfind (11)
- proppatch (11)
- proxy? (11)
-
proxy
_ address (22) -
proxy
_ basic _ auth (11) -
proxy
_ class? (11) -
proxy
_ from _ env? (11) -
proxy
_ pass (22) -
proxy
_ port (22) -
proxy
_ uri (11) -
proxy
_ user (22) - proxyaddr (11)
- proxyport (11)
- put (11)
- put2 (22)
- range (11)
-
range
_ length (11) -
read
_ body (22) -
read
_ timeout (11) -
reader
_ header (11) - request (22)
-
request
_ body _ permitted? (11) -
request
_ get (22) -
request
_ head (22) -
request
_ post (22) -
request
_ put (22) - response (22)
-
response
_ body _ permitted? (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 9 feature (11) -
send
_ request (11) -
set
_ content _ type (11) -
set
_ debug _ output (11) -
set
_ form _ data (11) -
set
_ range (33) - size (11)
-
ssl
_ timeout (11) -
ssl
_ version (11) - start (44)
- started? (11)
-
sub
_ type (11) - trace (11)
-
type
_ params (11) - unlock (11)
-
use
_ ssl? (11) - value (11)
-
verify
_ callback (11) -
verify
_ depth (11) -
verify
_ mode (11) -
version
_ 1 _ 1? (11) -
version
_ 1 _ 2 (11) -
version
_ 1 _ 2? (11) -
write
_ timeout (6)
検索結果
先頭5件
-
net
/ http (38132.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
...y]{
require 'net/http'
print Net::HTTP.get('www.example.com', '/index.html')
//}
//emlist[例2: URI を使う][ruby]{
require 'net/http'
require 'uri'
print Net::HTTP.get(URI.parse('http://www.example.com/index.html'))
//}
//emlist[例3: より汎用的な例][ruby]{
require 'net/http'
require 'ur......{
require 'net/http'
url = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
//}
==== フォームの情報を送信する (POST)
//emlist[例][ruby]{
require 'net/http'
require '......{'from'=>'2005-01-01', 'to'=>'2005-03-31'})
puts res.body
#例3: より細かく制御する
url = URI.parse('http://www.example.com/todo.cgi')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'jack', 'pass'
req.set_form_data({'from'=>'2005-01-01', 'to'=>'2005-03-31'})
res = Net::HTTP.n... -
Net
:: HTTPHeader # add _ field(key , val) -> () (8208.0) -
key ヘッダフィールドに val を追加します。
...-My-Header', 'a'
p request['X-My-Header'] #=> "a"
p request.get_fields('X-My-Header') #=> ["a"]
request.add_field 'X-My-Header', 'b'
p request['X-My-Header'] #=> "a, b"
p request.get_fields('X-My-Header') #=> ["a", "b"]
request.add_field 'X-My-Header', 'c'
p request['X-......My-Header'] #=> "a, b, c"
p request.get_fields('X-My-Header') #=> ["a", "b", "c"]
//}... -
Net
:: HTTPHeader # each _ capitalized _ name {|name| . . . . } -> () (8182.0) -
保持しているヘッダ名を正規化 ('x-my-header' -> 'X-My-Header') して、ブロックに渡します。
...'x-my-header' -> 'X-My-Header')
して、ブロックに渡します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_capitalized_name { |key| puts key }
# => Accept-Encoding
# => Accept
# => User-A... -
Net
:: HTTPHeader # type _ params -> Hash (8166.0) -
Content-Type のパラメータを {"charset" => "iso-2022-jp"} という形の Hash で返します。
...Content-Type のパラメータを {"charset" => "iso-2022-jp"}
という形の Hash で返します。
Content-Type: ヘッダフィールドが存在しない場合には
空のハッシュを返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.h......tml')
res = Net::HTTP.get_response(uri)
res.type_params # => {"charset"=>"UTF-8"}
//}... -
Net
:: HTTPHeader # fetch(key) -> String (8160.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい......る][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e......e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}
//emlist[例 key... -
Net
:: HTTPHeader # fetch(key) {|hash| . . . . } -> String (8160.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい......る][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e......e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}
//emlist[例 key... -
Net
:: HTTPHeader # fetch(key , default) -> String (8160.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい......る][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e......e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}
//emlist[例 key... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) -> Net :: HTTPResponse (8154.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...な body を
持ちません。
POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。
dest は時代遅れの引数です。利用し......//emlist[例][ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', 'query=... -
Net
:: HTTP # post(path , data , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (8154.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...な body を
持ちません。
POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。
dest は時代遅れの引数です。利用し......//emlist[例][ruby]{
# net/http version 1.1
response, body = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# version 1.2
response = http.post('/cgi-bin/search.rb', 'query=subject&target=ruby')
# using block
File.open('save.html', 'w') {|f|
http.post('/cgi-bin/search.rb', 'query=... -
Net
:: HTTPHeader # set _ form _ data(params , sep = & # 39;&& # 39;) -> () (8154.0) -
HTMLのフォームのデータ params から ヘッダフィールドとボディを設定します。
...ールド Content-Type: には
'application/x-www-form-urlencoded' が設定されます。
@param params HTML のフォームデータの Hash を与えます。
@param sep データのセパレータを文字列で与えます。
//emlist[例 form_data][ruby]{
require 'net/http'
uri = URI.parse......# => {"q"=>["ruby", "perl"], "lang"=>"en"}
//}
//emlist[例 set_form_data][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.set_form_data({"q" => "ruby", "lang" => "en"}, ';') # => "application/x-www-form-urlencoded"
//}...