Hi,

after updating some content in my application, I want to redirect with a 303 
HTTP response code. If I use ezcMvcExternalRedirect it uses a very unspecific 
302 code. In HTTP 1.1 you could use 301 and 307 instead of 302.

The German wikipedia (http://de.wikipedia.org/wiki/HTTP-Statuscode) even 
states not to use the 302 redirect when redirecting to other sites because of 
an search engine error (URL hijacking).

Finally I think, I should not patch ezcMvcExternalRedirect but extend it with 
semantic meanings like "content updated, show normal view", "content is 
available on other location" and so on.

But I even need some patch like:

--- response_writers/http.php   (Revision 94)
+++ response_writers/http.php   (Arbeitskopie)
@@ -73,7 +73,14 @@
         // write output
         foreach ( $this->headers as $header => $value )
         {
-            header( "$header: $value" );
+            if ( !is_array( $value ) )
+            {
+                header( "$header: $value" );
+            }
+            else
+            {
+                header( "$header: {$value[0]}", true, $value[1] );
+            }
         }
         // do cookies
         foreach ( $this->response->cookies as $cookie )

If the value of the header is an array, the second entry is the status code. 
Otherwise, everything behaves like before.

The code seems to be a little bit hackish (because of the semantic in a simple 
array struct). But I don't have another idea without breaking BC.

What do you think?

Have a nice weekend

Thomas
-- 
Thomas Nunninger
Steinhalde 108
79117 Freiburg

Tel.:  +49 761 1201850
Mobil: +49 163 7115153
http://nunninger.info

USt-IdNr: DE259832548
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to