Forum OpenACS Q&A: URL Vars DOUBLE or your Money Back!

I have an unsubscribe link in our admin email system to allow people to unsubscribe by clicking a weblink and having a nice web page come up to say...

"Bye Bye Now!...(Barby - ToyStory II outtakes)"

So the link looks like:

http://greatestnetworker.com/unsub.tcl?x=348477&e=3242

But when my browser either IE5 or NS4 comes up, the URLVARS DOUBLE like this:

http://www.greatestnetworker.com/unsub.tcl?
x=348477&e=3242&x=348477&e=3242

It seems that the internal AOLserver redirect from
...//great... to
...//www.great...
causes the variables to double... This is not a killer, the vars are the same and the link works, but it may be a issue with long urls...and limits.

I left the www. out to save space and reduce the chance of the url wrapping in some email clients.

I'm using AOLserver/3.3.1+ad13 and Jerry's virtual hosting and this (minor) bug may play directly into specifics of his mods...

-Bob

Collapse
Posted by Jerry Asher on
Perhaps.  I've never seen anything like this reported with my patches, but as you well know, redirects and IE 5 have had problems that get expressed in my patches, so I am not saying it couldn't be.

Do you see this when you include the port number (and so bypass nsvhr?)  Do you see this when you use nsvhr/nssock (and not nsvhr/nsunix?)

Collapse
Posted by MaineBob OConnor on
Hi Jerry,

Yes it still occurs when I use the port number and it occurs
with the Netscape 4.6 browser.

<blockquote> Do you see this when you use nsvhr/nssock (and not nsvhr/nsunix?)
</blockquote>

How do I switch from nssock to nsuinx and back?

-Bob

Collapse
Posted by MaineBob OConnor on

Ah Ha... Here is the "DIRECT" test Jerry using your server! 😊

Click this link:
http://theashergroup.com/index.adp?x=1

And you get back in your browser is:
http://theashergroup.com/index.adp?x=1&x=1 -Bob

Collapse
Posted by David Eison on
I don't know if this problem was ever in OpenACS, but from your description it sounds like it. At least a few versions of ACS used to have a problem where they included vars twice on force-host redirects. Here's my old writeup/fix:

This is a bug in the implementation of ForceHostP in the request processor. Below is the code w/ an explanation of what's wrong and a simple fix (from request-processor-procs.tcl):


                    set query [ns_conn query]
                    if { $query != "" } {
                        set query "?$query"
                        if { [ns_getform] != "" } {
                            set query "$query&[export_entire_form_as_url_vars]"
                        }
                    } elseif { [ns_getform] != "" } { 
                        set query "?[export_entire_form_as_url_vars]"
                    }
                    ad_returnredirect "[ns_conn location][ns_conn url]$query"

First, it gets the query string, and uses it if present. Then, it checks for a form, and uses it if present (in addition to the query string, if that was used). However, getting the form seems to also get query variables, so the query string is found twice. This can easily be fixed by just using the second part:

if { [ns_getform] != "" } { 
    set query "?[export_entire_form_as_url_vars]"
}

www.aolserver.com says ns_getform returns "an ns_set that contains all of the query data that was part of the HTTP request", which would seem to imply that it will always include the query string.
Collapse
Posted by MaineBob OConnor on

David wrote:
I don't know if this problem was ever in OpenACS

Well, I just tested with open ACS and it works backwards. Paste this into your browser:

http://www.openacs.org?x=1

And get redirected to:

http://openacs.org?x=1&x=1

Note that my example for Jerry's site didn't show the www in the result line above.

-Bob