LoginSignup
307
120

More than 5 years have passed since last update.

HTTPで「418 I’m a tea pot」を実装してはいけない(2018/10/18追記)

Last updated at Posted at 2017-08-07

418 I’m a tea potとは

ステータスコード 418 I’m a tea potは、エイプリルフールに発行されたジョークRFCであるRFC2324「Hyper Text Coffee Pot Control Protocol」 で定義されているステータスコードです。

Googleでも 418 を返すURLがあります。
Error 418 (I’m a teapot)!? https://www.google.com/teapot

HTTPで「418 I’m a tea pot」を実装してはいけない

昨日、golangとnodejsにおいて、418 I’m a tea pot の実装を削除するIssue が投げられています。

Issue中でも書かれている通り、418 I’m a tea potHyper Text Coffee Pot Control Protocolのステータスコードであり、HTTPのステータスコードではありません。

もちろん、HTTPのステータスコードとして正式に定義・登録されているものでもありません。IANAの登録情報( https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml ) を見ても登録されていないことがわかります。

議論

このステータスコードの議論は、HTTPの標準化を行っているIETFのHTTPBis WGで行われています。

話の発端は、TLS1.3の0-RTTを利用したHTTPリクエストはリプレイ攻撃があり、それを許容できない場合に使用する4NN Too Earlyという新しいステータスコードを定義する「Using Early Data in HTTP」という提案仕様になります。

この4NN Too Earlyに未割り当ての418を使うか、418を避けるかという議論をしている最中です(1)

この議論には、Joke RFCで利用されているという理由で貴重なステータスコードに穴を開けるのは良くない(2)、実際問題としてすでに多くの実装がある(3)、などの意見が出ています。

これらの整理はもちろん早く行ったほうがよく、実際に幾つかの実装においてIssueが立てられている状況です。

418をHTTPの仕様で予約する提案 (2017/08/12追記)

上記の議論及び調査を経て(4)、HTTPにおいて418を予約する提案仕様が出ています。

提案仕様は、「Reserving the 418 HTTP Status Code」というタイトルでHTTPのステータスコードとして418を予約し、IANAにも登録されます。

これはただ予約されただけであり、HTTPで「418 I’m a tea pot」を実装してはいけない事に変わりはありません。

また、この仕様は提案段階であり引き続き議論は続きます、RFCとしてもまだ時間がかかるものと思います。

(2017/9/12更新)
同様にHTTPで418を予約する提案がMartin Thomson氏より「The Teapot Exists」も出ています。

こちらはteapot存在するという提案であり、プロトコルの仕様としては珍しくデカルトの哲学に言及するPhilosophical Considerationsの項目などもあります。

418はUnusedとして予約されます (2018/10/18追記)

現在HTTPbis WGではHTTP セマンティクスの再改定作業を行っています。
HTTP Semantics」この draft-03で418への言及が入りました。

9.5.19.  418 (Unused)

   [RFC2324] was an April 1 RFC that lampooned the various ways HTTP was
   abused; one such abuse was the definition of an application-specific
   418 status code.  In the intervening years, this status code has been
   widely implemented as an "Easter Egg", and therefore is effectively
   consumed by this use.

   Therefore, the 418 status code is reserved in the IANA HTTP Status
   Code registry.  This indicates that the status code cannot be
   assigned to other applications currently.  If future circumstances
   require its use (e.g., exhaustion of 4NN status codes), it can be re-
   assigned to another use.

HTTP 418ステータスコードが予約される」を参照

307
120
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
307
120