in reply to Re: 400 URL must be absolute
in thread 400 URL must be absolute

Thanks a lot, it helps me with the "400 URL must be absolute" error. I'm not a programmer, let alone a "PerlMonk". I have to get my knowledge from what I can find on the internet and that is not always clear.

But... now i get a "401 Unauthorized" error. Because I know now the URL must be OK and the user and password are OK, the problem must be the realm (?). I got the in de sub given realm with the script:

lwp-request -e http://88.159.57.235/roots/lines/wielinga/wie-aaa/wie-s +le/wie-hee/wie-bru/pien.htm

with the response:

401 Unauthorized Connection: close Date: Tue, 05 Apr 2022 09:21:04 GMT Accept-Ranges: bytes ETag: "8b2-5d3194c961ede" Server: Apache/2.4.41 (Ubuntu) WWW-Authenticate: Basic realm="Maintenance Guard" Content-Length: 2226 Content-Type: text/html Last-Modified: Tue, 14 Dec 2021 11:14:56 GMT Client-Date: Tue, 05 Apr 2022 09:21:04 GMT Client-Peer: 88.159.57.235:80 Client-Response-Num: 1 Title: Customized Error 401 X-Meta-Author: W.J.Nijs X-Meta-Robots: noindex

Is there an other way to get the right realm?

Replies are listed 'Best First'.
Re^3: 400 URL must be absolute
by cavac (Prior) on Apr 05, 2022 at 09:56 UTC

    Your code in the original post say real='Privacy Guard', but the lwp-request headers ask for realm='Maintenance Guard'.

    So the correct realm on your code would be 'Maintenance Guard', i guess.

    Also make sure you get upper/lowercase of all authentication fields correct (username, password, realm).

    I can't really test your setup. For that, i would need username+password, but i will never ask for that unless you are a paying customer of my employer due to all sorts of legal and insurance reasons. So do not post the authentication data. The only thing i can advise you to do is to check if your authentication data is correct by using your browser to log in.

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
Re^3: 400 URL must be absolute
by Wijnand (Initiate) on Apr 05, 2022 at 10:10 UTC

    Or have i use the URI instead of the URL for $url with the user and pass in the URI? Is that save?

      You have been using http instead of https throughout so nothing is safe.


      🦛

      use the URI instead of the URL

      Recommended reading: The Difference Between a URL, URI, and a URN

      Every URL is an URI, but not every URI is an URL. URLs can have a userinfo part, but nowadays that is considered insecure (especially if a password is included) and rarely used anymore.