Greetings, esteemed monks!

I have a very basic security set up for a web-based system I wrote that uses a .htaccess file and is (obviously) hosted on Linux. It has just one line Require statement: Require valid-user. My .htpasswd file has one entry, which contains the credentials needed to access the system. So far, so good. However, one of the CGI scripts actually sends a POST message to one of the other CGI scripts. When I initailly set up the system, I had no security, and naively thought I could just add .htaccess/.htpassword security and be done with it. Well, this request from one CGI script to the other no longer works, and the error I get is '401 Unauthorized.'

So I know I could just append the un/pw data to the post, but I am wondering if there is a "better way" to do this. Add another user to the .htpasswd file? My understanding of this is rudimentary at best.

Thanks.

Edit: Adding credentials to the LWP::UserAgent did not do the trick. I used $ua->credentials( $netloc, $realm, $uname, $pass ) with domain.com:80, "Some Realm," and the user name and password, and I am still getting 401. Help!


In reply to Best practice for letting my CGI scripts access another password protected CGI script? by OfficeLinebacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.