44件ヒット
[1-44件を表示]
(0.074秒)
キーワード
- cgi (11)
-
net
/ http (11) -
rubygems
/ commands / server _ command (11) -
webrick
/ cgi (11)
検索結果
-
net
/ http (121.0) -
汎用データ転送プロトコル HTTP を扱うライブラリです。 実装は 2616 に基きます。
...url.host, url.port) {|http|
http.get('/index.html')
}
puts res.body
//}
//emlist[例4: 上の例よりさらに汎用的な例][ruby]{
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|
ht......05-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.new(url.host, url.port)......の proxy_addr や 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|
# alwa... -
rubygems
/ commands / server _ command (67.0) -
ローカルにインストールされている Gem パッケージとそのドキュメントを HTTP サーバに 載せて公開するためのライブラリです。
...Usage: gem server [options]
Options:
-p, --port=PORT port to listen on
-d, --dir=GEMDIR directory from which to serve gems
--[no-]daemon run as a daemon
Common Options:
-h, --help このコマ......ヘルプを表示します
-V, --[no-]verbose 表示を詳細にします
-q, --quiet 静かに実行します
--config-file FILE 指定された設定ファイルを使用します
--backtrace バック......トレースを表示します
--debug Ruby 自体のデバッグオプションを有効にします
Summary:
Documentation and gem repository HTTP server
Description:
The server command starts up a web server that hosts the RDoc for your
ins... -
cgi (49.0)
-
CGI プログラムの支援ライブラリです。
...リです。
CGI プロトコルの詳細については以下の文書を参照してください。
* https://tools.ietf.org/html/draft-coar-cgi-v11-03
* 3875: The Common Gateway Interface (CGI) Version 1.1
* https://www.w3.org/CGI/
=== 使用例
==== フォームフィールドの値を......* REMOTE_HOST
* REMOTE_IDENT
* REMOTE_USER
* REQUEST_METHOD
* SCRIPT_NAME
* SERVER_NAME
* SERVER_PORT
* SERVER_PROTOCOL
* SERVER_SOFTWARE
#content_length と #server_port
は整数を、その他のメソッドは文字列を返します。
HTTP_COOKIE と HTTP_COOKIE2 には
そ......ams: " + cgi.params.inspect + "\n" +
"cookies: " + cgi.cookies.inspect + "\n" +
ENV.collect() do |key, value|
key + " --> " + value + "\n"
end.join("")
)
end
end
end
end
# HTML生成メソッドを追加
CGI.new("html3") # html3.2
CGI... -
webrick
/ cgi (19.0) -
一般の CGI 環境で webrick ライブラリのサーブレットと同じように CGI スクリプトを書くための ライブラリです。サーバが WEBrick でなくても使うことが出来ます。
...は実行されます。
例:
#!/usr/local/bin/ruby
require 'webrick/cgi'
class MyCGI < WEBrick::CGI
def do_GET(req, res)
res["content-type"] = "text/plain"
ret = "hoge\n"
res.body = ret
end
end
MyCGI.new.start()
==== do_XXX メソッド
do_XXX メソッドの XXX......d.name #=> "field_name"
d.filename #=> もしあればファイル名を返す。
d['content-type'] #=> ヘッダの値は [] メソッドで取得する
d #=> 送られてきたファイルの中......class MyCGI < WEBrick::CGI
def do_GET(req, res)
req.content_length
req.content_type
req.path_info
req.query_string
req.peeraddr
req.host
req.user
req.request_method
req.script_name
req.port
end
end
MyCGI.new.start()
=== リンク
* 3875...