[Patches] [ python-Patches-1025790 ] Add status code constants to httplib

SourceForge.net noreply at sourceforge.net
Mon Sep 13 23:27:59 CEST 2004


Patches item #1025790, was opened at 2004-09-10 13:48
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1025790&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Eland (andreweland)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add status code constants to httplib

Initial Comment:
httplib doesn't define constants for the HTTP integer
status codes, so most applications end up defining
their own subset. This patch adds status code constants
to httplib, using the same names as Twisted, and
updates the documentation.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-09-13 23:27

Message:
Logged In: YES 
user_id=21627

Compatibility with twisted is a non-goal; twisted will adopt
soon enough to the precedent that Python sets, especially if
there is a clear objective rationale. Completeness is one
such objective rationale, and consistency with the RFC is
another one. Twisted can then easily achieve Python
compatibility by adding the missing constants.

----------------------------------------------------------------------

Comment By: Andrew Eland (andreweland)
Date: 2004-09-13 11:03

Message:
Logged In: YES 
user_id=646767

> I think the best standard way of spelling the constants is
> to take them directly from the 10.x.x headings of RFC2616

The spellings in the initial patch come from Twisted, I kept
the few non-canonical spellings to avoid confusing people
who work with both httplib and Twisted. If the consensus is
that canonical spellings should be used regardless, I'll
update the patch.

> It seems WebDAV codes that 102, 422, 423, 424 are missing

Again, the subset chosen is from Twisted, I kept the
additional codes compatibility. It does makes sense to
include the others though, I'll add them.

> OTOH, putting this all in a four-column table (constant
name, value,
> RFC number, section) would make a very systematic
presentation.

I avoided adding a comment for each code as the extra
information provided by the comments was outweighed by the
description of status codes swamping the httplib
documentation. Using a table should keep the documentation
compact, I'll try it out.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-09-13 07:54

Message:
Logged In: YES 
user_id=21627

207 comes from RFC 2518 (WebDAV), section 8.2.1 and 10.2.
507 likewise, section 10.6. It seems WebDAV codes that 102,
422, 423, 424 are missing. Likewise, 426 from RFC 2817 is
missing, and 226 from RFC 3229.
510 comes from RFC 2774 (HTTP Extensions), section 7.

Even though I agree with your procedure for creating
"canonical" spellings, I think more documentation is needed.
Following this procedure, it would be best to list RFC and
section as the documentation; this might allow to leave out
the numerical value IMO. OTOH, putting this all in a
four-column table (constant name, value, RFC number,
section) would make a very systematic presentation.


----------------------------------------------------------------------

Comment By: Andrew Durdin (adurdin)
Date: 2004-09-13 03:51

Message:
Logged In: YES 
user_id=625864

I think the best standard way of spelling the constants is
to take them directly from the 10.x.x headings of RFC2616.
This would require changing four of the names of the
constants in the patch from:
  SWITCHING = 101
  MULTIPLE_CHOICE = 300
  NOT_ALLOWED = 405
  PROXY_AUTH_REQUIRED = 407
to:
  SWITCHING_PROTOCOLS = 101
  MULTIPLE_CHOICES = 300
  METHOD_NOT_ALLOWED = 405
  PROXY_AUTHENTICATION_REQUIRED = 407

Also, the following status codes are not part of the
HTTP/1.1 standard as given in RFC2616:
  MULTI_STATUS = 207
  INSUFFICIENT_STORAGE_SPACE = 507
  NOT_EXTENDED = 510

Where do these come from? Being nonstandard, is it
inappropriate to include them in httplib?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-09-10 22:54

Message:
Logged In: YES 
user_id=21627

Unless the precise spelling of the constants is taken from
some existing specification, I think the documentation needs
to spell out the values, so that readers can easily confirm
that a certain symbolic value has the meaning they expect.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1025790&group_id=5470


More information about the Patches mailing list