https request failing

Discussion in 'Perl Misc' started by mike, Sep 18, 2012.

  1. mike

    mike Guest

    Hi,

    The script I have below is used o access an internal website with https (so no proxy here).

    use LWP::UserAgent;
    use LWP::Debug qw(+);

    #create User-agent
    my $ua = LWP::UserAgent->new;

    $ua->no_proxy("<internalsite>.se");


    my $url = "http://<internalsite>.se/org.testng.eclipse/site.xml";

    my $req = HTTP::Request->new(
    GET => $url);


    # send request
    my $res = $ua->request($req);

    # check the outcome
    if ($res->is_success) {
    print $res->decoded_content;
    }
    else {
    print "Error: " . $res->status_line . "\n";
    }

    When I execute it I get the following error:

    LWP::UserAgent::new: ()
    LWP::UserAgent::request: ()
    LWP::UserAgent::send_request: GET http://<internalsite>.se/org.testng.eclipse/site.xml
    LWP::UserAgent::_need_proxy: Not proxied
    LWP::protocol::http::request: ()
    LWP::protocol::collect: read 259 bytes
    LWP::UserAgent::request: Simple response: Found
    LWP::UserAgent::request: ()
    LWP::UserAgent::send_request: GET https://<internalsite>.se/org.testng.eclipse/site.xml
    LWP::UserAgent::_need_proxy: Not proxied
    LWP::protocol::http::request: ()
    LWP::UserAgent::request: Simple response: Internal Server Error
    Error: 500 Can't connect to <internalsite>.se/:443 (Bad service '8080/')

    Any ideas what the problem can be?

    br,

    //mike
     
    mike, Sep 18, 2012
    #1
    1. Advertising

  2. mike

    mike Guest

    Just a quick note. If I put the url in mozilla I can see the content:

    <site><description url="http://beust.com/eclipse-old/eclipse-6.3.2.20111203_1323/index.html"/><feature url="features/org.testng.eclipse_6.3.2.20111203_1323.jar" id="org.testng.eclipse" version="6.3.2.20111203_1323"><category name="org.testng.eclipse"/></feature><category-def name="org.testng.eclipse" label="TestNG">
    </category-def></site>

    br,

    //Mike
     
    mike, Sep 18, 2012
    #2
    1. Advertising

  3. mike

    Dr.Ruud Guest

    On 2012-09-18 10:35, mike wrote:

    > use LWP::UserAgent;
    > use LWP::Debug qw(+);
    >
    > #create User-agent
    > my $ua = LWP::UserAgent->new;
    >
    > $ua->no_proxy("<internalsite>.se");
    >
    >
    > my $url = "http://<internalsite>.se/org.testng.eclipse/site.xml";


    The cut lines can be replaced by:

    my $res= $ua->get( $url );

    > # check the outcome
    > if ($res->is_success) {
    > print $res->decoded_content;
    > }
    > else {
    > print "Error: " . $res->status_line . "\n";
    > }


    Also print Dumper( $res ) for details.

    --
    Ruud
     
    Dr.Ruud, Sep 19, 2012
    #3
    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. Brian Birtle
    Replies:
    2
    Views:
    2,103
    John Saunders
    Oct 16, 2003
  2. Ed Dearlove

    IIS6 POST request failing with 500 error

    Ed Dearlove, Aug 19, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    4,599
    Ed Dearlove
    Aug 19, 2004
  3. Axel
    Replies:
    8
    Views:
    1,189
    Adrienne Boswell
    Apr 27, 2009
  4. jotto
    Replies:
    4
    Views:
    418
    jotto
    Oct 2, 2006
  5. Naveen Dhanuka
    Replies:
    1
    Views:
    299
Loading...

Share This Page