Query string: Difference between revisions

Content deleted Content added
URL Encoding: the = is not encoded
simplified + typical request + percent encoding is discussed below
Line 5:
When 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. This way, the URL can encode some data that is accessible to the program generating the web page.
 
==SyntaxStructure==
 
The URLs of documents to be generated by programs may contain a query string that is passed to the program. A typical such URL is as follows:
URLs that identify files on the server have typically the following form (URLs may be quite more complicated):
 
:<code><nowiki>http://server/path/file</nowiki></code>
 
If the requested web page is to be generated by a program, the URL can be constructed as follows:
 
:<code><nowiki>http://server/path/program?query_string</nowiki></code>
Line 23 ⟶ 19:
* The query string is composed of a series of field=value pairs
* The field-value pairs are each separated by an [[equal sign]]
* Each value is [[percent encoding|percent encoded]]
* The series of pairs is separated by the [[ampersand]], '&' (also by ';' in the newer [[W3C]] recommendations [http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2])</div>
 
Line 37 ⟶ 32:
 
The space character can be also represented by <code>+</code>.
 
==RFC==
 
As defined in RFC 1738, an URL of scheme <code>http</code> can contain a ''searchpart'' following the rest of the URL and separated from it by a <code>?</code> character. RFC 3986 specifies that the ''query component'' of an [[URI]] is the part between the <code>?</code> and the end of the URI or the character <code>#</code>. The term ''query string'' is of common usage for referring to this part for the case of HTTP URLs.
 
==Example==
Line 84 ⟶ 83:
* [[HTTP cookie]]
* [[Web beacon]]
 
==External links==
 
* RFC 1738
* RFC 3986
 
[[Category: Internet]]