クラス
-
Net
:: HTTP (1354) -
Net
:: HTTPGenericRequest (99) -
Net
:: HTTPRequest (11) -
Net
:: HTTPResponse (165)
モジュール
-
Net
:: HTTPExceptions (11) -
Net
:: HTTPHeader (451)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
CODE
_ CLASS _ TO _ OBJ (11) -
CODE
_ TO _ OBJ (11) - Copy (11)
- Delete (11)
- Get (11)
- HTTP (11)
- HTTPAccepted (11)
- HTTPAlreadyReported (7)
- HTTPBadGateway (11)
- HTTPBadRequest (11)
- HTTPBadResponse (11)
- HTTPClientError (11)
- HTTPClientException (6)
- HTTPConflict (11)
- HTTPContinue (11)
- HTTPCreated (11)
- HTTPEarlyHints (6)
- HTTPError (11)
- HTTPExceptions (11)
- HTTPExpectationFailed (11)
- HTTPFailedDependency (11)
- HTTPFatalError (11)
- HTTPForbidden (11)
- HTTPFound (11)
- HTTPGatewayTimeOut (11)
- HTTPGatewayTimeout (6)
- HTTPGenericRequest (11)
- HTTPGone (11)
- HTTPHeader (11)
- HTTPHeaderSyntaxError (11)
- HTTPIMUsed (11)
- HTTPInformation (11)
- HTTPInsufficientStorage (11)
- HTTPInternalServerError (11)
- HTTPLengthRequired (11)
- HTTPLocked (11)
- HTTPLoopDetected (7)
- HTTPMethodNotAllowed (11)
- HTTPMisdirectedRequest (7)
- HTTPMovedPermanently (11)
- HTTPMovedTemporarily (11)
- HTTPMultiStatus (11)
- HTTPMultipleChoice (11)
- HTTPMultipleChoices (11)
- HTTPNetworkAuthenticationRequired (11)
- HTTPNoContent (11)
- HTTPNonAuthoritativeInformation (11)
- HTTPNotAcceptable (11)
- HTTPNotExtended (7)
- HTTPNotFound (11)
- HTTPNotImplemented (11)
- HTTPNotModified (11)
- HTTPOK (11)
- HTTPPartialContent (11)
- HTTPPayloadTooLarge (6)
- HTTPPaymentRequired (11)
- HTTPPermanentRedirect (10)
- HTTPPreconditionFailed (11)
- HTTPPreconditionRequired (11)
- HTTPProcessing (7)
- HTTPProxyAuthenticationRequired (11)
- HTTPRangeNotSatisfiable (6)
- HTTPRedirection (11)
- HTTPRequest (11)
- HTTPRequestEntityTooLarge (11)
- HTTPRequestHeaderFieldsTooLarge (11)
- HTTPRequestTimeOut (11)
- HTTPRequestTimeout (6)
- HTTPRequestURITooLarge (11)
- HTTPRequestURITooLong (11)
- HTTPRequestedRangeNotSatisfiable (11)
- HTTPResetContent (11)
- HTTPResponse (11)
- HTTPRetriableError (11)
- HTTPSeeOther (11)
- HTTPServerError (11)
- HTTPServerException (11)
- HTTPServiceUnavailable (11)
- HTTPSession (11)
- HTTPSuccess (11)
- HTTPSwitchProtocol (11)
- HTTPTemporaryRedirect (11)
- HTTPTooManyRequests (11)
- HTTPURITooLong (6)
- HTTPUnavailableForLegalReasons (8)
- HTTPUnknownResponse (11)
- HTTPUnprocessableEntity (11)
- HTTPUnsupportedMediaType (11)
- HTTPUpgradeRequired (11)
- HTTPUseProxy (11)
- HTTPVariantAlsoNegotiates (7)
- HTTPVersionNotSupported (11)
- Head (11)
- Lock (11)
- Mkcol (11)
- Move (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) - OCSP (11)
- Options (11)
- Patch (11)
- Post (11)
- Propfind (11)
- Proppatch (11)
- Proxy (11)
- Put (11)
- Trace (11)
- Unlock (11)
- [] (11)
- []= (11)
- active? (11)
-
add
_ field (11) - address (11)
-
basic
_ auth (11) - body (22)
- body= (11)
-
body
_ exist? (11) -
body
_ permitted? (11) -
body
_ stream (11) -
body
_ stream= (11) -
ca
_ file (11) -
ca
_ file= (11) -
ca
_ path (11) -
ca
_ path= (11) -
canonical
_ each (11) - cert (11)
- cert= (11)
-
cert
_ store (11) -
cert
_ store= (11) - chunked? (11)
- ciphers (11)
- ciphers= (11)
-
close
_ on _ empty _ response (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) -
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)
- key? (11)
- length (11)
-
local
_ host (11) -
local
_ host= (11) -
local
_ port (11) -
local
_ port= (11) - lock (11)
-
main
_ type (11) - method (22)
- mkcol (11)
- move (11)
- msg (11)
-
net
/ https (11) -
net
/ protocol (11) - new (22)
-
open
_ timeout (11) -
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
_ address= (11) -
proxy
_ basic _ auth (11) -
proxy
_ class? (11) -
proxy
_ from _ env= (11) -
proxy
_ from _ env? (11) -
proxy
_ pass (22) -
proxy
_ pass= (11) -
proxy
_ port (22) -
proxy
_ port= (11) -
proxy
_ uri (11) -
proxy
_ user (22) -
proxy
_ user= (11) - proxyaddr (11)
- proxyport (11)
- put (11)
- put2 (22)
- range (11)
- range= (22)
-
range
_ length (11) -
read
_ body (22) -
read
_ timeout (11) -
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
_ timeout= (11) -
ssl
_ version (11) -
ssl
_ version= (11) - start (44)
- started? (11)
-
sub
_ type (11) - trace (11)
-
type
_ params (11) - unlock (11)
-
use
_ ssl= (11) -
use
_ ssl? (11) - value (11)
-
verify
_ callback (11) -
verify
_ callback= (11) -
verify
_ depth (11) -
verify
_ depth= (11) -
verify
_ mode (11) -
verify
_ mode= (11) -
version
_ 1 _ 1? (11) -
version
_ 1 _ 2 (11) -
version
_ 1 _ 2? (11) -
write
_ timeout (6) -
write
_ timeout= (6)
検索結果
先頭5件
-
net
/ http (38048.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 '......dr や proxy_port
を指定することでプログラムからプロクシを指定することもできます。
//emlist[例][ruby]{
require 'net/http'
proxy_addr = 'your.proxy.host'
proxy_port = 8080
Net::HTTP.new('example.com', nil, proxy_addr, proxy_port).start { |http|
# always proxy via... -
Net
:: HTTPHeader # fetch(key) -> String (8024.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 (8024.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 (8024.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
:: HTTPResponse # value -> nil (8018.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
...スが 2xx(成功)でなかった場合に、対応する
例外を発生させます。
@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx......レスポンスが 2xx(成功)][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
//}
//emlist[例 レスポンスが 2xx以外][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
respo... -
Net
:: HTTP # get(path , header = nil , dest = nil) -> Net :: HTTPResponse (8012.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...、返り値が [レスポンスオブジェクト, そのボディ] となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html'... -
Net
:: HTTP # get(path , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (8012.0) -
サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。
...、返り値が [レスポンスオブジェクト, そのボディ] となります。
//emlist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )
# net/http version 1.2
response = http.get('/index.html')
# compatible in both version
response , = http.get('/index.html'... -
Net
:: HTTP . Proxy(address , port = 80) -> Class (8012.0) -
Proxy 経由で http サーバに接続するためのクラスを作成し返します。
...][ruby]{
require 'net/http'
proxy_class = Net::HTTP::Proxy('proxy.example.com', 8080)
http = proxy_class.new('www.example.org')
http.start {|h|
h.get('/ja/') # proxy.example.com 経由で接続します。
}
//}
//emlist[例2: Net::HTTP.start を使う][ruby]{
require 'net/http'
proxy_class = Net... -
Net
:: HTTP . get _ print(host , path , port = 80) -> () (8012.0) -
指定した対象から HTTP でエンティティボディを取得し、 $stdout に出力します。
...ートを整数で指定します。
@see Net::HTTP.get
=== 例
//emlist[][ruby]{
require 'net/http'
require 'uri'
Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
//}
もしくは
//emlist[][ruby]{
require 'net/http'
Net::HTTP.get_print 'www.example.com', '/index.html'
//}... -
Net
:: HTTP . get _ print(uri) -> () (8012.0) -
指定した対象から HTTP でエンティティボディを取得し、 $stdout に出力します。
...ートを整数で指定します。
@see Net::HTTP.get
=== 例
//emlist[][ruby]{
require 'net/http'
require 'uri'
Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
//}
もしくは
//emlist[][ruby]{
require 'net/http'
Net::HTTP.get_print 'www.example.com', '/index.html'
//}...