- 512 名前:デフォルトの名無しさん [2008/02/03(日) 02:21:20 ]
- はじめまして、ネットワークの初歩のコードを書いてみたのですが
def checkSite( address ) url = URI.parse(address) res = Net::HTTP.start(url.host, url.port){|http| http.head(url.path) } # HTTP_OKなら if res.code == 200 then p res['content-type'] else p res['content-type'] puts "error : " + res.code.to_s end end 実行結果が "text/html;charset=UTF-8" error : 200 になります res.code == 200なのにifでうまくひっかかりません これは何を勘違いしているのかご指摘お願いしますm(__)m
|

|