Folks:

I am using the Net::HTTP package in building a small http client.  I am
trying to reuse an existing mechanism to talk to a db service through a
servlet rather than code a new application in perl.

Since I need to issue several http GET requests, cookies are used to
keep session state.  The problem is that the Net::HTTP package does not
expose the cookie.

Here is the perl http client code:
------------------------------------------------------------------------
--------------------------------------------------------------------
use Net::HTTP;

 $product_id = $ARGV[0];
 $doc_title = $ARGV[1];
 $hname = $ARGV[2];
 
 my $buf;

 #log into the host
 print "SENDING login command\n";
 my $s = Net::HTTP->new(Host => $hname, keep_alive => TRUE) || die $@;
 $login_request = "/XXX/home.jsp?NT_ID=ntid";
 $s->write_request(GET => $login_request, 'User-Agent' =>
"Mozilla/5.0");
 ($code, $mess, %h) = $s->read_response_headers;
 print "LOGIN CODE: ", $code, "\nMESS  ", $mess, "\nh  ", %h,"\n";

 #read login response page
 print "READING login request\n";
 while (1) {
    my $n = $s->read_entity_body($buf, 4096);
    last unless $n;
    #print $buf;
 }
------------------------------------------------------------------------
------------------------------------------------------------------------
---------------------
The line ($code, $mess, %h) = $s->read_response_headers; returns some
header info but not access to the cookie.  I believe the cookie is
embedeed in the %h hash.  Does anyone have any ideas?

 Joe Gajewski
MLIM Information Technology
(609) 274-4564
[EMAIL PROTECTED] 
--------------------------------------------------------
 
If you are not an intended recipient of this e-mail, please notify the sender, delete 
it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click 
here for important additional terms relating to this e-mail.     
http://www.ml.com/email_terms/ 
--------------------------------------------------------
 

Reply via email to