Changeset 11955
- Timestamp:
- 10/05/08 18:11:51 (5 years ago)
- Files:
-
- branches/1.1/lib/config/sfFactoryConfigHandler.class.php (modified) (1 diff)
- branches/1.1/lib/response/sfWebResponse.class.php (modified) (3 diffs)
- branches/1.2/lib/config/sfFactoryConfigHandler.class.php (modified) (1 diff)
- branches/1.2/lib/response/sfWebResponse.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/config/sfFactoryConfigHandler.class.php
r9159 r11955 95 95 96 96 case 'response': 97 $instances[] = sprintf(" \$class = sfConfig::get('sf_factory_response', '%s');\n \$this->factories['response'] = new \$class(\$this->dispatcher, sfConfig::get('sf_factory_response_parameters', %s));", $class, var_export($parameters, true));97 $instances[] = sprintf(" \$class = sfConfig::get('sf_factory_response', '%s');\n \$this->factories['response'] = new \$class(\$this->dispatcher, sfConfig::get('sf_factory_response_parameters', array_merge(array('http_protocol' => isset(\$_SERVER['SERVER_PROTOCOL']) ? \$_SERVER['SERVER_PROTOCOL'] : null), %s)));", $class, var_export($parameters, true)); 98 98 // TODO: this is a bit ugly, as it only works for sfWebRequest & sfWebResponse combination. see #3397 99 99 $instances[] = sprintf(" if (\$this->factories['request'] instanceof sfWebRequest \n && \$this->factories['response'] instanceof sfWebResponse \n && 'HEAD' == \$this->factories['request']->getMethodName())\n { \n \$this->factories['response']->setHeaderOnly(true);\n }\n"); branches/1.1/lib/response/sfWebResponse.class.php
r9745 r11955 83 83 * Available options: 84 84 * 85 * * charset: The charset to use (utf-8 by default) 86 * * content_type: The content type (text/html by default) 85 * * charset: The charset to use (utf-8 by default) 86 * * content_type: The content type (text/html by default) 87 * * send_http_headers: Whether to send HTTP headers or not (true by default) 88 * * http_protocol: The HTTP protocol to use for the response (HTTP/1.1 by default) 87 89 * 88 90 * @param sfEventDispatcher $dispatcher An sfEventDispatcher instance … … 105 107 { 106 108 $this->options['charset'] = 'utf-8'; 109 } 110 111 if (!isset($this->options['http_protocol'])) 112 { 113 $this->options['http_protocol'] = 'HTTP/1.0'; 107 114 } 108 115 … … 293 300 294 301 // status 295 $status = 'HTTP/1.1'.$this->statusCode.' '.$this->statusText;302 $status = $this->options['http_protocol'].' '.$this->statusCode.' '.$this->statusText; 296 303 header($status); 297 304 branches/1.2/lib/config/sfFactoryConfigHandler.class.php
r11785 r11955 96 96 97 97 case 'response': 98 $instances[] = sprintf(" \$class = sfConfig::get('sf_factory_response', '%s');\n \$this->factories['response'] = new \$class(\$this->dispatcher, sfConfig::get('sf_factory_response_parameters', %s));", $class, var_export($parameters, true));98 $instances[] = sprintf(" \$class = sfConfig::get('sf_factory_response', '%s');\n \$this->factories['response'] = new \$class(\$this->dispatcher, sfConfig::get('sf_factory_response_parameters', array_merge(array('http_protocol' => isset(\$_SERVER['SERVER_PROTOCOL']) ? \$_SERVER['SERVER_PROTOCOL'] : null), %s)));", $class, var_export($parameters, true)); 99 99 // TODO: this is a bit ugly, as it only works for sfWebRequest & sfWebResponse combination. see #3397 100 100 $instances[] = sprintf(" if (\$this->factories['request'] instanceof sfWebRequest \n && \$this->factories['response'] instanceof sfWebResponse \n && 'HEAD' == \$this->factories['request']->getMethod())\n { \n \$this->factories['response']->setHeaderOnly(true);\n }\n"); branches/1.2/lib/response/sfWebResponse.class.php
r11102 r11955 90 90 * Available options: 91 91 * 92 * * charset: The charset to use (utf-8 by default) 93 * * content_type: The content type (text/html by default) 92 * * charset: The charset to use (utf-8 by default) 93 * * content_type: The content type (text/html by default) 94 * * send_http_headers: Whether to send HTTP headers or not (true by default) 95 * * http_protocol: The HTTP protocol to use for the response (HTTP/1.1 by default) 94 96 * 95 97 * @param sfEventDispatcher $dispatcher An sfEventDispatcher instance … … 117 119 { 118 120 $this->options['send_http_headers'] = true; 121 } 122 123 if (!isset($this->options['http_protocol'])) 124 { 125 $this->options['http_protocol'] = 'HTTP/1.0'; 119 126 } 120 127 … … 315 322 316 323 // status 317 $status = 'HTTP/1.1'.$this->statusCode.' '.$this->statusText;324 $status = $this->options['http_protocol'].' '.$this->statusCode.' '.$this->statusText; 318 325 header($status); 319 326