473,466 Members | 1,296 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 4799
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:...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.