[Sungrazr-svn] [106] Sungrazr_Server_Adapter: [CHG] Added send_length config option for controlling output of content-length header .

0 views
Skip to first unread message

cl...@killersoft.com

unread,
Dec 21, 2007, 11:40:16 PM12/21/07
to Sungra...@googlegroups.com
Revision
106
Author
clay
Date
2007-12-21 20:40:16 -0800 (Fri, 21 Dec 2007)

Log Message

Sungrazr_Server_Adapter: [CHG] Added send_length config option for controlling output of content-length header.

Modified Paths

Diff

Modified: trunk/Sungrazr/Server/Adapter.php (105 => 106)


--- trunk/Sungrazr/Server/Adapter.php	2007-12-22 02:31:53 UTC (rev 105)
+++ trunk/Sungrazr/Server/Adapter.php	2007-12-22 04:40:16 UTC (rev 106)
@@ -60,6 +60,13 @@
      * element of the array is the class name to pass to [[Solar::dependency]], 
      * and the second is the second parameter to pass to Solar::dependency.
      * 
+     * `send_length`
+     * : (bool) Send the content-length of the response. If the web server 
+     * is performing automatic compression after the output of the PHP script,
+     * you may wish to turn this off so the connection doesn't hang due to 
+     * a mismatch between the advertised size of the Content-Length and the
+     * actual size of the compressed response.
+     * 
      * @var array
      * 
      */
@@ -74,6 +81,7 @@
             'class'         => 'Solar_Request', 
             'spec'          => null,
         ),
+        'send_length'       => true,
     );
     
     /**
@@ -350,6 +358,11 @@
                 $this->_headers['Content-Type'] = $content_type;
             }
             
+            // send content length?
+            if ($this->_config['send_length']) {
+                $this->_headers['Content-Length'] = strlen($response);
+            }
+                        
             // append to Server header
             $server_class = get_class($this);
             if (! empty($this->_headers['Server'])) {
Reply all
Reply to author
Forward
0 new messages