Any general, binary format that the server doesn't recognize usually uses this MIME type. Upon receiving this type, most browsers prompt the user and give the user an option to save to disk.
- This also allows the Web browser to enable the user to know the recommended file format for the attached.octet-stream file.These OCTET-STREAM files may be opened by renaming the extension of the attached file to a specific file extension, and then by using an application with support for opening such files. For example, an.octet-stream file.
- Aug 24, 2018 Note: Historically, Firefox has loaded CSS files even if they had the wrong MIME type, as long as the HTML document that requested them was being processed in quirks mode. For security reasons, Gecko 2.0 will no longer do this for stylesheets loaded from a different origin than the requesting document. If your stylesheet comes from a different origin than the document, you must serve it with.
Background
By default, many web servers are configured to report a MIME type of text/plain
or application/octet-stream
for unknown content types. As new content types are invented or added to web servers, web administrators may fail to add the new MIME types to their web server's configuration. This is a major source of problems for users of Gecko-based browsers, which respect the MIME types as reported by web servers and web applications.
What are MIME types?
MIME types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. Examples of MIME types are:
text/html
for normal web pagestext/plain
for plain texttext/css
for Cascading Style Sheetstext/javascript
for scriptsapplication/octet-stream
meaning 'download this file'application/x-java-applet
for Java appletsapplication/pdf
for PDF documents
Technical Background
Registered values for MIME types are available in IANA | MIME Media Types. The HTTP specification defines a superset of MIME which is used to describe the media types used on the web.
Why are correct MIME types important?
If the web server or application reports an incorrect MIME type for content, a web browser has no way, according to the HTTP specification, of knowing that the author actually intended the content to be processed and displayed in a way different from that implied by the reported MIME type.
Some other web browsers, such as Microsoft® Internet Explorer, try to allow for misconfigured web servers and applications by guessing what the correct MIME type should be. This has sheltered many web administrators from their own errors, since Internet Explorer will continue to process content as expected even though the web server is misconfigured, e.g. displays an image which is reported to be plain text.
Serving content using the correct MIME type can also be important for security reasons; it's possible for malicious content to affect the user's computer by pretending to be a safe type of document when it is in fact not.
Note: Historically, Firefox has loaded CSS files even if they had the wrong MIME type, as long as the HTML document that requested them was being processed in quirks mode. For security reasons, Gecko 2.0 will no longer do this for stylesheets loaded from a different origin than the requesting document. If your stylesheet comes from a different origin than the document, you must serve it with the correct MIME type (text/css
).
Gecko 1.9.1.11 (Firefox 3.5.11) and Gecko 1.9.2.5 (Firefox 3.6.5) also implement this security fix, but to improve compatibility, there was a temporary heuristic that allows the load if the first line in the style sheet appears to be a well-formed CSS construct; the heuristic has been removed in Firefox 4, and you have to properly set the text/css
MIME types to have your CSS pages recognized.
Why browsers should not guess MIME types
Apart from violating the HTTP specification, it is a bad strategy for browsers to guess MIME types for the following reasons:
Loss of control
If the browser ignores the reported MIME type, web administrators and authors no longer have control over how their content is to be processed.
For example, a web site oriented for web developers might wish to send certain example HTML documents as either text/html
or text/plain
in order to have the documents either processed and displayed as HTML or as source code. If the browser guesses the MIME type, this option is no longer available to the author.
Security
Some content types, such as executable programs, are inherently unsafe. For this reason these MIME types are usually restricted in terms of what actions a web browser will take when given content of that type. An executable program should not be executed on the user's computer and at most should cause a dialog to appear asking the user if they wish to download the file.
MIME type guessing has led to security exploits in Internet Explorer which were based upon a malicious author incorrectly reporting a MIME type of a dangerous file as a safe type. This bypassed the normal download dialog resulting in Internet Explorer guessing that the content was an executable program and then running it on the user's computer.
How to determine the MIME type sent by a server
In Firefox, load the file and use Tools | Page Info. You can also use Rex Swain's HTTP Viewer or Live HTTP Headers to see the full headers and content of any file sent from a web server.
According to the standards, a meta
tag that gives the MIME type such as <meta http-equiv='Content-Type'>
should be ignored if there's a Content-Type
line in the header. Instead of looking for this line in the HTML source, use the above techniques to determine the MIME type sent by the server.
How to determine the correct MIME type for your content
There are several steps which you can take to determine the correct MIME type value to be used for your content.
- If your content was created using a vendor's software application, read the vendor's documentation to see what MIME types should be reported for different media types.
- Look in the IANA | MIME Media Types registry which contains all registered MIME types.
- If the media type is displayed using a plug-in in Netscape Gecko, install the plug-in and then look in the Help->About Plug-ins Menu to see what MIME types are associated with the media type.
- Search for the file extension in FILExt or File extensions reference to see what MIME types are associated with that extension.
How to set up your server to send the correct MIME types
The fundamental idea is to configure your server to send the correct Content-Type
HTTP header for each document.
- If you're using the Apache web server, simply copy this sample .htaccess file to the directory that contains the files that you want to send with the correct MIME types. If you have an entire subdirectory of files, just place the file in the parent directory; you need not place it in each subdirectory.
- If you're using Microsoft IIS, see this article at Microsoft TechNet.
- If you're using a server-side script to generate content, you can generally add one line near the top of your script. You can serve content other than HTML from Perl, PHP, ASP, or Java — just change the MIME type accordingly.
- For Perl CGI, you should have the line
print 'Content-Type: text/htmlnn';
before any other output lines. If you're using the CGI module, you can use the lineprint $cgi->header('text/html');
instead, where$cgi
is your reference to the CGI instance. - For PHP, you should have the line
header('Content-Type: text/html');
before any other output lines. - For ASP, you should have the line
response.ContentType = 'text/html';
before any other output lines. - For a Java servlet, you should have the line
response.setContentType('text/html');
at the top of yourdoGet
ordoPost
method, whereresponse
is a reference to theHttpServletResponse
.
- For Perl CGI, you should have the line
Related Links
Original Document Information
- Author: Bob Clary, date: 20 Feb 2003
What is an OCTET-STREAM file?
The OCTET-STREAM format is used for file attachments on the Web with an unknown file type. These .octet-stream files are arbitrary binary data files that may be in any multimedia format. The OCTET-STREAM format was developed for Web browsers to understand that the file attachment is in an unknown file type, which also allows the user to choose to download and save the attached file in any file format that the user wants.In other instances, the OCTET-STREAM file format is used to inform the user that the attached file may be saved in a recommended file format. This also allows the Web browser to enable the user to know the recommended file format for the attached .octet-stream file.These OCTET-STREAM files may be opened by renaming the extension of the attached file to a specific file extension, and then by using an application with support for opening such files. For example, an .octet-stream file may be renamed to a .txt file (if it is indeed a .txt file), and Notepad may then be used to open the file. This means the user needs to know the file type of the attached .octet-stream file before renaming the file in the correct file extension.
Software that will open, convert or fix OCTET-STREAM files
Unfortunately we have not received enough suggestions for software that can open OCTET-STREAM files yet.
Try a universal file viewer
Since we do not have any programs listed that we have verified can open OCTET-STREAM files, we suggest that you try a universal file viewer like Free File Viewer. It can open over 200 different types of files - and very likely yours too! Download Free File Viewer.
Application/octet-stream Curl Download
About File Extension OCTET-STREAM
File.org aims to be the go-to resource for file type- and related software information. We spend countless hours researching various file formats and software that can open, convert, create or otherwise work with those files.
Application/octet-stream Attachment Download
If you have additional information about the OCTET-STREAM file format or software that uses files with the OCTET-STREAM suffix, please do get in touch - we would love hearing from you.
Comments are closed.