Development

Changeset 11955

You must first sign up to be able to contribute.

Changeset 11955

Show
Ignore:
Timestamp:
10/05/08 18:11:51 (6 years ago)
Author:
fabien
Message:

[1.1, 1.2] fixed HTTP-Version in sfWebResponse broken under certain circumstances (closes #4578, #2817)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/config/sfFactoryConfigHandler.class.php

    r9159 r11955  
    9595 
    9696        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)); 
    9898          // TODO: this is a bit ugly, as it only works for sfWebRequest & sfWebResponse combination. see #3397 
    9999          $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  
    8383   * Available options: 
    8484   * 
    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) 
    8789   * 
    8890   * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance 
     
    105107    { 
    106108      $this->options['charset'] = 'utf-8'; 
     109    } 
     110 
     111    if (!isset($this->options['http_protocol'])) 
     112    { 
     113      $this->options['http_protocol'] = 'HTTP/1.0'; 
    107114    } 
    108115 
     
    293300 
    294301    // status 
    295     $status = 'HTTP/1.1 '.$this->statusCode.' '.$this->statusText; 
     302    $status = $this->options['http_protocol'].' '.$this->statusCode.' '.$this->statusText; 
    296303    header($status); 
    297304 
  • branches/1.2/lib/config/sfFactoryConfigHandler.class.php

    r11785 r11955  
    9696 
    9797        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)); 
    9999          // TODO: this is a bit ugly, as it only works for sfWebRequest & sfWebResponse combination. see #3397 
    100100          $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  
    9090   * Available options: 
    9191   * 
    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) 
    9496   * 
    9597   * @param  sfEventDispatcher $dispatcher  An sfEventDispatcher instance 
     
    117119    { 
    118120      $this->options['send_http_headers'] = true; 
     121    } 
     122 
     123    if (!isset($this->options['http_protocol'])) 
     124    { 
     125      $this->options['http_protocol'] = 'HTTP/1.0'; 
    119126    } 
    120127 
     
    315322 
    316323    // status 
    317     $status = 'HTTP/1.1 '.$this->statusCode.' '.$this->statusText; 
     324    $status = $this->options['http_protocol'].' '.$this->statusCode.' '.$this->statusText; 
    318325    header($status); 
    319326