# Broken link check for Authenticated Url using http,uri

**URL:** <https://www.ruby-forum.com/t/broken-link-check-for-authenticated-url-using-http-uri/196012>\
**Category:** Ruby\
**Created:** [October 5, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/broken-link-check-for-authenticated-url-using-http-uri/196012 "2010-10-05T13:44:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a698b9/32.png) [@pshah](https://www.ruby-forum.com/u/pshah)\
**Post date:** [October 5, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/broken-link-check-for-authenticated-url-using-http-uri/196012/1 "2010-10-05T13:44:25Z")

</div>

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](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](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.

---

<div class="post-metadata">

**Author:** ![pshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a698b9/32.png) [@pshah](https://www.ruby-forum.com/u/pshah)\
**Post date:** [October 7, 2010, 9:44am UTC](https://www.ruby-forum.com/t/broken-link-check-for-authenticated-url-using-http-uri/196012/2 "2010-10-07T09:44:10Z")

</div>

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

> username and password when i type doamin name like “[http://test.com](http://test.com)” and  
> it

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

All the best, Sandor  
Szücs
