includes/http.php
changeset 1135 56c0abbdad3e
parent 1113 000791abdc7e
child 1224 a54e149f4a78
equal deleted inserted replaced
1134:4fdd92da4fe8 1135:56c0abbdad3e
   151    */
   151    */
   152   
   152   
   153   var $headers = array();
   153   var $headers = array();
   154   
   154   
   155   /**
   155   /**
       
   156    * Follow server-side redirects; defaults to true.
       
   157    * @var bool
       
   158    */
       
   159   
       
   160   var $follow_redirects = true;
       
   161   
       
   162   /**
   156    * Cached response.
   163    * Cached response.
   157    * @var string, or bool:false if the request hasn't been sent yet
   164    * @var string, or bool:false if the request hasn't been sent yet
   158    */
   165    */
   159   
   166   
   160   var $response = false;
   167   var $response = false;
   448       $this->_parse_response_code($buffer);
   455       $this->_parse_response_code($buffer);
   449       $this->response = $buffer;
   456       $this->response = $buffer;
   450     }
   457     }
   451     // obey redirects
   458     // obey redirects
   452     $i = 0;
   459     $i = 0;
   453     while ( $i < 20 )
   460     while ( $i < 20 && $this->follow_redirects )
   454     {
   461     {
   455       $incoming_headers = $this->get_response_headers_array();
   462       $incoming_headers = $this->get_response_headers_array();
   456       if ( !$incoming_headers )
   463       if ( !$incoming_headers )
   457         break;
   464         break;
   458       if ( isset($incoming_headers['Location']) )
   465       if ( isset($incoming_headers['Location']) )