Forum OpenACS Q&A: Response to Error: can't read "query" no such variable while....

Well, with the grep command i could detect wich  *.tcl is reporting de bug.

it's in web/myserver/packages/acs-core/request-processor-procs.tcl

but i don't know what happens. That's a file of ACS and i never edit it.

Here is the code with the problem:

            if { [ad_parameter ForceHostP "" 1] } {

                rp_debug "Checking the host header"

                set host_header [ns_set iget [ns_conn headers] "Host"]

                regexp {^([^:]*)} $host_header "" host_without_port

                regexp {^https?://([^:]+)} [ns_conn location] "" desired_host_without_port

                if { ![empty_string_p $host_header] &&
                        ![string equal $host_without_port $desired_host_without_port] } {

                    rp_debug "Host header is set to "$host_header"; forcing to "[ns_conn location]""

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

ad_returnredirect "[ns_conn location][ns_conn url]$query"
return "filter_return"

                }

            }

I think that the problem is that [ns_getform] don't return nothing and then... query doesn't exist.

Any new idea?

Thanks again!