#804: Enhance HTTP status code handling of setRedirect
-------------------------+--------------------------------------------------
 Reporter:  MugeSo       |       Owner:  david 
     Type:  enhancement  |      Status:  new   
 Priority:  normal       |   Milestone:  0.11.3
Component:  response     |     Version:  0.11.2
 Severity:  normal       |    Keywords:        
Has_patch:  0            |  
-------------------------+--------------------------------------------------
 Hi,

 I suggest to enhance HTTP status code handling of setRedirect.

 Currently, we should check the request HTTP version to set valid status
 code.
 Surely, AgaviWebResponse throws an exception in setStatusCode when suplied
 status code is invalid for HTTP version of request.
 But we cannot catch that, because setStatusCode called in send method.

 For example, after we call setRedirect like:
 {{{
 $this->getResponse()->setRedirect($destination, 303);
 }}}
 following exception is thrown when HTTP version of the request is 1.0:
 {{{
   Message
 ===========
 Invalid HTTP/1.0 Status code: 303

   Stack Trace
 ===============
 0: /path-to-app/app/lib/vendor/agavi/response/AgaviWebResponse.class.php
 (line: 313)
 1: /path-to-app/app/lib/vendor/agavi/response/AgaviWebResponse.class.php
 (line: 196)
 2: /path-to-app/app/cache/config/_path-to-app_app_config_compile.xml__.php
 (line: 655)
 3: /path-to-app/pub/index.php (line: 23)

 }}}

 So I propose two plan.
  1. check suplied status code in setRedirect and throw an exception when
 it's invalid.
 This allows catch the exception in usercode.
  2. set alternative status code in setStatusCode instead of throw an
 exception.
 This means, for example, set 302 for HTTP/1.0 when 303 is set.

 Thanks,

 MugeSo

-- 
Ticket URL: <http://trac.agavi.org/ticket/804>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to