Forum OpenACS Q&A: What's the difference between ns_conn query and ns_getform?
Do they both return query in the HTTP request? (in GET it would be the query in the host/path?query, in POST it would be the host/path?query + query_as_body)
I am asking because I saw some code that is trying to pass-through existing form variables.. but somehow makes a point of appending the results from both ns_getform AND ns_conn query (see ad-security.tcl's proc_doc sec_read_security_info's section on "# Force the URL to look like [ns_conn location], if desired..." for an example) to compost the final pass-through query string. Seems like duplicated work to me. I asked this question here before but got on answer, any one wanna give it a shot?
ns_conn query is suppose to be defined as: "ns_conn find information about the current HTTP connection. ns_conn query returns any query data that was part of the HTTP request."
ns_getform is suppose to be defined as: "ns_getform return an ns_set that contains all of the query data that was part of the HTTP request. If there is query data (from either a form or multipart form data), ns_getform returns an ns_set that can be queried for that data. If there is no query data, "" is returned.
meaning with the GET method. Plus, it will return the actual
string of the query, not an ns_set. ns_getform will return an
ns_set of form values regardless of the form submission
method (get or post).
for handling multilingual user input, and ns_getform is
where the charset conversion from the user's encoding to unicode happens and is cached, so in the future if any
code wants to accept user form data in different encodings,
it should always get the bits from ns_getform.