472,958 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

How to redirect headers in Perl?

Hi:

I am new to Perl. I need to write a Perl page on the server that
will do an auto login to a site. I have got the following code. It
works for the first page, but on subsequent page, user is prompted for
credential again. I suspected the issue has something to do with
cookies. I want to pass the header from the secure site to the
client, but I don't know how to do it. May be I approached the
problem the wrong way. Thanks for the help.
use LWP;
use CGI;

# get input parameters
my $user = "user1";
my $password = "password1";
my $url = 'http://pages_need_authentication';

my $ua = new LWP::UserAgent;
my $req = new HTTP::Request (GET => $url);

$req->authorization_basic ($user, $password);
my $request = $ua->request ($req);

my $page = $request->content;

# I generate a new header here, because I don't know how to grab the
header from request.
print "Content-type: text/plain\n\n";
print $page;


Crazy Monkey
Jul 19 '05 #1
2 4783
Well. I was able to "jam" the cookie setting into the header and it
did not solve my problem. I used a tool to look at the request and
the responses. I see that the cookie is set properly. What I lack is
the the authorization line? When I hit the secure site directly and
login properly, I see the following line been sent to the server in
the header on almost all of the my requests. By the way, the login is
not a web page login, but a Realm login (Windows Pop-up box).

Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxx

I used the authorization_basic( $user, $password ) in my Perl code,
but the authentication is not sticking. It works for the page that I
am fetching through the Perl. By the way, the Perl page is located on
a web server. It is not on the client machine.

Thanks.
Crazy Monkey
Jul 19 '05 #2
> Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxx

I used the authorization_basic( $user, $password ) in my Perl code,
but the authentication is not sticking. It works for the page that I
am fetching through the Perl. By the way, the Perl page is located on
a web server. It is not on the client machine.

There are times, you have to cut your losses. After spent two days on
this, we decided NOT to use the autologin feature. Instead, we are
going to let user authenticate themselves.

If someone has an idea on how to do windows Basic authentication on a
server and make it stick on a client, I am still interested for future
reference.

Crazy Monkey
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
1
by: Lincoln Yeoh | last post by:
Sorry to repost this but I still haven't figured it out and there weren't any responses. --- Say I use iptables to redirect tcp connections to my perl proxy servers. How then do I get the...
6
by: Omid | last post by:
Hi. I have problems when I try to redirect everything that is sent to cout to a file. I have one piece of code that works and one that does not work. The only difference is which headers I use....
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
22
by: Platero | last post by:
Hi, I've a stupid question but... The code is the following: if(($role!='tutor')&&(array_key_exists('tutor_id',$_GET))) { $possible_ids = array(2,6,7,8,9,10); $t_id = $_GET;
12
by: gigi | last post by:
How to send more than one value using response redirect? For example i can send one like this response.Redirect "pregled.asp?ime=" & strUserName but how to send two or more values? I tried...
18
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location:...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.