[ic] Interesting Failure Reading Scratch Variables from Session

Kevin Walsh interchange-users@icdevgroup.org
Thu Jul 18 06:12:00 2002


> > 
> > BTW, this can easily be tested.  Using the following data on your ic
> > server,
> > retrieve with a newer browser and an older browser if you have it the
> > following files in this order:
> > 
> > test_putvar.html
> > test_getvar.html  (should show ABC)
> > test_putvar_noimage.html 
> > test_getvar.html  (should fail to show DEF on newer browser because the
> > session switched)
> > 
> > 
> > test_putvar.html:
> > ---------------------------------------------------
> > <html>
> > <body>
> > 
> > [set whatever]ABC[/set]
> > <p>
> > This is a test.
> > </p>
> > 
> > </body>
> > </html>
> > ---------------------------------------------------
> > 
> > test_getvar.html:
> > ---------------------------------------------------
> > <html>
> > <body>
> > 
> > <p>
> > This is a test - retrieve the value:
> > [perl]
> > $Scratch->{whatever};
> > [/perl]
> > </p>
> > 
> > </body>
> > </html>
> > ---------------------------------------------------
> > 
> > test_putvar_noimage.html:
> > ---------------------------------------------------
> > <html>
> > <body>
> > 
> > [set whatever]DEF[/set]
> > <IMG SRC="/im_not_here.jpg">
> > <p>
> > This is a test.
> > </p>
> > 
> > </body>
> > </html>
> > 
> Actually your test shouldn't show ABC... It is done wrong...
> 
> [set test]ABC[/set]
> 
> [perl]
>   my $out = '';
>   $out = $Scratch->{test};
>   return $out;
> [/perl]
> 
> Would return an output of you scratch variable. Not what you are doing.
> 
I can't see anything that's done wrong there.  That 'corrected' Perl
block does the same job as the original test code, but with a couple
of extra lines of code and an unnecessary variable.  Of course, using
[perl] in that context is an overkill anyway, but it's just a test
after all.

Back to the reported problem:  As far as I can see, the only thing
that would prevent the session being passed from one page to the next
would be if cookies were disabled and the tester typed in the page
names, such as "test_getvar.html", in turn and with no session ID.

I've not been able to recreate the session problem using the above
code with cookies switched on.  With cookies switched off, a new
session is created for every page, as would be expected.  Images,
broken or otherwise, can't have any effect on Interchange sessions
as they shouldn't be served by Interchange at all.

Test results:

  test_putvar.html         - This is a test.
  test_getvar.html         - This is a test - retrieve the value: ABC
  test_putvar_noimage.html - This is a test.
  test_getvar.html         - This is a test - retrieve the value: DEF 

Browsers:

  Opera 6.01
  Internet Explorer 5.5
  Netscape 6.1
  Mozilla 1.0

I'm reasonably sure that at least some of those browsers are considered
to be new.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/