application/octet-stream

application/octet-stream

[8] application/octet-stream は、任意のバイナリ(二進)・データを表すMIME型です。 すなわち、 application/octet-stream と札付けされた実体本体は何らかの意味を持つ (あるいは持たない) 任意のビット列です。

[9] MIME の媒体型の仕組みの中では、この媒体型はやや特殊な位置付けです。 text/*multipart/* 以外の媒体型は、 もし実装がその具体的な媒体型を知らなければ、 application/octet-stream と同じように扱います。 また、実装が知っている媒体型であっても、知らない CTE で転送符号化されているときには、やはり application/octet-stream として扱うことになっています。 つまり、 application/octet-stream は最も基本的な媒体型と言うことができます。

[37] たとえば、 application/x-foobar という媒体型を知らない MIME UA は、 aplication/x-foobar の実体を application/octet-stream の実体と同じように処理します。

[38] このMIME型は、対象となるデータのファイル形式が明確でない時や、 明確にしたくない時 (例えばWebブラウザーにファイルを解釈させず、 ダウンロードさせたい時) に使われることがあります。

仕様書

意味

[24] MIME型 application/octet-stream は、 任意のバイナリーデータを表します >>23, >>32

[36]オクテット列 (octet stream) 」 (= バイト列) という名前に反して、 実は任意のビット列を扱えます。 8ビット単位になっている必要はありません。

[35] ただし8ビット以外で実装されたり使用されたりしているのを見たことはありません。

呼称

[48] application/octetstream とされることがありますが、 誤りです。

引数

[12] 次の引数があります。

[44] application/octet-stream引数

文脈

[19] 何らかのバイナリデータがあり、そのMIME型が分からない場合や、 敢えて MIME型を明確にせずに扱いたい時に、 application/octet-stream を使います。

[20] そのような場合に text/plain を使う実装もありますが、 不適切です。

処理

[10] MIME UAapplication/octet-stream の実体を受取った時に、これをどう処理するかは、 他のほとんどの媒体型同様に、実装依存です。

しかしながら、未知のバイナリ・データなのですから、 直接表示しないで利用者の指示を仰ぐか、 バイナリ・エディタの類のように十六進数などで表示するのが望ましいでしょう。 実際ほとんどの実装はそのように扱います。

[30] 実装は、受信したデータを (CTE復号してから) ファイルに保存することを提示したり >>23, >>32利用者が指定した処理への入力として使ったり >>23 することが推奨 (recommended) されています。

[31] 危険な入力を与えられる可能性があるので、 Content-Type:引数から任意のプログラムを決定して実行するような実装とはしないことを強く推奨されています >>23

電子メール

[17] MUA は、添付ファイルとして扱います。

Web

[16] Webブラウザーは、ダウンロードとして扱います。

[18] MIME型がわかっていて、なおかつ添付ファイルダウンロードとしたいときは、 Content-Disposition: attachment を使うのがより適切です。
[41] download 属性も参照。

[43] MIME Sniffing も参照。

type 引数

[25] type 引数は、 バイナリーデータの一般的な型や種別 (general type or category) を表します >>23

[28] この引数は、省略可能です >>23

[26] これは自動処理のためのものではなく、人間受信者に対する情報として使うことが想定されています >>23

[29] この引数の値は特に規定されておらず、任意の値を記述できるようです。

[27] 次のような値が見られます。

[50]

Content-Type: application/octet-stream; type=tar+gzip

[1] 電子メールでは以前はたまに使われているのを見かけました。

[2] HTTP ではほとんど使われていないと思われます。

関連

[21] application/*Content-Disposition: attachmentdownload 属性も参照。

[33] 未知の charset の未知の text/* 部分型は、 application/octet-stream として扱われるべきです。

text/* 参照。

[34] multipart/*text/* を除き、各最上位型の未知のMIME型は、 application/octet-stream として扱われるべきです。

各項参照。

歴史

[13] RFC 2046 4.5.1. Octet-Stream Subtype

The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data. The set of currently defined parameters is:

"octet-stream" 亜型は本文が任意のバイナリ・データであることを 示すのに使います。現在定義されているパラメーターの集合は、 次の通りです。

    (1)   TYPE -- the general type or category of binary data.
          This is intended as information for the human recipient
          rather than for any automatic processing.

TYPE バイナリ・データの一般的な型や分類。これは自動処理ではなく 人間受信者向けの情報を意図しています。

    (2)   PADDING -- the number of bits of padding that were
          appended to the bit-stream comprising the actual
          contents to produce the enclosed 8bit byte-oriented
          data.  This is useful for enclosing a bit-stream in a
          body when the total number of bits is not a multiple of
          8.

PADDING 実際の内容のビット列を8ビット・バイト指向のデータに するために付け足した埋めビットの数。これはビットの合計数が8の倍数 でないビット列を本文に包むのに便利です。

訳注: RFC 1521 によると取りうる値は "0" 〜 "7" です。 application/*媒体型参照。 RFC 2046 にこの規定はありませんが、 常識的に考えてこの範囲でしょう。 (これより大きな値を受け取った時は どうしましょうか?)

Both of these parameters are optional.

両パラメーターとも省略可能です。

   An additional parameter, "CONVERSIONS", was defined in RFC 1341 but
   has since been removed.  RFC 1341 also defined the use of a "NAME"
   parameter which gave a suggested file name to be used if the data
   were to be written to a file.  This has been deprecated in
   anticipation of a separate Content-Disposition header field, to be
   defined in a subsequent RFC.

追加のパラメーター "CONVERSIONS" が RFC 1341 で定義されていましたが 削除されました。 RFC 1341 はデータをファイルに書くときに 使われるファイル名を提案する "NAME" パラメーターの使用も 定義していました。これは後の RFC で定義される別の Content-Disposition 頭領域を使うことを期待するものです。

意訳。

The recommended action for an implementation that receives an "application/octet-stream" entity is to simply offer to put the data in a file, with any Content-Transfer-Encoding undone, or perhaps to use it as input to a user-specified process.

"application/octet-stream" 実体を受け取った実装の推奨される動作は、 Content-Transfer-Encoding を戻して、単にデータをファイルに入れるか または利用者の指定する処理の入力として使うかです。

To reduce the danger of transmitting rogue programs, it is strongly recommended that implementations NOT implement a path-search mechanism whereby an arbitrary program named in the Content-Type parameter (e.g., an "interpreter=" parameter) is found and executed using the message body as input.

浮浪プログラムの転送の危険を減らすため、実装は Content-Type パラメーター (例えば "interpreter=" パラメーター) で指名された任意のプログラム があればメッセージ本文を入力に使って実行する経路検索機構を 実装しないことを強く推奨します。

[14] RFC 1341 7.4.1 から抜粋

・・・

                 NAME -- a suggested name for the  binary  data  if
                 stored as a file.

NAME バイナリ・データがファイルとして保管される時の名前の提案。

・・・

                 CONVERSIONS -- the set  of  operations  that  have
                 been  performed  on  the data before putting it in
                 the mail (and before any Content-Transfer-Encoding
                 that   might   have  been  applied).  If  multiple
                 conversions have occurred, they must be  separated
                 by  commas  and  specified  in the order they were
                 applied -- that is, the leftmost conversion   must
                 have  occurred  first,  and conversions are undone
                 from right  to  left.   Note  that  NO  conversion
                 values   are   defined   by  this  document.   Any
                 conversion values that that do not begin with "X-"
                 must  be preceded by a published specification and
                 by  registration  with  IANA,  as   described   in
                 Appendix F.

CONVERSIONS データをメイルに入れる前 (で Content-Transfer-Encoding が適応されたかもしれない前) に施された処理の集合 複数の変換があった場合は、 読点(comma)で区切って施された順に指定します。つまり左端の変換が 最初に行われたもので無くてはならず、逆変換は右から左へと戻していきます。 この文書では変換値は定義しません。 "X-" で始まらない変換値 は予め仕様書を出版して IANA に附属書 F で説明する通り登録する 必要があります。

・・・

            The values  for  these  attributes  are  left  undefined  at
            present,  but  may  require specification in the future.  An
            example of a common (though UNIX-specific) usage might be:

これらの属性の値は現時点で未定義のままですが、将来規定する必要がある かもしれません。共通な (UNIX 特有だけど) 例は、次の通りです。

                 Content-Type:  application/octet-stream;
                      name=foo.tar.Z; type=tar;
                      conversions="x-encrypt,x-compress"
            However, it should be noted that the use of such conversions
            is  explicitly  discouraged due to a lack of portability and
            standardization.   The  use  of  uuencode  is   particularly
            discouraged,   in  favor  of  the  Content-Transfer-Encoding
            mechanism, which is both more standardized and more portable
            across mail boundaries.

ですが、このような変換の使用は移植性と標準化を欠いているので、 明白に非推奨であることに注意して下さい。 uuencode の使用は特に非推奨です。 より標準化されているしよりメイル境界を越えて移植性がある Content-Transfer-Encoding 機構があります。

・・・

メモ

Web 開発

[11] W3C のサイトの tar+gz な資源、 なぜか application/octet-stream になってます。ブラウザで展開ソフトウェアに関連付けることができないので不便。なんとかしてほしいなあ。

[15]

Content-Type: application/octet-stream; type=gzip
[22] RFC 2911 - Internet Printing Protocol/1.1: Model and Semantics ( 版) https://tools.ietf.org/html/rfc2911#section-4.1.9.1

One special type is 'application/octet-stream'. If the Printer

object supports this value, the Printer object MUST be capable of

auto-sensing the format of the document data using an

implementation-dependent method that examines some number of octets

of the document data, either as part of the create operation and/or

at document processing time.

[39] 拡張子を持たないファイルが Application/Octet-Stream にマップされる ( ()) https://support.microsoft.com/ja-jp/help/264968/files-without-extensions-are-mapped-to-application-octet-stream

IIS で、拡張子を持たないファイルが見つかると、Content-Type が application/octet-stream としてブラウザへ送り返されます。この動作はユーザー インターフェイスでは変更できません。AOL Netscape ブラウザでは、このヘッダー設定が原因でファイルが表示されず、代わりにファイルのダウンロードが開始されます。

[40] それ自体は妥当な仕様だと思いますが、こういう説明になっているのは、 application/octet-stream のとき IEsniffing する仕様だったため、 IE ではWebブラウザー内で表示され、 Netscape ではダウンロード扱いになり、困った人がたくさんいたということなのでしょうね。

[42] Buck: HTTP Cache API ( ()) https://buckbuild.com/concept/http_cache_api.html

If the artifact is cached, the response should be:

status 200

content-type application/octet-stream

32 bit big endian signed integer denoting the number of length in bytes of the metadata

(1) bytes of metadata

The artifact's data

[45] Fix overrideMimeType() again (annevk著, ) https://github.com/whatwg/xhr/commit/121cee50b6f51215f046266642964b4c53a02a7c

[46] 918731 - XMLHttpRequest's overrideMimeType() does not follow the standard () https://bugzilla.mozilla.org/show_bug.cgi?id=918731

[47] No longer render resources requested via FTP (mikewest著, ) https://github.com/whatwg/fetch/commit/c6b3a750f811cb4f628def0313ac317d9dcec88a

[49] RFC 2911 - Internet Printing Protocol/1.1: Model and Semantics (, ) https://tools.ietf.org/html/rfc2911#section-4.1.9.1