INTERNET-DRAFT MIME Handler Detection May 1999 Expires November 1999 HTTP MIME Type Handler Detection ---- ---- ---- ------- --------- Donald E. Eastlake 3rd Chris J. Smith David M. Soroka Status of This Document This draft, file name draft-ietf-trade-mime-detector-00.txt, is intended to become an Informational RFC. Distribution of this document is unlimited. Comments should be sent to the TRADE WG mailing list or to the authors. This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of [RFC 2026]. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet- Drafts as reference material or to cite them other than as "work in progress". The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. D. Eastlake, C. Smith, D. Soroka [Page 1] INTERNET-DRAFT MIME Handler Detection May 1999 Abstract Entities composing web pages to provide services over HTTP frequently have the problem of not knowing what MIME types have handlers installed at a user's browser. For example, whether an IOTP or VRML or SET or some streaming media handler is available. In many cases they would want to display different web pages or content depending on a MIME handler's availability. This document summarizes a reasonable technique to solve this problem for most of the browsers actually deployed on the Internet as of April 1999. It is intended to be of practical use to implementors during the period before the wide deployment of superior standards based techniques which may be developed. Table of Contents Status of This Document....................................1 Abstract...................................................2 Table of Contents..........................................2 1. Introduction............................................3 2. The HTTP 'Accepts' Header...............................3 3. JavaScript..............................................3 4. Microsoft ActiveX and the Windows Registry..............4 5. Putting It All Together.................................5 6. Future Development......................................6 7. Security Considerations.................................6 8. IANA Considerations.....................................6 References.................................................7 Appendix A: Browser Version Sniffer Code...................8 Authors Addresses.........................................12 Expiration and File Name..................................12 D. Eastlake, C. Smith, D. Soroka [Page 2] INTERNET-DRAFT MIME Handler Detection May 1999 1. Introduction Entities composing web pages to provide services over [HTTP] frequently have the problem of not knowing what [MIME] types have handlers installed at a user's browser. For example, whether an [IOTP] or VRML or SET or some streaming media handler is available. In many cases they would want to display different web pages or content depending on a MIME handler's availability. Sending a response with a MIME type that is not supported frequently results in interrupting the flow of the user experience, browser queries as to what to do with the data being provided, and, of course, failure to provide the behavior that would have occurred had the correct MIME type handler been installed. This document describes reasonable techniques to solve this problem for most of the browsers actually deployed on the Internet as of April 1999. It is intended to be of practical use to implementors during the period before the wide deployment of superior standards based techniques which may be developed. It is written in terms of determining whether a handler for application/iotp or application/x- iotp exists but is equally applicable to other MIME types. 2. The HTTP 'Accepts' Header The problem should be solved by the Hyper Text Transport Protocol [HTTP] request "Accepts" header which lists accepted [MIME] types. This header is present in both Version 1.0 and 1.1 of HTTP and its content is supposed to be a list of MIME types and subtypes that are accepted. The only problem is that many browsers just send "*/*". If the particular MIME type you are looking for is present in the Accepts header, it is generally safe to assume that some specific handler for it is actually installed or part of the browser. NOTE: Although not part of the main topic of this document, if you are designing MIME type handler software and have access to a browser interface that allows you to request the insertion of the MIME type or types your software handles into the Accepts header, you generally should do so. It will make it easier for servers sensitive to that MIME type to respond correctly. 3. JavaScript Most recent browsers support one or more scripting languages of which the most widely deployed is "JavaScript". These scripting languages appear in web pages and permit the interpretive execution of D. Eastlake, C. Smith, D. Soroka [Page 3] INTERNET-DRAFT MIME Handler Detection May 1999 programing language constructs that can probe the browser environment, conditionally cause different page contents to be displayed, etc. For example, Appendix A shows JavaScript available from the Netscape web site for determining what operating system, browser, and version you are running on. NOTE: JavaScript is a trademark of Netscape Corporation. It was originally called LiveScript. It has nothing to do with Java. The syntax for script use appears to be a Hyper Text Markup Language (HTML) comment so that bowsers that do not support scripting will ignore such items. That is, script use if preceeded by "". The following is a simple example of conditional execution of parts of a web page based on JavaScript MIME type handler detection. 4. Microsoft ActiveX and the Windows Registry If running on Internet Explorer version 3 or 4, it is necessary to query to Windows Registry to determine local MIME type support. Although these broswers support JavaScript, in v3 the mimeTypes array is not present and in v4 it is present but always empty. For example, executing the following code will test for support of the iotp types: CString iotpString, xiotpString; char* Key, Keyx; int rc, rcx; iotpString = "SOFTWARE\Classes\MIME\Database\Content Type\application/iotp"; xiotpString = "SOFTWARE\Classes\MIME\Database\Content Type\application/x-iotp"; Key = iotpString.GetBuffer(1); D. Eastlake, C. Smith, D. Soroka [Page 4] INTERNET-DRAFT MIME Handler Detection May 1999 Keyx = xiotpString.GetBuffer(1); rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Key, 0, KEY_READ, hDefKey); rcx = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Key, 0, KEY_READ, hDefKey); if ( ( rc == ERROR_SUCCESS ) || ( rcx == ERROR_SUCCESS ) ) { // IOTP Handler exists } else { // No IOTP Handler } NOTE: Active X is a trademark of Microsoft and was originally called Sweeper. [TBD Stuff about ActiveX glue...?] 5. Putting It All Together [..] start>-----+ | +------------------+ | Was desired type | NO +-------------------------+ |found in Accepts? |------------>| Is JavaScript available | +------------------+ |and does it show type? | | +-------------------------+ YES | | | | |<---------------------------+ | NO | | YES | | | +---| | V | remember | Indeterminate remember | that |. take default that type | type IS | action. is NOT | supported| supported | X done X [...] D. Eastlake, C. Smith, D. Soroka [Page 5] INTERNET-DRAFT MIME Handler Detection May 1999 6. Future Development Active work is proceeding in the IETF and World Wide Web Consortium concerning content and capabilities negotiation. This work is likely to lead to superior methods to implement the functionality described herein. However, near universal deployment of such new standards/features will take some time. Thus you should expect the methods given herein to be obsoleted, but perhaps not for a few years. 7. Security Considerations It should be noted that the type of Active X control suggested above is reader the user's registry, that is, examining their computer and reporting back some information it has discovered. This may be a concern among some users. Security of web interactions is normally provided by adopting channel encryption on the browser to server connections, such as [TLS]. In the absence of some such additional security outside of HTTP, requests and/or responses may be forged or tampered with. 8. IANA Considerations None specific to the techniques described herein. For MIME types and type registration procedures, see [RFCs 2046, 2048]. D. Eastlake, C. Smith, D. Soroka [Page 6] INTERNET-DRAFT MIME Handler Detection May 1999 References [HTTP] RFC 1945 - "Hypertext Transfer Protocol -- HTTP/1.0", T. Berners-Lee, R. Fielding & H. Frystyk. May 1996. RFC 2068 - "Hypertext Transfer Protocol -- HTTP/1.1", R. Fielding, J. Gettys, J. Mogul, H. Frystyk, T. Berners-Lee. January 1997. [IOTP] draft-ietf-trade-iotp-v1.0-protocol-*.txt - David Burdett [MIME] RFC 2045 - "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", N. Freed & N. Borenstein. November 1996. RFC 2046 - "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", N. Freed & N. Borenstein. November 1996. RFC 2047 - "MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text", K. Moore. November 1996. RFC 2048 - "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures", N. Freed, J. Klensin & J. Postel. November 1996. [SET] [TLS] RFC 2246 - "The TLS Protocol Version 1.0", T. Dierks, C. Allen. D. Eastlake, C. Smith, D. Soroka [Page 7] INTERNET-DRAFT MIME Handler Detection May 1999 Appendix A: Browser Version Sniffer Code D. Eastlake, C. Smith, D. Soroka [Page 11] INTERNET-DRAFT MIME Handler Detection May 1999 Authors Addresses Donald E. Eastlake 3rd IBM 65 Shindegan Hill Road Carmel, NY 10512 USA Telephone: +1 914-276-2668(h) +1 914-784-7913(w) FAX: +1 914-784-3833(w) email: dee3@us.ibm.com Chris J. Smith Royal Bank of Canada 277 Front Street West Toronto, Ontario M5V 3A4 CANADA Telephone: +1 416-348-6090 FAX: +1 416-348-2210 email: chris.smith@royalbank.com David M. Soroka IBM Raleigh, NC Telephone: +1 919-486-2684 Fax: +1 919-543-4653 email: dsoroka@us.ibm.com Expiration and File Name This draft expires November 1999. Its file name is draft-ietf-trade-mime-detector-00.txt. D. Eastlake, C. Smith, D. Soroka [Page 12]