クラス
-
Net
:: HTTP (12) -
Net
:: HTTPGenericRequest (3) -
Net
:: HTTPResponse (8)
モジュール
-
Net
:: HTTPHeader (12)
キーワード
- [] (1)
- address (1)
-
basic
_ auth (1) - body (2)
-
ca
_ file (1) -
ca
_ path (1) - ciphers (1)
- code (1)
-
content
_ type (1) - delete (1)
- entity (1)
- fetch (3)
-
get
_ fields (1) -
http
_ version (1) -
local
_ host (1) -
local
_ port (1) -
main
_ type (1) - method (2)
- msg (1)
- path (1)
-
proxy
_ address (1) -
proxy
_ basic _ auth (1) -
proxy
_ pass (1) -
proxy
_ uri (1) -
proxy
_ user (1) - proxyaddr (1)
-
read
_ body (2) -
ssl
_ version (1) -
sub
_ type (1)
検索結果
先頭5件
-
Net
:: HTTPResponse # http _ version -> String (27613.0) -
サーバがサポートしている HTTP のバージョンを文字列で返します。
...サーバがサポートしている HTTP のバージョンを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.http_version # => "1.1"
//}... -
Net
:: HTTP # ciphers -> String | [String] | nil (18916.0) -
Net::HTTP#ciphers で設定した値を返します。
Net::HTTP#ciphers で設定した値を返します。
OpenSSL::SSL::SSLContext#ciphers が返す値とは
異なるので注意してください。
@see Net::HTTP#ciphers= -
Net
:: HTTPHeader # fetch(key) -> String (18619.0) -
key ヘッダフィールドを返します。
...key が存在する][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......efault を指定][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 とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.exa... -
Net
:: HTTPHeader # fetch(key) {|hash| . . . . } -> String (18619.0) -
key ヘッダフィールドを返します。
...key が存在する][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......efault を指定][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 とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.exa... -
Net
:: HTTPHeader # fetch(key , default) -> String (18619.0) -
key ヘッダフィールドを返します。
...key が存在する][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......efault を指定][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 とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.exa... -
Net
:: HTTP # ca _ path -> String | nil (18613.0) -
信頼する CA 証明書ファイルが存在するディレクトリを設定します。
信頼する CA 証明書ファイルが存在するディレクトリを設定します。
@see Net::HTTP#ca_path=, OpenSSL::SSL::SSLContext#ca_path -
Net
:: HTTP # local _ host -> String | nil (18613.0) -
接続に用いるローカルホスト名を返します。
接続に用いるローカルホスト名を返します。
nil の場合システムが適当にローカルホストを
決めます。
デフォルトは nil です。
@see Net::HTTP#local_host=, Net::HTTP#local_port -
Net
:: HTTPGenericRequest # method -> String (18613.0) -
リクエストの HTTP メソッドを文字列で返します。
...リクエストの HTTP メソッドを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.method # => "POST"
req = Net::HTTP::Get.new(uri.request_uri)
req.method # => "GET"
//}... -
Net
:: HTTPGenericRequest # path -> String (18613.0) -
リクエストする path を文字列で返します。
...リクエストする path を文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.path # => "/index.html"
//}... -
Net
:: HTTPHeader # basic _ auth(account , password) -> [String] (18613.0) -
Authorization: ヘッダを BASIC 認証用にセットします。
...unt アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth("user", "pass") # => ["Basic dXNl... -
Net
:: HTTPHeader # method -> String (18613.0) -
リクエストの HTTP メソッドを文字列で返します。
...リクエストの HTTP メソッドを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.method # => "GET"
//}... -
Net
:: HTTPHeader # proxy _ basic _ auth(account , password) -> [String] (18613.0) -
Proxy 認証のために Proxy-Authorization: ヘッダをセットします。
...unt アカウント名を文字列で与えます。
@param password パスワードを文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.proxy_basic_auth("account", "password") # =>... -
Net
:: HTTPResponse # body -> String | () | nil (9334.0) -
エンティティボディを返します。
...dapter のインスタンスを返しますが、
これは使わないでください。
entity は obsolete です。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.body[0..10] # => "<!doctype h"
//}... -
Net
:: HTTPResponse # entity -> String | () | nil (9334.0) -
エンティティボディを返します。
...dapter のインスタンスを返しますが、
これは使わないでください。
entity は obsolete です。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.body[0..10] # => "<!doctype h"
//}... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (9331.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http:/... -
Net
:: HTTP # proxy _ address -> String|nil (9316.0) -
プロクシ経由で接続する HTTP オブジェクトならプロクシのアドレス を返します。
プロクシ経由で接続する HTTP オブジェクトならプロクシのアドレス
を返します。
そうでないなら nil を返します。
proxyaddr は時代遅れのメソッドです。
@see Net::HTTP#proxy_address=, Net::HTTP#proxy_port, Net::HTTP.new -
Net
:: HTTP # proxyaddr -> String|nil (9316.0) -
プロクシ経由で接続する HTTP オブジェクトならプロクシのアドレス を返します。
プロクシ経由で接続する HTTP オブジェクトならプロクシのアドレス
を返します。
そうでないなら nil を返します。
proxyaddr は時代遅れのメソッドです。
@see Net::HTTP#proxy_address=, Net::HTTP#proxy_port, Net::HTTP.new -
Net
:: HTTPResponse # message -> String (9316.0) -
HTTP サーバがリザルトコードに付加して返すメッセージです。 例えば 'Not Found' などです。
...して返すメッセージです。
例えば 'Not Found' などです。
msg は obsolete です。使わないでください。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.message # => "OK"
//}... -
Net
:: HTTPResponse # msg -> String (9316.0) -
HTTP サーバがリザルトコードに付加して返すメッセージです。 例えば 'Not Found' などです。
...して返すメッセージです。
例えば 'Not Found' などです。
msg は obsolete です。使わないでください。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.message # => "OK"
//}... -
Net
:: HTTP # address -> String (9313.0) -
接続するアドレスを返します。
接続するアドレスを返します。
@see Net::HTTP.new -
Net
:: HTTP # ca _ file -> String | nil (9313.0) -
信頼する CA 証明書ファイルのパスを返します。
信頼する CA 証明書ファイルのパスを返します。
@see Net::HTTP#ca_file=, OpenSSL::SSL::SSLContext#ca_file -
Net
:: HTTP # local _ port -> nil | Integer | String (9313.0) -
接続に用いるローカルポートを返します。
接続に用いるローカルポートを返します。
nil の場合システムが適当にローカルポートを
決めます。
デフォルトは nil です。
@see Net::HTTP#local_port=, Net::HTTP#local_host -
Net
:: HTTP # proxy _ pass -> String|nil (9313.0) -
プロクシ経由で接続し、さらにプロクシのユーザ認証を する HTTP オブジェクトなら認証のパスワードを を返します。
プロクシ経由で接続し、さらにプロクシのユーザ認証を
する HTTP オブジェクトなら認証のパスワードを
を返します。
そうでないなら nil を返します。
@see Net::HTTP#proxy_pass=, Net::HTTP#proxy_user, Net::HTTP.new -
Net
:: HTTP # proxy _ uri -> String|nil (9313.0) -
このメソッドは内部用なので使わないでください。
このメソッドは内部用なので使わないでください。
環境変数 http_proxy から得られるプロクシの URI を返します。 -
Net
:: HTTP # proxy _ user -> String|nil (9313.0) -
プロクシ経由で接続し、さらにプロクシのユーザ認証を する HTTP オブジェクトなら認証のユーザ名を を返します。
プロクシ経由で接続し、さらにプロクシのユーザ認証を
する HTTP オブジェクトなら認証のユーザ名を
を返します。
そうでないなら nil を返します。
@see Net::HTTP#proxy_pass, Net::HTTP#proxy_user=, Net::HTTP.new -
Net
:: HTTP # ssl _ version -> String | Symbol | nil (9313.0) -
利用するプロトコルの種類を返します。
利用するプロトコルの種類を返します。
@see Net::HTTP#ssl_version= -
Net
:: HTTPGenericRequest # body -> String (9313.0) -
サーバに送るリクエストのエンティティボディを返します。
...サーバに送るリクエストのエンティティボディを返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data"
req.body # => "Test Post Data"
//}
@see Net::HTTPGe... -
Net
:: HTTPHeader # [](key) -> String|nil (9313.0) -
key ヘッダフィールドを返します。
...しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req['user-agent'] # => Ruby
//}
一種類のヘ... -
Net
:: HTTPHeader # content _ type -> String|nil (9313.0) -
"text/html" のような Content-Type を表す 文字列を返します。
...列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
req = Net::HTTP::Post.new(uri.request_uri)
req.content_type # => nil
req.c... -
Net
:: HTTPHeader # delete(key) -> [String] | nil (9313.0) -
key ヘッダフィールドを削除します。
...ます。
key ヘッダフィールドが存在しなかった場合には
nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.content_length = 10
req.content_length # =>... -
Net
:: HTTPHeader # get _ fields(key) -> [String] (9313.0) -
key ヘッダフィールドの値 (文字列) を配列で返します。
...y は大文字小文字を区別しません。
@param key ヘッダフィール名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}
@see... -
Net
:: HTTPHeader # main _ type -> String|nil (9313.0) -
"text/html" における "text" のようなタイプを表す 文字列を返します。
...タイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.main_type # => "text"
//}... -
Net
:: HTTPHeader # sub _ type -> String|nil (9313.0) -
"text/html" における "html" のようなサブタイプを表す 文字列を返します。
...タイプを表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.sub_type # => "html"
//}... -
Net
:: HTTPResponse # code -> String (9313.0) -
HTTP のリザルトコードです。例えば '302' などです。
...スオブジェクトがどのクラスのインスタンスかを
見ることでもレスポンスの種類を判別できます。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.code # => "200"
//}... -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (9031.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri = URI.parse('http:/...