You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by eamondaly <ea...@fastweb.com> on 2002/04/25 05:55:09 UTC

When is session-id injected into URLs?

I'm trying to add a cleaner to Script_OnFlush so that our pages
will validate properly at http://validator.w3.org/:

  sub Script_OnFlush {
    my $data = $Response->{BinaryRef};

    # This is experimental. Allows our docs to validate HTML 4.01 by
    # converting '&' to '&amp;' in hrefs.

    $$data =~ s{href=["']([^"']+?)["']}{ my $url = $1;
                                         $url =~ s/&/&amp;/g;
                                         qq{href="$url"}
                                       }sgie;
  }

Am I correct in assuming the session-id is injected /after/ the
Script_OnFlush event? If so, can anyone think of a workaround
other than the overhead of HTML::Filter?


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: When is session-id injected into URLs?

Posted by Joshua Chamas <jo...@chamas.com>.
eamondaly wrote:
> 
> I'm trying to add a cleaner to Script_OnFlush so that our pages
> will validate properly at http://validator.w3.org/:
> 
>   sub Script_OnFlush {
>     my $data = $Response->{BinaryRef};
> 
>     # This is experimental. Allows our docs to validate HTML 4.01 by
>     # converting '&' to '&amp;' in hrefs.
> 
>     $$data =~ s{href=["']([^"']+?)["']}{ my $url = $1;
>                                          $url =~ s/&/&amp;/g;
>                                          qq{href="$url"}
>                                        }sgie;
>   }
> 

If you look at the Apache::ASP::Response::Flush routine, you will 
find that Script_OnFlush gets called BEFORE these ASP Flush() 
fixup actions:

  XSLT
  FormFill
  Clean
  SessionQueryParse
  CompressGzip
  SendHeaders
  --- write output ---

While, having it run before is fairly arbitrary, it seems to make
sense that all of the above actions would happen after Script_OnFlush()
so they could also work on your Script_OnFlush output.  What you want
is the final event after the above translations ( well before Clean
and CompressGzip I imagine. )  We might call this:

sub Script_OnFlushFixup()

so the order would be:

  Script_OnFlush()
  XSLT
  FormFill
  SessionQueryParse
  Script_OnFlushFixup() ***
  Clean
  CompressGzip
  SendHeaders
  --- write output ---

What it sounds like you really want though is for 
SessionQueryParse to handle & "correctly" and have it 
auto escape & to &amp; ... my only concern with this
is I do not know the browser compability issues with
this if there are any... do ALL browsers treat &amp;
in URLs correctly as & when the URLs are in HTML 
tag attributes?  I know some browsers do, but I am 
concerned with the prospect of changing the behavior
for what seems to work fine already.

-- Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org