Issue 1025790: Add status code constants to httplib (original) (raw)

Issue1025790

Created on 2004-09-10 11:48 by andreweland, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
httplib-constants.patch andreweland,2004-09-10 11:48
canonical-httplib-constants.patch andreweland,2004-09-16 13:12
Messages (8)
msg46876 - (view) Author: Andrew Eland (andreweland) Date: 2004-09-10 11:48
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.
msg46877 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-09-10 20:54
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.
msg46878 - (view) Author: Andrew Durdin (adurdin) Date: 2004-09-13 01:51
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?
msg46879 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-09-13 05:54
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.
msg46880 - (view) Author: Andrew Eland (andreweland) Date: 2004-09-13 09:03
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.
msg46881 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-09-13 21:27
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.
msg46882 - (view) Author: Andrew Eland (andreweland) Date: 2004-09-16 13:12
Logged In: YES user_id=646767 I've added a new patch that: - Uses the canonical spelling for constants - Adds missing status codes from RFCs 2817 and 3229 - Documents the constants in a table, referencing the section of the relevent RFC
msg46883 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-09-18 09:04
Logged In: YES user_id=21627 Thanks for the patch. Applied as libhttplib.tex 1.38 httplib.py 1.92 ACKS 1.283 NEWS 1.1136
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40894
2004-09-10 11:48:38 andreweland create