クラス
-
Net
:: HTTP (1478) -
Net
:: HTTPGenericRequest (108) -
Net
:: HTTPRequest (12) -
Net
:: HTTPResponse (180)
モジュール
-
Net
:: HTTPExceptions (12) -
Net
:: HTTPHeader (492)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
CODE
_ CLASS _ TO _ OBJ (12) -
CODE
_ TO _ OBJ (12) - Copy (12)
- Delete (12)
- Get (12)
- HTTP (12)
- HTTPAccepted (12)
- HTTPAlreadyReported (8)
- HTTPBadGateway (12)
- HTTPBadRequest (12)
- HTTPBadResponse (12)
- HTTPClientError (12)
- HTTPClientException (7)
- HTTPConflict (12)
- HTTPContinue (12)
- HTTPCreated (12)
- HTTPEarlyHints (7)
- HTTPError (12)
- HTTPExceptions (12)
- HTTPExpectationFailed (12)
- HTTPFailedDependency (12)
- HTTPFatalError (12)
- HTTPForbidden (12)
- HTTPFound (12)
- HTTPGatewayTimeOut (12)
- HTTPGatewayTimeout (7)
- HTTPGenericRequest (12)
- HTTPGone (12)
- HTTPHeader (12)
- HTTPHeaderSyntaxError (12)
- HTTPIMUsed (12)
- HTTPInformation (12)
- HTTPInsufficientStorage (12)
- HTTPInternalServerError (12)
- HTTPLengthRequired (12)
- HTTPLocked (12)
- HTTPLoopDetected (8)
- HTTPMethodNotAllowed (12)
- HTTPMisdirectedRequest (8)
- HTTPMovedPermanently (12)
- HTTPMovedTemporarily (12)
- HTTPMultiStatus (12)
- HTTPMultipleChoice (12)
- HTTPMultipleChoices (12)
- HTTPNetworkAuthenticationRequired (12)
- HTTPNoContent (12)
- HTTPNonAuthoritativeInformation (12)
- HTTPNotAcceptable (12)
- HTTPNotExtended (8)
- HTTPNotFound (12)
- HTTPNotImplemented (12)
- HTTPNotModified (12)
- HTTPOK (12)
- HTTPPartialContent (12)
- HTTPPayloadTooLarge (7)
- HTTPPaymentRequired (12)
- HTTPPermanentRedirect (11)
- HTTPPreconditionFailed (12)
- HTTPPreconditionRequired (12)
- HTTPProcessing (8)
- HTTPProxyAuthenticationRequired (12)
- HTTPRangeNotSatisfiable (7)
- HTTPRedirection (12)
- HTTPRequest (12)
- HTTPRequestEntityTooLarge (12)
- HTTPRequestHeaderFieldsTooLarge (12)
- HTTPRequestTimeOut (12)
- HTTPRequestTimeout (7)
- HTTPRequestURITooLarge (12)
- HTTPRequestURITooLong (12)
- HTTPRequestedRangeNotSatisfiable (12)
- HTTPResetContent (12)
- HTTPResponse (12)
- HTTPRetriableError (12)
- HTTPSeeOther (12)
- HTTPServerError (12)
- HTTPServerException (12)
- HTTPServiceUnavailable (12)
- HTTPSession (12)
- HTTPSuccess (12)
- HTTPSwitchProtocol (12)
- HTTPTemporaryRedirect (12)
- HTTPTooManyRequests (12)
- HTTPURITooLong (7)
- HTTPUnavailableForLegalReasons (9)
- HTTPUnknownResponse (12)
- HTTPUnprocessableEntity (12)
- HTTPUnsupportedMediaType (12)
- HTTPUpgradeRequired (12)
- HTTPUseProxy (12)
- HTTPVariantAlsoNegotiates (8)
- HTTPVersionNotSupported (12)
- Head (12)
- Lock (12)
- Mkcol (12)
- Move (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) - OCSP (12)
- Options (12)
- Patch (12)
- Post (12)
- Propfind (12)
- Proppatch (12)
- Proxy (12)
- Put (12)
- Trace (12)
- Unlock (12)
- [] (12)
- []= (12)
- active? (12)
-
add
_ field (12) - address (12)
-
basic
_ auth (12) - body (24)
- body= (12)
-
body
_ exist? (12) -
body
_ permitted? (12) -
body
_ stream (12) -
body
_ stream= (12) -
ca
_ file (12) -
ca
_ file= (12) -
ca
_ path (12) -
ca
_ path= (12) -
canonical
_ each (12) - cert (12)
- cert= (12)
-
cert
_ store (12) -
cert
_ store= (12) - chunked? (12)
- ciphers (12)
- ciphers= (12)
-
close
_ on _ empty _ response (12) -
close
_ on _ empty _ response= (12) - code (12)
-
content
_ length (12) -
content
_ length= (12) -
content
_ range (12) -
content
_ type (12) -
content
_ type= (12) -
continue
_ timeout (12) -
continue
_ timeout= (12) - copy (12)
-
default
_ port (12) - delete (24)
- each (12)
-
each
_ capitalized (12) -
each
_ capitalized _ name (12) -
each
_ header (12) -
each
_ key (12) -
each
_ name (12) -
each
_ value (12) - entity (12)
- fetch (36)
- finish (12)
-
form
_ data= (12) - get (48)
- get2 (24)
-
get
_ fields (12) -
get
_ print (24) -
get
_ response (24) - head (12)
- head2 (24)
- header (12)
-
http
_ default _ port (12) -
http
_ version (12) -
https
_ default _ port (12) -
is
_ version _ 1 _ 1? (12) -
is
_ version _ 1 _ 2? (12) -
keep
_ alive _ timeout (12) -
keep
_ alive _ timeout= (12) - key (12)
- key= (12)
- key? (12)
- length (12)
-
local
_ host (12) -
local
_ host= (12) -
local
_ port (12) -
local
_ port= (12) - lock (12)
-
main
_ type (12) - method (24)
- mkcol (12)
- move (12)
- msg (12)
-
net
/ https (12) -
net
/ protocol (12) - new (24)
-
open
_ timeout (12) -
open
_ timeout= (12) - patch (24)
- path (12)
-
peer
_ cert (12) - port (12)
- post (24)
- post2 (24)
-
post
_ form (12) - propfind (12)
- proppatch (12)
- proxy? (12)
-
proxy
_ address (24) -
proxy
_ address= (12) -
proxy
_ basic _ auth (12) -
proxy
_ class? (12) -
proxy
_ from _ env= (12) -
proxy
_ from _ env? (12) -
proxy
_ pass (24) -
proxy
_ pass= (12) -
proxy
_ port (24) -
proxy
_ port= (12) -
proxy
_ uri (12) -
proxy
_ user (24) -
proxy
_ user= (12) - proxyaddr (12)
- proxyport (12)
- put (12)
- put2 (24)
- range (12)
- range= (24)
-
range
_ length (12) -
read
_ body (24) -
read
_ timeout (12) -
read
_ timeout= (12) -
reader
_ header (12) - request (24)
-
request
_ body _ permitted? (12) -
request
_ get (24) -
request
_ head (24) -
request
_ post (24) -
request
_ put (24) - response (24)
-
response
_ body _ permitted? (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 9 feature (12) -
send
_ request (12) -
set
_ content _ type (12) -
set
_ debug _ output (12) -
set
_ form _ data (12) -
set
_ range (36) - size (12)
-
ssl
_ timeout (12) -
ssl
_ timeout= (12) -
ssl
_ version (12) -
ssl
_ version= (12) - start (48)
- started? (12)
-
sub
_ type (12) - trace (12)
-
type
_ params (12) - unlock (12)
-
use
_ ssl= (12) -
use
_ ssl? (12) - value (12)
-
verify
_ callback (12) -
verify
_ callback= (12) -
verify
_ depth (12) -
verify
_ depth= (12) -
verify
_ mode (12) -
verify
_ mode= (12) -
version
_ 1 _ 1? (12) -
version
_ 1 _ 2 (12) -
version
_ 1 _ 2? (12) -
write
_ timeout (7) -
write
_ timeout= (7)
検索結果
先頭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'
//}...