Broken link check for Authenticated Url using http,uri

Discussion in 'Ruby' started by Priyank Shah, Oct 5, 2010.

  1. Priyank Shah

    Priyank Shah Guest

    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 Shah
    --
    Posted via http://www.ruby-forum.com/.
     
    Priyank Shah, Oct 5, 2010
    #1
    1. Advertising

  2. On Oct 5, 2010, at 1:44 PM, Priyank Shah 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=FCcs
    --
     
    Sandor Szuecs, Oct 7, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,489
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,537
    Stanimir Stamenkov
    Aug 17, 2005
  3. Abhijit
    Replies:
    0
    Views:
    173
    Abhijit
    Apr 12, 2004
  4. Behrang Saeedzadeh

    open-uri behind authenticated firewall

    Behrang Saeedzadeh, Mar 20, 2007, in forum: Ruby
    Replies:
    0
    Views:
    113
    Behrang Saeedzadeh
    Mar 20, 2007
  5. Priyank Shah
    Replies:
    2
    Views:
    175
    Priyank Shah
    Dec 27, 2010
Loading...

Share This Page