|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Modes for File TransfersThe FTP protocol supports several modes for transferring files. The most important is image or binary mode, which makes a byte-by-byte copy of the file. This is the mode to use when transferring programs, compressed data, or image files. Also important is ASCII or text mode, which is designed for transferring plain, printable text files. This mode is useful because it corrects for the fact that PCs, Macintoshes, UNIX, and other operating systems use different characters to mark the end of a line of text. In particular, Macintoshes use the carriage-return character CR; UNIX computers use the line-feed character LF; and DOS/Windows computers use both CR and LF (often written CRLF). In ASCII mode, FTP automatically converts between these three end-of-line markers to ensure that the received file has the new line codes appropriate to the local system. You cannot use this mode to transfer programs, however, since programs and data files contain bytes with the same codes as CR or LF charactersunder ASCII mode, these codes are converted into the new-line codes appropriate to the local system, thereby corrupting the content of binary files. The FTP protocol has no knowledge of the data content of a file and must be told what mode to use in a file transfer. Thus, your WWW browser must have some way of determining the data type of a file being accessed via an ftp URL. Some browsers guess the type from the suffix of the filename, using a browser database that maps filename suffixes onto data types. This is not ideal, since the true type is only known by the author who constructed the URL and who created the resource referenced by the URL.
FTP Typecode StringsAuthors can use URL typecode strings to specify the desired transfer mode. For example, the following URL ftp://ftp.mysite.edu/path/splunge.txt;type=a indicates that the designated resource (the file splunge.txt) should be retrieved using ASCII mode. The special semicolon character is used to separate the end of the resource locator string from the type indicator. Other possible type indicators are type=i for image (binary) transfers and type=d for directory listings. Typecode strings are optional, the default being binary data transfers. Fragment identifiers, if used, must be placed after the typecode stringfor example: ftp://ftp.somesite.edu/path/goof.html;type=a#location
Gopher URLsGopher servers can be accessed via URLs in a manner that looks superficially similar to ftp or http URLs but that is, in fact, quite different. This is because Gopher resources are referenced using a combination of resource identifier codes and selector strings, and not directories and files. Resource identifiers are single-digit codes that specify the type of the Gopher resourcefor example, that it is a text file, a directory, or a searchable index. The Gopher selector string is just a symbolic name associated with this resource. This can be a directory or file name, but can also be a redirection to a database search procedure or to a Telnet session. Sometimes the selector string has, as its first character, a duplicate of the single-character resource type identifier. This can lead to hair-pulling confusion, with resource identifiers appearing alone or in pairs, seemingly at random. Table 8.3 summarizes the Gopher resource identifier codes.
General Form of a Gopher URLThe general form for a basic Gopher URL is gopher:// int.domain.nam:port/Tselector_string where the port number is optional (the default value is 70), T is the Gopher type code from Table 6.3, and selector_string is the Gopher selector string. The root information of a Gopher server can be obtained by leaving out all type and selector string information. Thus, the root information of the Gopher server at mr.bean.org is available at: gopher://mr.bean.org/ Hierarchical relationships are possible. For example: gopher://mr.bean.org/1stuff indicates that stuff behaves like a directory and will retrieve the Gopher contents of stuff, while the URL gopher://mr.bean.org/7stuff/index indicates access to the index search in the directory stuff. Accessing this URL would cause the browser to ask the user for query string information to be used in the search. Query Strings for SearchesSearch information is sent to the Gopher server by appending the search strings to the URL, separated from the URL by a question mark. Thus, to pass the strings tad, jill, and joanne to the Gopher search index noted in the previous section, the URL is: gopher://mr.bean.org/7stuff/index?tad+jill+joanne
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |