| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
String lift - String Face Lift drsimoni.com | String Tank Top - Classic World Gym Logo x-tremebodybuilding.com | Dental Supplies - First String Retraction Cord newlinemedical.com | for Collecting, Storing, and Querying Biological... obgyn.net |
In World Wide Web, a query string is the part of a Uniform Resource Locator (URL) that contains data to be passed to web applications such as CGI programs. The Mozilla URL location bar showing an URL with the query string title=Main_page&action=rawWhen a web page is requested via the Hypertext Transfer Protocol, the server locates a file in its file system based on the requested URL. This file may be a regular file or a program. In the second case, the server may (depending on its configuration) run the program, sending its output as the required page. The query string is a part of the URL which is passed to the program. Its use permits data to be passed from the HTTP client (often a web browser) to the program which generates the web page.
[edit] StructureA typical URL containing a query string is as follows:
When a server receives a request for such a page, it runs a program (if configured to do so), passing the A link in a web page may have a URL that contains a query string. However, the main use of query strings is to contain the content of an HTML form, also known as web form. In particular, when a form containing the fields
For each field of the form, the query string contains a pair field=value. Web forms may include fields that are not visible to the user; these fields are included in the query string when the form is submitted. This 'name then equal sign then value then ampersand or semicolon' convention is a W3C recommendation[1]. W3C recommends[2] that all web servers support semicolon separators in the place of ampersand separators. Technically, the form content is only encoded as a query string when the form submission method is GET. The same encoding is used by default when the submission method is POST, but the result is not sent as a query string, that is, is not added to the action URL of the form. Rather, the string is sent as the body of the request. [edit] URL encodingMain article: URL encoding Some characters cannot be part of a URL (for example, the space) and some other characters have a special meaning in a URL: for example, the character In particular, encoding the query string uses the following rules:
The encoding of SPACE as '+' and the selection of "as-is" characters distinguishes this encoding from RFC 1738. [edit] RFCAs defined in RFC 1738, a URL of scheme [edit] ExampleIf a form is embedded in an HTML page as follows: <form action="cgi-bin/test.cgi" method="get"> <input type="text" name="first"> <input type="text" name="second"> <input type="submit"> </form> and the user inserts the strings “this is a field” and “was it clear (already)?” in the two text fields and presses the submit button, the program first=this+is+a+field&second=was+it+clear+%28already%29%3F If the form is processed on the server by a CGI script, the script may typically receive the query string as an environment variable named [edit] TrackingA program receiving a query string can ignore part or all of it. If the requested URL corresponds to a file and not to a program, the whole query string is ignored. However, regardless of whether the query string is used or not, the whole URL including it is stored in the server log files. These facts allow query strings to be used to track users in a manner similar to that provided by HTTP cookies. For this to work, every time the user downloads a page, a unique identifier is chosen and added as a query string to the URLs of all links the page contains. As soon as the user follows one of these links, the corresponding URL is requested to the server. This way, the download of this page is linked with the previous one. For example, when a web page containing the following is requested: <a href="frank.html">see my page!</a> <a href="ciccio.html">mine is better</a> a unique string, such as <a href="frank.html?sdfsd23423">see my page!</a> <a href="ciccio.html?sdfsd23423">mine is better</a> The addition of the query string does not change the way the page is shown to the user. When the user follows, for example, the first link, the browser requests the page This way, any subsequent page request from this user will carry the same query string The main differences between query strings used for tracking and HTTP cookies are that:
[edit] Flexibility vs. securityA URL query string allows for flexibility in retrieving data from a web server and possibly from the database used to populate pages for that web server. A read only data store, such as a weather mapping service, is one example where URL query strings can be used with great flexibility. In some circumstances, a URL query string may expose security issues because it can be edited by a user to retrieve data that they do not have access to. In particular, a URL query string containing a username and password could be used with a dictionary attack to guess at valid login credentials to a particular web site. Most secure webservers use at least MD5 hash checking, or more powerful encoding methods to validate all given strings. [edit] Compatibility issuesAccording to the HTTP specification:
The HTML 3 specification declares that any attribute value (e.g. url in The specification does not dictate a minimum or maximum URL length, but implementation varies by browser and version. For example, Internet Explorer does not support URLs that have more than 2083 characters.[4][5] There is no limit on the number of parameters in a URL; only the raw (as opposed to URL encoded) character length of the URL matters. Web servers may also impose limits on the length of the query string, depending on how the URL and query string is stored. The common workaround for these problems is to use POST instead of GET and store the parameters in the request body. The length limits on request bodies are typically much higher than those on URL length. For example, the limit on POST size, by default, is 2 MB on IIS 4.0 and 128 KB on IIS 5.0.[6] [edit] See also[edit] References
[edit] External links |
| ↑ top of page ↑ | about thumbshots |