[Twisted-Python] twisted.web.client and status 202

Tommi Virtanen tv at twistedmatrix.com
Sun Jun 22 10:12:32 MDT 2003


	Hi. In making TouRSSt (http://toursst.sf.net/,
	soon in a Debian mirror near you), I noticed
	Slashdot's RSS feed gives status code 202.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

10.2.3 202 Accepted

The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. There is no facility for re-sending a status code from an asynchronous operation such as this.

The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The entity returned with this response SHOULD include an indication of the request's current status and either a pointer to a status monitor or some estimate of when the user can expect the request to be fulfilled.

	Current twisted.web.client believes this to be an
	error, and aborts fetching the RSS. Liiwi finally
	prodded me into doing something about it. Here's
	a change he suggested and I agree with:

--- twisted/web/client.py	20 Jun 2003 17:14:16 -0000	1.19
+++ twisted/web/client.py	22 Jun 2003 16:01:20 -0000
@@ -59,6 +59,8 @@
     def handleStatus_200(self):
         self.factory.gotHeaders(self.headers)
 
+    handleStatus_202 = handleStatus_200
+
     def handleStatusDefault(self):
         self.failed = 1
 

	Yell now or forever clean up the CVS tree I commit
	that into :)

-- 
:(){ :|:&};:




More information about the Twisted-Python mailing list