It's simple code but I got 400 URL must be absolute and it says it's a Internal response

Discussion in 'Perl Misc' started by sisapinusa@gmail.com, Dec 7, 2005.

  1. Guest

    Hello,
    I'm perl beginner.
    It's quite simple question.

    I'm testing below code:

    $req = HTTP::Request->new(GET => '/performers/ HTTP/1.1');
    $req->header(Host => 'kihong.dev003.ent');
    $res = $ua->simple_request($req);

    but only I got this:

    400 (Bad Request) URL must be absolute
    Content-Type: text/plain
    Client-Date: Wed, 07 Dec 2005 22:33:22 GMT
    Client-Warning: Internal response

    400 URL must be absolute

    It says it's "internal response", that means it's from perl module
    itself.

    As you can see in my code, I need to send this HTTP header

    GET /performers/ HTTP/1.1
    Host: kihong.dev003.ent

    So I coded in C language same thing for test, then of course it works
    fine.
    What's wrong with me? Isn't it simple header?

    Please help me out, it's my first step, but I got stuck ;;

    Thank you.
     
    , Dec 7, 2005
    #1
    1. Advertising

  2. John Bokma Guest

    wrote:

    > Hello,
    > I'm perl beginner.
    > It's quite simple question.
    >
    > I'm testing below code:
    >
    > $req = HTTP::Request->new(GET => '/performers/ HTTP/1.1');


    RTFM:
    $request = HTTP::Request->new(GET => 'http://www.example.com/');


    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    I ploink googlegroups.com :)
     
    John Bokma, Dec 7, 2005
    #2
    1. Advertising

  3. Re: It's simple code but I got 400 URL must be absolute and it saysit's a Internal response

    writes:

    > I'm testing below code:
    >
    > $req = HTTP::Request->new(GET => '/performers/ HTTP/1.1');
    > $req->header(Host => 'kihong.dev003.ent');


    That's *not* how the docs say to do that. The example given in the HTTP::
    Request docs is this:

    $request = HTTP::Request->new(GET => 'http://www.example.com/');

    Don't micro-manage the process. HTTP::Request knows what version of HTTP it
    wants to use, and how to split the URL up so that the path and hostname will
    appear where they're supposed to.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Dec 7, 2005
    #3
  4. Guest

    Thank you guys very much.
    But there is one more strange.

    I tried below line, and it works find.
    $req = HTTP::Request->new(GET => 'http://kihong.dev003.ent/performers
    HTTP/1.1');

    I got HTTP below header as I expected
    HTTP/1.1 302 Moved Temporarily
    Server: Zeus/4.3
    Date: Wed, 07 Dec 2005 21:53:18 GMT
    Set-Cookie: SC=okay; domain=kihong.dev003.ent
    Content-Length: 212
    Location: /performers/?SC=C
    Content-type: text/plain
    Content-Type: text/html

    <html><head><title>Error 302 Moved Temporarily
    </title></head><body bgcolor=#ffffff><h2>Error 302 Moved Temporarily
    </h2><p><i>Powered by <a href="http://errors.zeus.com/">Zeus
    Technology</a></i></body></html>

    But if I try below line, it doesn't work.
    $req = HTTP::Request->new(GET =>
    'http://kihong.dev003.ent/performers');

    I got below HTTP.
    HTTP/1.1 301 Moved Permanently
    Date: Thu, 08 Dec 2005 15:22:22 GMT
    Location: http://kihong.dev003.ent/performers/
    Server: Zeus/4.3
    Content-Length: 212
    Content-Type: text/html
    Client-Date: Thu, 08 Dec 2005 15:22:30 GMT
    Client-Peer: 10.4.12.5:80
    Client-Response-Num: 1
    Title: Error 301 Moved Permanently

    <html><head><title>Error 301 Moved Permanently
    </title></head><body bgcolor=#ffffff><h2>Error 301 Moved Permanently
    </h2><p><i>Powered by <a href="http://errors.zeus.com/">Zeus
    Technology</a></i></body></html>

    Only the different is, HTTP/1.1 string. I took me some time to find
    out.
    But I want to know why. Is it Zeus server problem? or..

    If you guys have any idea, pleaaase let me know..
    Please...

    Thanks you
     
    , Dec 8, 2005
    #4
  5. wrote in news:1134056008.819387.51320
    @z14g2000cwz.googlegroups.com:

    > Thank you guys very much.
    > But there is one more strange.
    >
    > I tried below line, and it works find.
    > $req = HTTP::Request->new(GET => 'http://kihong.dev003.ent/performers
    > HTTP/1.1');


    You must think that you can just keep on making stuff up until it works.

    Note that the string " HTTP/1.1" in your request does *not* specify the
    protocol to use.

    > I got HTTP below header as I expected
    > HTTP/1.1 302 Moved Temporarily
    > Server: Zeus/4.3
    > Date: Wed, 07 Dec 2005 21:53:18 GMT
    > Set-Cookie: SC=okay; domain=kihong.dev003.ent
    > Content-Length: 212
    > Location: /performers/?SC=C


    It appears that the correct URL is

    http://kihong.dev003.ent/performers/

    The trailing slash matters.

    > But I want to know why. Is it Zeus server problem? or..


    Since you haven't told us the correct URL, we cannot observe how the
    server behaves.

    In the absence of any concrete information, it is a safe bet to assume
    that you are doing something wrong.

    > If you guys have any idea, pleaaase let me know..
    > Please...


    Whining and pleas rarely elicit sympathy, but mainly serve to annoy
    people.

    Sinan
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Dec 8, 2005
    #5
    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. Dan C Douglas
    Replies:
    5
    Views:
    417
    Dan C Douglas
    Jul 22, 2003
  2. =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=

    Response.Redirect() and absolute URL links and User Control questi

    =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=, Feb 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    983
    Steve C. Orr [MVP, MCSD]
    Feb 4, 2005
  3. =?Utf-8?B?UGF1bCBCb25mYW50aQ==?=

    Response.Redirect() converts relative URL to absolute URL

    =?Utf-8?B?UGF1bCBCb25mYW50aQ==?=, Apr 24, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    6,226
    bruce barker \(sqlwork.com\)
    Apr 25, 2006
  4. guenther schoebel
    Replies:
    2
    Views:
    6,517
    Eric Cartman
    Oct 10, 2003
  5. Jeff
    Replies:
    3
    Views:
    405
    Alexey Smirnov
    Feb 1, 2010
Loading...

Share This Page