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, Dec 7, 2005.

  1. sisapinusa

    sisapinusa Guest

    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

    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
    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.
    sisapinusa, Dec 7, 2005
    1. Advertisements

  2. sisapinusa

    John Bokma Guest

    $request = HTTP::Request->new(GET => '');
    John Bokma, Dec 7, 2005
    1. Advertisements

  3. 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 => '');

    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 Pendley, Dec 7, 2005
  4. sisapinusa

    sisapinusa 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

    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="">Zeus

    But if I try below line, it doesn't work.
    $req = HTTP::Request->new(GET =>

    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-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="">Zeus

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

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

    Thanks you
    sisapinusa, Dec 8, 2005
  5. wrote in
    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.
    It appears that the correct URL is


    The trailing slash matters.
    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.
    Whining and pleas rarely elicit sympathy, but mainly serve to annoy

    A. Sinan Unur, Dec 8, 2005
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.