/**
  * Constructs a new response object. The input can be either a response object or a 
  * raw HTTP message as string.
  * 
  * @param Customweb_Core_Http_IResponse|string $response
  */
 public function __construct($message = null)
 {
     if ($message !== null) {
         if ($message instanceof Customweb_Core_Http_Response) {
             parent::__construct($message);
             $this->statusCode = $message->statusCode;
             $this->statusMessage = $message->statusMessage;
             $this->cookies = $message->cookies;
             $this->location = $message->location;
         } else {
             if ($message instanceof Customweb_Core_Http_IResponse) {
                 $this->setBody($message->getBody());
                 $this->setHeaders($message->getHeaders());
                 $this->parseStatusLine($message->getStatusLine());
             } else {
                 $message = (string) $message;
                 parent::__construct($message);
             }
         }
     } else {
         parent::__construct();
         $this->setContentType('text/html; charset=utf-8');
     }
 }
 /**
  * 
  * @param Customweb_Core_Url | Customweb_Core_Http_IRequest | string $input
  */
 public function __construct($input = null)
 {
     $this->url = new Customweb_Core_Url();
     if ($input !== null) {
         if (is_string($input) && (strpos(strtolower($input), 'http://') === 0 || strpos(strtolower($input), 'https://') === 0)) {
             $input = new Customweb_Core_Url($input);
         }
         if ($input instanceof Customweb_Core_Url) {
             parent::__construct();
             $this->setUserAgent('Customweb HTTP Client/2');
             $this->setUrl($input);
         } else {
             if ($input instanceof Customweb_Core_Http_Request) {
                 parent::__construct($input);
                 $this->url = $input->url;
                 $this->method = $input->method;
                 $this->remoteAddress = $input->remoteAddress;
                 $this->cookies = $input->cookies;
                 $this->userAgent = $input->userAgent;
             } else {
                 if ($input instanceof Customweb_Core_Http_IRequest) {
                     $this->setBody($input->getBody());
                     $this->setHeaders($input->getHeaders());
                     $this->parseStatusLine($input->getStatusLine());
                     $this->setRemoteAddress($input->getRemoteAddress());
                     $this->setPort($input->getPort());
                 } else {
                     parent::__construct((string) $input);
                 }
             }
         }
     } else {
         parent::__construct();
         $this->setUserAgent('Customweb HTTP Client/2');
     }
 }