Add HTTP status code 450 to http module

As we have seen, Python supports a wide range of http codes, including all the IANA official codes + some additional ones such as 418 (The requested entity is a teapot incapable of brewing coffee).

My point is: If python supports 418 and aims to support others, it might be reasonable to support 450 (blocked by windows parental controls). Assuming we want to cover all bases and scenarios, adding this to http and the docs could be of some use to people.

And before you answer “does anyone care about 450 that was a long time ago” Yes, people care. Some windows computers use it, and some websites now use it to indicate that they are functional but device restrictions won’t allow them to fulfill the request.

Also those who like to dig deep may have found this statement in the http docs:

Supported, IANA-registered status codesavailable in http.HTTPStatus are:

This is to be ignored considering 418 is there and is being adressed in #135625

1 Like

Is there any example except 418 that is supported by http.HTTPStatus?

418 is clearly registered at IANA and has an RFC behind it, even if it is a joke. 450 is listed as “unassigned”, not as “unused” like 418 is.

You repeatably saying “some additional ones” as if this is plural. But is it plural?

1 Like

I agree, better to note that 418 is an exception than to begin supporting further unofficial/unregistered status codes.

A

the 418 status code is reserved in the IANA HTTP Status Code Registry

1 Like

I don’t even think I agree that it’s unofficial or unregistered. It is listed officially, it’s just doesn’t have a “true” meaning behind it. (which doesn’t stop people from using it)

2 Likes

I am assuming you want to start supporting the brew and when methods in http as outlined the rfc? I’ll raise an issue and make a PR :wink:

The list of methods in http.HTTPMethods is all from one source, plus PATCH. Notably, it does not include methods used by related services such as WebDAV, which adds quite a few methods that won’t be relevant to the vast majority of HTTP users. WebDAV’s response codes are included in http.HTTPStatus though. So if you want to push for the BREW method to be added on account of 418’s presence, for consistency you should also push for PROPFIND, MKCOL, LOCK, MOVE, etc, from RFC 4918.

I don’t think we need to do that. Being able to give explanations for response codes is a lot more useful than listing every possible HTTP verb that anyone has used. Keep in mind that you can always call request() with an arbitrary method name, if you are in fact connecting to a coffeepot.

That was intended to be funny, but now thinking about it, why not? Some People might in fact find it useful to have methods such as LOCK, MOVE etc. in python. And in the event of calling request() with an arbitrary method name → Thats a messy implementation begging to be fixed.

And if we don’t want to add BREW, PROPFIND, and WHEN, isn’t our implementation of 418 a half-hearted work?

Just look at this: GitHub - HyperTextCoffeePot/HyperTextCoffeePot: A real implementation of the HTCPCP Protocol for use on a Raspberry Pi..

(and I may be crazy, feel free to tell me so)

Yeah, you’re crazy. But let’s face it, most of us are, or we wouldn’t still be here.

TBH I think it’s more useful to have a translation table of potential responses than all of the possible verbs. If you’re going to attempt to BREW, or to LOCK, you’re going to need to know a lot of semantics; but if you attempt to do something on the wrong type of server, it’s useful to at least be able to translate a code into a description. From the flip side, if you’re writing a server and you get a verb you don’t know, all you have to do is return 405 and call it a night. [1] Given the enormous number of potential HTTP-adjacent verbs, it’s best to stick to a single definition of which ones are to be used, and for that, IANA’s repository seems like a good one to use.


  1. Or call it a knight, which would be Sir 405. ↩︎

In that case, why are we including status codes but not their respective methods? That alone should be a warning flag for inconsistency. For example, people might see that we have included 418 and subsequently try to complete a BREW request. If we want to stick to IANA’s repository, we should remove 418 and WebDAV’s response codes. What if someone tries a LOCK request thinking we support WebDAV?

Did you read my previous post?

Yes, I did. But you aren’t getting my point:

Sure we can support 5 more methods if we wanted - imo it is more confusing right now than to have extra methods. And we can always document them clearly in a lookup table or whatever

Any quick google search can answer any questions people may have.

You have to admit that including something in one place but dropping its core component in the other makes no sense for this core reason

if you seriously get a 418, chances are you want to use BREW or one of the others from the rfc If we backed save418, we should have added at least the 418 methods a looong time ago

Just to clarify, do you consider status codes 306 and 418 to be registered or not?

1 Like

IMO yes. I was going to comment about that but decided to hold off on the moment.

Considering the situation, (and the discussion title) we may as well talk about this.

Do you all think we should add 306? I’m +1 there, and

Another question I’m going to leave to you all: what should we do about 104? I’m +0 for that because even though IANA registered it, it is temporary and is currently in beta (trial ends in November)

EDIT: I take back what I said about 306. IANA is trying to deprecate and does not recommend the use of it due to “security concerns”

There exist many unofficial codes. Since these codes are unofficial and subject to change without notice, there’s no requirement to keep track of them.