Is a url like http://example.com/foo?bar valid?
I’m looking for a link to something official that says one way or the other. A simple yes/no answer or anecdotal evidence won’t cut it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The URI RFC doesn’t mandate a format for the query string. Although it is recognized that the query string will often carry name-value pairs, it is not required to (e.g. it will often contain another URI).
HTML establishes that a form submitted via HTTP GET should encode the form values as name-value pairs in the form "?key1=value1&key2=value2…" (properly encoded). Parsing of the query string is up to the server-side code (e.g. Java servlet engine).
You don’t identify what server-side framework you use, if any, but it is possible that your server-side framework may assume the query string will always be in name-value pairs and it may choke on a query string that is not in that format (e.g.
?bar). If its your own custom code parsing the query string, you simply have to ensure you handle that query string format. If its a framework, you’ll need to consult your documentation or simply test it to see how it is handled.