Created
June 4, 2010 23:44
-
-
Save walter/426092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ script/console # put the word production after this if you are normally running in production mode | |
... | |
>> require 'net/http' | |
>> require 'uri' | |
>> require 'socket' | |
>> url = URI.parse("http://no.wikipedia.org/wiki/Valentin_F%C3%BCrst") | |
>> headers = Object.const_defined?('SITE_URL') ? { "User-Agent" => "#{SITE_URL} link checking mechanism via Ruby Net/HTTP" } : { "User-Agent" => "Ruby Net/HTTp used for link checking mechanism" } | |
>> http = Net::HTTP.new(url.host, (url.scheme == 'https') ? 443 : 80) | |
>> response = http.request_head(url.path, headers) # copy and paste what this returns back into ticket | |
>> response = http.request_get(url.path, headers) {|r|} # copy and paste what this returns back into ticket | |
>> response = http.request_get(url.path) {|r|} # copy and paste what this returns back into ticket | |
>> exit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment