るりまサーチ

最速Rubyリファレンスマニュアル検索!
696件ヒット [101-200件を表示] (0.044秒)
トップページ > クエリ:http[x] > クエリ:start[x]

別のキーワード

  1. net/http get
  2. http get
  3. net/http start
  4. net/http delete

検索結果

<< < 1 2 3 4 ... > >>

Net::HTTP#started? -> bool (6116.0)

HTTP セッションが開始されていたら真を返します。

...
HTTP
セッションが開始されていたら真を返します。

active? は時代遅れのメソッドです。...

WEBrick::HTTPServer (6028.0)

HTTP サーバの機能を提供するクラスです。

...HTTP サーバの機能を提供するクラスです。

以下は HTTP サーバとしてちゃんと動作する例です。

require 'webrick'
srv = WEBrick::HTTPServer.new({:DocumentRoot => '/home/username/public_html/',
:BindAddress => '127.0.0.1',...
...:Port => 10080})
srv.mount('/hoge.pl', WEBrick::HTTPServlet::CGIHandler, 'really_executed_script.rb')
Signal.trap(:INT){ srv.shutdown }
srv.start...

WEBrick::HTTPProxyServer (6006.0)

プロクシの機能を提供するクラスです。CONNECT メソッドにも対応しています。

...います。

* https://magazine.rubyist.net/articles/0002/0002-WEBrickProxy.html

以下は完全に動作するプロクシサーバの例です。

require 'webrick'
require 'webrick/httpproxy'

s = WEBrick::HTTPProxyServer.new(Port: 8080)
Signal.trap('INT') do
s.shutdown
end
s.start...

Net::HTTP#head(path, header = nil) -> Net::HTTPResponse (3148.0)

サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse のインスタンスを返します。

...path にあるエンティティのヘッダのみを取得します。
Net::HTTPResponse のインスタンスを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } とい...
...リクエストの HTTP ヘッダをハッシュで指定します。

1.1 互換モードの場合は、レスポンスに応じて例外が発生します。

//emlist[例][ruby]{
require 'net/http'

response = nil
Net::HTTP.start('some.www.server', 80) {|http|
response = http.head('/index.html...
...')
}
p response['content-type']
//}

@see Net::HTTP#request_head...

Net::HTTP.Proxy(address, port = 80) -> Class (3106.0)

Proxy 経由で http サーバに接続するためのクラスを作成し返します。

...Proxy 経由で http サーバに接続するためのクラスを作成し返します。

このクラスは Net::HTTP を継承しているので Net::HTTP と全く
同じように使えます。指定されたプロクシを常に経由して http サーバ
に接続します。

address が n...
...il のときは Net::HTTP クラスをそのまま返します。

//emlist[例1: Net::HTTP.new を使う][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::HTTP::Proxy('proxy.example.com', 8080)
proxy_class.start('www.example.org') {|h|
h.get('/ja/') # proxy.example.com 経由で接続します。
}
//}

@param address プロクシのホスト...

絞り込み条件を変える

Net::HTTPResponse#read_body {|str| .... } -> () (3066.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...y]{
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://www.example.c...
...om/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http
.request_get(uri.path) do |response|
response.read_b...
...い。

dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@param dest obsoleteな引数です。利用しないでください。

@see Net::HTTP#request_get...

Net::HTTPResponse#read_body(dest=nil) -> String|nil (3066.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...y]{
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://www.example.c...
...om/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http
.request_get(uri.path) do |response|
response.read_b...
...い。

dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。

@param dest obsoleteな引数です。利用しないでください。

@see Net::HTTP#request_get...

Net::HTTP#local_port=(port) (3060.0)

接続に用いるローカルポートを設定します。

...、もしくはサービス名文字列)

//emlist[例][ruby]{
require 'net/http'

http
= Net::HTTP.new("www.example.com")
http
.local_host = "192.168.0.5"
http
.local_port = "53043"

http
.start do |h|
p h.get("/").body
end
//}

@see Net::HTTP#local_port=, Net::HTTP#local_host


@see Net::HTTP.new...

Net::HTTP#local_host=(host) (3054.0)

接続に用いるローカルホスト名を指定します。

...ost ホスト名、もしくはアドレスを示す文字列

//emlist[例][ruby]{
require 'net/http'

http
= Net::HTTP.new("www.example.com")
http
.local_host = "192.168.0.5"
http
.local_port = "53043"

http
.start do |h|
p h.get("/").body
end
//}

@see Net::HTTP#local_host=, Net::HTTP#local_port...
<< < 1 2 3 4 ... > >>