Broken link check for Authenticated Url using http,uri

Hi All,

I work on check all links in a site, so for that i fetch all links from
page and

check its http response and its work fine for urls which have not any

authentication. but my many urls need to pass username and password so
for that

i found following code but it not work for my url,

require ‘net/http’
require ‘uri’

url = URI.parse(‘http://api.del.icio.us/v1/tags/get’)
req = Net::HTTP::Get.new(url.path)
req.basic_auth ‘username’, ‘password’
res = Net::HTTP.new(url.host, 80)
response = res.start {|http| http.request(req)}
puts response.message

This work fine but in my url, there are not extra “/v1/tags” path, it
ask for

username and password when i type doamin name like “http://test.com” and
it

shows popup for username and password.

and i everytime get authentication required as response message using
above

code, even i pass credentials.

so what can i do for that ? can any one help me ?

Thanks,
Priyank S.

On Oct 5, 2010, at 1:44 PM, Priyank S. wrote:

username and password when i type doamin name like “http://test.com” and
it

I guess that you have to append a ‘/’ (http://test.com/).

All the best, Sandor
Szücs

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs