Generic semantics for the 400 status code

Mark Nottingham <mnot@mnot.net> Fri, 15 July 2011 12:55 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 71F2021F8762 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Jul 2011 05:55:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.566
X-Spam-Level:
X-Spam-Status: No, score=-9.566 tagged_above=-999 required=5 tests=[AWL=1.033, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PR+V5v4mIPYW for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Jul 2011 05:54:57 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 2842221F8761 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 15 Jul 2011 05:54:51 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.69) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1Qhhtu-0001Hw-IA for ietf-http-wg-dist@listhub.w3.org; Fri, 15 Jul 2011 12:53:50 +0000
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.69) (envelope-from <mnot@mnot.net>) id 1Qhhtk-0001Fz-8X for ietf-http-wg@listhub.w3.org; Fri, 15 Jul 2011 12:53:40 +0000
Received: from mxout-08.mxes.net ([216.86.168.183]) by lisa.w3.org with esmtp (Exim 4.72) (envelope-from <mnot@mnot.net>) id 1Qhhtf-0002ix-Sv for ietf-http-wg@w3.org; Fri, 15 Jul 2011 12:53:40 +0000
Received: from chancetrain-lm.mnot.net (unknown [118.209.98.127]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 16DAA509DB for <ietf-http-wg@w3.org>; Fri, 15 Jul 2011 08:53:13 -0400 (EDT)
From: Mark Nottingham <mnot@mnot.net>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Date: Fri, 15 Jul 2011 22:53:09 +1000
Message-Id: <E7DE53B9-C374-4C9B-81D2-1F35BFCC174F@mnot.net>
To: HTTP Working Group <ietf-http-wg@w3.org>
Mime-Version: 1.0 (Apple Message framework v1084)
X-Mailer: Apple Mail (2.1084)
Received-SPF: pass client-ip=216.86.168.183; envelope-from=mnot@mnot.net; helo=mxout-08.mxes.net
X-W3C-Hub-Spam-Status: No, score=-1.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: lisa.w3.org 1Qhhtf-0002ix-Sv 284de746aa67c44db73ddfc0bd11636f
X-Original-To: ietf-http-wg@w3.org
Subject: Generic semantics for the 400 status code
Archived-At: <http://www.w3.org/mid/E7DE53B9-C374-4C9B-81D2-1F35BFCC174F@mnot.net>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/10945
X-Loop: ietf-http-wg@w3.org
Sender: ietf-http-wg-request@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>
Resent-Message-Id: <E1Qhhtu-0001Hw-IA@frink.w3.org>
Resent-Date: Fri, 15 Jul 2011 12:53:50 +0000

When people have error states that don't cleanly fit into an existing status code, they're often encouraged to use 400 or 500, depending on whether the client or server were at fault, as they're the most "generic" status codes.

500's definition fits this:

> 8.5.1.  500 Internal Server Error
> 
>    The server encountered an unexpected condition which prevented it
>    from fulfilling the request.

However, 400 is much more specific:

> 8.4.1.  400 Bad Request
> 
>    The request could not be understood by the server due to malformed
>    syntax.  The client SHOULD NOT repeat the request without
>    modifications.

I think the 400 definition needs to be broadened, so that people don't invent their own status codes, or misuse existing ones.

E.g.,

"""
The server can or will not process the request, due to a client error (e.g., malformed syntax).
"""

Additionally, I think we should move the caution against retrying the request to the general 4xx section (8.4)*.

Background:
  http://docs.openstack.org/cactus/openstack-compute/developer/openstack-compute-api-1.1/content/Synchronous_Faults-d1e1729.html#comment-213643851

Thoughts?

Cheers,


* Why is the "If the client is sending data..." section in p2 8.4? Seems like this belongs in p1...


--
Mark Nottingham   http://www.mnot.net/