Exemplo n.º 1
0
 /**
  * @return string
  */
 public function getStatusMessage()
 {
     return $this->request->getStatusMessage($this->status);
 }
Exemplo n.º 2
0
 /**
  * Prepare the handle to be configured by a given request
  * @param  AbstractRequest $request
  * @return CurlHandle
  */
 public function prepare(AbstractRequest $request)
 {
     $config = $request->getOptions();
     $this->options[CURLOPT_URL] = (string) $config->url;
     $this->options[CURLOPT_UPLOAD] = (bool) $config->upload;
     $this->options[CURLOPT_HTTPHEADER] = $request->getHeaderLines();
     if ($config instanceof Configuration\HttpConfiguration) {
         $this->prepareHttp($config);
     }
     if ($config instanceof Configuration\FtpConfiguration) {
         $this->options[CURLOPT_FTP_USE_EPSV] = $config->passive;
         $this->options[CURLOPT_QUOTE] = $config->commandsRequest();
         $this->options[CURLOPT_POSTQUOTE] = $config->commandsPost();
     }
     if ($config instanceof Configuration\SshConfiguration) {
         $this->options[CURLOPT_POSTQUOTE] = $config->commandsPost();
     }
     if ($config->hasBody()) {
         $body = $config->body;
         if (is_resource($body)) {
             $this->options[CURLOPT_INFILE] = $body;
             $md = stream_get_meta_data($body);
             $this->options[CURLOPT_INFILESIZE] = filesize($md['uri']);
         } else {
             $this->options[CURLOPT_POSTFIELDS] = $body;
         }
     } else {
         $this->options[CURLOPT_NOBODY] = true;
     }
     return $this;
 }