Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#688 closed enhancement (fixed)

intarweb: add default reason phrases for responses

Reported by: Moritz Heidkamp Owned by: sjamaan
Priority: major Milestone: 4.9.0
Component: extensions Version: 4.7.x
Keywords: intarweb Cc:
Estimated difficulty:

Description

Currently, intarweb response records have the status code 200 and the reason phrase "OK" as defaults. A common blunder that can happen to an unsuspecting user is to update the code but not the reason phrase, possibly resulting in interesting combinations like "500 OK". Since HTTP 1.0 and 1.1 define a list of recommended reason phrases it would probably make sense to include those in intarweb.

The attached patch changes the default reason phrase to be #f. If a response is written with a reason of #f the list of known status codes is checked for the recommended phrase and is used accordingly. Included are all phrases listed in RFC 2616, section 6.1.1. This list is exported as a parameter so that it can be extended or changed by users (which is explicitly allowed by the RFC). An error is raised if neither a reason is set in the response record nor its code is included in the list of known status codes.

Attachments (1)

default-reason-phrases.patch (4.1 KB) - added by Moritz Heidkamp 13 years ago.

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by Moritz Heidkamp

comment:1 Changed 13 years ago by sjamaan

Resolution: fixed
Status: newclosed

Thanks for the patch and good discussion; we settled on doing it slightly differently in order to prevent hard-to-debug situations where people set just the code on an object that already carries a non-#f reason set by code that ran earlier.

Now if you update the status, the code and reason are set automatically.

Implemented in r25018

comment:2 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.