1. URL syntax
<scheme>://<user>:<password>@
Related instructions:
Components |
Description |
Default Value |
Scheme |
which protocol to use when accessing the server for resources |
None |
user |
Some scenarios need to access resources User name |
anonymous |
password |
username may be included in the middle of the password, separated by a colon (:) delimited |
<e-mail address; |
host |
Resource host server is listening on. Many scenarios have a default port number (the default port number for HTTP) |
per scenario-specific |
path |
The local name of the resource on the server, with a slash (/) to the previous URL components are separated. The syntax of the path component is server-and schema-related , and the URL path can be divided into segments, each of which can have its own specific component |
none |
parameters |
Some scenarios might use this component to Specifies the input parameters. The parameter is a name/value pair. The URL can contain more than one parameter field, and they are and separated from each other by semicolons (;) delimited |
none |
query |
Some scenarios use this component to pass parameters to activate the application ( such as the number of libraries, bulletin boards, search engines and other Internet gateways). The contents of the query group component do not have a common format. With the character "? "Separates it from the remainder of the URL |
none |
fragment |
the name of a small slice or part of a resource. When referencing an object, the Frag field is not routed to the server, and this field is used internally by the client. separates it from the rest of the URL by the character "#" |
None |
For example:
Http://www.test.com/check.php?item=110&color=blue/index.html;graphics=true
There are two path segments check.php and index.html. Check.php has a query component item=110&color=blue
, and index.html has a parametric graphics with a value of true.
2. URL shortcuts
- Using relative URLs
Parsing based on the base URL
- Auto-expand URLs (combined with browser)
- Host name extension
- Historical expansion
3. URL encoding mechanismIn order to avoid the limitations of safe character set notation, a coding mechanism is designed to represent unsafe characters in URLs that represent unsafe characters by means of an "escape" notation that contains a percent semicolon (%). followed by two hexadecimal representations of the ASCII code of the character.
For example:
character |
ASCII code |
Sample URL |
~ |
126 (ox7e) |
Http://www.test.com/%7Ejoe |
Space |
(0x20) |
Http://www.test.com/more%20tools.html |
% |
Panax Notoginseng (0x25) |
Http://www.test.com/100%25lol.html |
4. URL character restrictionsIn the URL, several characters are reserved and have a special meaning. Some characters are not in the defined Us-ascii printable character set. Some of the characters will be confused with some Internet gateways and protocols and therefore deprecated.
Reserved and restricted characters
character |
Reserved/ | restricted
% |
Preserves the escape flag as a programming character |
/ |
Preserves delimiters as delimited path segments in the path component |
. |
reserved for use in path components |
.. |
reserved for use in path components |
# |
Reserved for use as a fragment delimiter |
? |
Reserved for use as a query string delimiter |
; |
Reserved for use as a parameter delimiter |
: |
Reserved as schema, user/password, and delimiter usage for host/port components |
$, + |
Keep |
@ & = |
There is a special meaning in the context of some scenarios, preserving |
{ }| \ ^~[] ' |
For various transport agent agents |
<> " |
Unsafe; These characters are usually meaningful outside the URL range. |
0x00-0x1f,0x7f |
Restricted, these hexadecimal range characters are not available in the US-ASCII character set Within the print interval |
>0x7f |
Restricted, hexadecimal characters in this range are not in the US-ASCII character set 7 in the binary range |
5. Future ProspectsURN (Uniform Resource Name): Used as a unique name for a specific content, regardless of where the resource is currently located. With these location-independent urns, you can move resources around.
6. References
- HTTP authoritative Guide
The URL of the thing