# 搶救茶壺大作戰：418 I am a teapot

Posted by huli on 2019-06-15

## 前言

Issue 裡面提到希望能移除對 418 的 support，而發起 Issue 的作者在被人告知 Go 也這樣搞的時候，也跑去 Go 發了一個 Issue。

## 418 的由來

418 的由來可以追溯到 1998 年 4 月 1 日愚人節的這一份文件：RFC2324, Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)，HTCPCP 是 Hyper Text Coffee Pot Control Protocol 的簡稱，總之這份 RFC 描述了一個叫做 HTCPCP 的協定，建立在 HTTP 之上，並且可以利用這個協定來泡咖啡。

2.3.2 418 I'm a teapot

Any attempt to brew coffee with a teapot should result in the error
code "418 I'm a teapot". The resulting entity body MAY be short and
stout.

## 移除 418 的風波

Node implements the 418 I'm a Teapot status code in a few places.

Its source is RFC2324, Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0). Note the title - HTCPCP/1.0 is not HTTP/1.x.

HTCPCP was an April 1 joke by Larry to illustrate how people were abusing HTTP in various ways. Ironically, it's not being used to abuse HTTP itself -- people are implementing parts of HTCPCP in their HTTP stacks.

In particular, Node's support for the HTCPCP 418 I'm a Teapot status code has been used as an argument in the HTTP Working Group to preclude use of 418 in HTTP for real-world purposes.

While we have a number of spare 4xx HTTP status codes that are unregistered now, the semantics of HTTP are something that (hopefully) are going to last for a long time, so one day we may need this code point.

Please consider removing support for 418 from Node, since it's not a HTTP status code (even by its own definition). I know it's amusing, I know that a few people have knocked up implementations for fun, but it shouldn't pollute the core protocol; folks can extend Node easily enough if they want to play with non-standard semantics.

Thanks,

### 反對移除：418 是無害的

418 是個無害的彩蛋，而且很有趣，離我家的 418 遠一點！

## 418 的後續發展及現況

I work on HTTP specifications and implementations.

So, I poked a couple of implementations to see if they'd remove 418's "teapot" semantics, and there was a reaction (to put it mildly).

I think we need to reserve 418 to make it clear it can't be used for the foreseeable future

[RFC2324] was an April 1 RFC that lampooned the various ways HTTP was abused; one such abuse was the definition of the application-specific 418 (I’m a Teapot) 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.

This document changes 418 to the status of “Reserved” in the IANA HTTP Status Code registry to reflect that.

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.

## 總結

@huli 野生工程師，相信分享與交流能讓世界變得更美好