Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

not reading cookies from Edge

by Anonymous Monk
on Dec 05, 2022 at 19:40 UTC ( [id://11148575]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, My app reads the cookies from the server. Currently when i launch from the IE browser, I have no issues. But with Microsoft having retired IE and Edge being the browser, the server side cookies are either not created or being read. This is from the html file that reads the cookies and then picked up by the attributes.pl. I use perl 5, version 28, subversion 3 (v5.28.3).

#!/usr/bin/perl # # pmdss.pl - retrieve pmdss cookie info and construct the menu page fr +om pieces # use CGI; use CGI::Cookie; use HTML::Entities; $n = ""; $w = ""; $o = ""; $r = ""; $p = ""; $e = ""; $x = ""; sub retrieve_pmoss_cookie { # Get all available cookies my(%cookies) = fetch CGI::Cookie; my($q)=new CGI; print $q->header; $k = "PMOSSWEB"; if( defined $cookies{$k} ) { ($F1,$F2,$F3,$F4,$F5,$F6,$F7)= split(':',$cookies{$k}->value); ($junk, $UID) = split('=', $F1); ($junk, $NAME) = split('=', $F2); ($junk, $ORG) = split('=', $F3); ($junk, $REST) = split('=', $F4); ($junk, $PRIVS) = split('=', $F5); ($junk, $ENVIRON) = split('=', $F6); ($junk, $EXPIRES) = split('=', $F7); $w=$UID; $n=$NAME; $o=$ORG; $r=$REST; $p=$PRIVS; $e=$ENVIRON; $x=$EXPIRES; return(1); } else { print "The PMOSSWEB cookie not found\n"; return(0); } } chomp($utcnow=`/usr/5bin/date +%Y%m%d%H%M%S`); $i = retrieve_pmoss_cookie(); if ($i > 0) { if ($e ne "PROD") { print "The PMOSSWEB cookie is NOT a production cookie\n"; } else { if (($x - $utcnow) > 0) {

Replies are listed 'Best First'.
Re: not reading cookies from Edge
by kcott (Archbishop) on Dec 05, 2022 at 20:13 UTC

    If your code worked with IE, but no longer works with Edge, this probably isn't a Perl issue. Have you checked in Edge release notes, Microsoft knowledgebase, and similar documentation.

    The code you posted is incomplete and, therefore, can't be tested. It ends with:

    else { if (($x - $utcnow) > 0) {

    The path /usr/5bin/date looks dodgy with that "5" in the middle. That might be correct, but a more usual path is:

    $ which date /usr/bin/date

    You mention 'attributes.pl' but don't show its code or provide a link to its source: this is of no help to us.

    There's much you could do to improve the code presented. When you've sorted out the IE/Edge issue, come back and ask about that: we'll be happy to help.

    — Ken

Re: not reading cookies from Edge
by bliako (Monsignor) on Dec 05, 2022 at 22:40 UTC

    the new CGI; is understandable but this is harder to understand: fetch CGI::Cookie. Replace the first with CGI->new(); and the second with CGI::Cookie->fetch;

    And since you are there, this $utcnow=`/usr/5bin/date +%Y%m%d%H%M%S` does not look good. Can't you just say: use DateTime; $utcnow=DateTime->now(time_zone=>'UTC')->iso8601(); ?

    To start debugging your issues, do: 1) print all cookies fetched into %cookies (i.e. the problem may be with the cookie name), 2) open developer tools in your browser (does the buggy MS-edge-crap have any?) and see if any cookies are set and under what names. It could even be that your back-end does not recognise the MS-edge-crap agent string and bombs even on the prospect of talking to it. brrrrr

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11148575]
Approved by kcott
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-18 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found