URL Schemes (Applications / Access Methods) and Scheme-Specific Syntaxes
(Page 2 of 5)
World Wide Web / Hypertext Transfer Protocol URL Syntax (http)
The Web potentially uses most of the elements of the common Internet scheme syntax, as follows:
As discussed in the overview, the Web is the primary application using URLs today. A URL can theoretically contain most of the common URL syntax elements, but in practice most are omitted. Most URLs contain only a host and a path to a resource. The port number is usually omitted, implying that the default value of 80 should be used. The <query> construct is often used to pass arguments or information from the client to the Web server.
I have provided full details on how Web URLs are used in a separate topic in the section on HTTP.
The syntax for FTP URLs is:
FTP is an interactive command-based protocol, so it may seem odd to use a URL for FTP. However, one of the most common uses of FTP is to access and read a single, particular file, and this is what an FTP URL allows a client to do. The <user> and <password> are used for login and may be omitted for anonymous FTP access. The port number is usually omitted and defaults to the standard FTP control channel port, 21.
The <url-path> is interpreted as a directory structure and file name. The appropriate CWD (change working directory) commands are issued to go to the specified directory, and then a RETR (retrieve) command is issued for the named file. The optional type parameter can be used to indicate the file type: a to specify an ASCII file retrieval or i for an image (binary) file. The type parameter is often omitted from the URL, with the correct mode being set automatically by the client based on the name of the file.
For example, consider this URL:
This is equivalent to starting an FTP client, making an anonymous FTP connection to ftp.hardwarecompanyx.com, then changing to the drivers directory and retrieving the file widgetdriver.zip. The client will retrieve the file in binary mode because it is a compressed zip file.
It is also possible to use an FTP URL to get a listing of the files within a particular directory. This allows a user to navigate an FTP server's directory structure using URL links to find the file he or she wants, and then retrieve it. This is done by specifying a directory name for the <url-path> and using the type parameter with a <typecode> of d to request a directory listing. Again, the type parameter is usually omitted and the software figures out to send a LIST command to the server when a directory name is given in a URL.
Home - Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.