Gossamer Forum
Home : Products : Gossamer Links : Discussions :

[BUG] in clean_output()

Quote Reply
[BUG] in clean_output()
Hi Alex,

There is a bug in the clean_output() subroutine.
Regardless to our other discussion (to change usage of clean_output() to dynamic URL assigning at the starting of cgi scripts) this bug should be corrected in clean_output().

The BUG:
clean_output() is not checking, whether there are already same parameters as $CFG{dynamic_preserve} in the URL or not. It is adding dynamic_preserve parameters, regardless that there is already such parameter or not.

Example:
$CFG{dynamic_preserve} = t,d,s,page,order

a) Original URL is: http://www.site.com/cgi-bin/lsql/page.cgi?d=1&page=3&order=a

b) The replaced URL will be: http://www.site.com/cgi-bin/lsql/page.cgi?d=1&page=3&order=a&d=1&page=1&order=d
(we suppose that the input values in $IN was: d=1&page=1&order=d)

As you see in the result URL, clean_output() it is adding dynamic_preserve parameters additionally to the original ones (so there will be duplicate parameters).
However it should ignore those additions, because the parameters in the actual URL should have higher priority, than the dynamic_preserve input parameters in $IN, so if a parameter exists in
both original URL & $IN then addition of that parameter from $IN should be ignored!

I hope this is clear.
Let me know if there are still questions.

A patch would be fine to be posted here, after if is corrected.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Alex, did you miss that bug report?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Just bringing to top again.
Alex, I'm still curious what you think about this bug.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Still unanswered, so kicking to top again. Alex, check this important bug.
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
If it's extremly important to you, then you should contact Gossamer Threads through more 'official' channels. Try:

http://www.gossamer-threads.com/support/index.htm

- wil
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
What module is clean_output in?
Quote Reply
Re: [Wil] [BUG] in clean_output() In reply to
Wil,

We talked with Alex, some similar other features here in the forum.
I suppose he would suggested me to contact the support through 'official' channels, if he would want this.

It seems he was busy nowadays, because he wasn't on the forum too much. But this doesn't mean, that if he reads the post, he will not answer it. I suppose just missed it.

However you are right. If this bug is so important for me, I should contact the company support directly. I will do.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Apr 3, 2002, 4:51 AM
Quote Reply
Re: [Paul] [BUG] in clean_output() In reply to
Paul,
it is in Links.pm as I remember. I will check it in a minute.
Yes, there is. I checked.

The only place in LSQL, where the clean_output() is called, is from sub user_page (also placed in Links.pm).

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Apr 3, 2002, 4:50 AM
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Hmm looking at the code it looks like it should use your custom value if it exists already as a parameter...how are you getting the wrong result.

What exactly are you doing?

Last edited by:

Paul: Apr 3, 2002, 4:59 AM
Quote Reply
Re: [Paul] [BUG] in clean_output() In reply to
You should find that in my original post. I try to clarify below.

I have a few parameters, I have to preserve, like 'order'.
I also have links, where the user can click, to change the order of links.

But if a link already has the parameter 'order', clean_output will also add his own 'order' to preserve it... So there will be duplicate 'order' parameters. Check my example in my original post.

It should check, if there is already an 'order' parameter in the link, then should keep the one from the link, since the parameter in the link must have higher priority, than the one is preserved.
So the 'order' parameter in the link should override, the one we preserved from other page.

Do you see now?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Apr 3, 2002, 6:07 AM
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Ok I just tested and I don't have this problem.

eg...I have t,d,s as preserves and also added "foo"

If I go to:

page.cgi?d=1&s=2&t=av&foo=bar ....thats how it stays.

Last edited by:

Paul: Apr 3, 2002, 6:16 AM
Quote Reply
Re: [Paul] [BUG] in clean_output() In reply to
Paul,

I also tried. It is NOT working fine.
I still think it is a bug.

So try this:
use t,d,s,foo as preserves
and
pass parameters from URL:
page.cgi?d=1&foo=fromURL

print out the link (I'm doing this from my plugin):
$sort_link = <a href="$CFG->{build_category_url}?foo=2">Link</a>

So the result will be:
page.cgi?foo=fromLink&d=1&foo=fromURL

But the result should be:
page.cgi?d=1&foo=fromLink

You should get the same result, at least I hope Wink

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] [BUG] in clean_output() In reply to
Hi,

Yes this is a bug. You can't put anything in dynamic_preserve in a template, or clean_output will mess it up in dynamic mode.

dynamic_preserve wasn't really meant for that though, it was designed so that if you pass in a variable to page.cgi, it will preserve it throughout (like a shopping cart session id). It wasn't meant to have these variables on a template.

I'm looking into a fix.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] [BUG] in clean_output() In reply to
I understand, what was the original purpose of dynamic_preserve feature, but as you see, the usage possibilities are extending... There are also other possibilities for usage...

I'm waiting your bug fix.
This bug fix is necessary for my current developments.

Thanks,
Webmaster33