M
M
MMMYIWW2017-05-27 18:48:59
API
MMMYIWW, 2017-05-27 18:48:59

WebDav Yandex Disk. Why does it give 499 code?

I send zip archives from my server. Archives up to 100mb are uploaded successfully, but those larger than that are not.
For example, this one is 200mb in size.

array(26) {
  ["url"]=>
  string(107) "https://webdav.yandex.ru/folder1/folder/folder2/c94ba23c14d6a3d0e098ba75ca211e65.zip"
  ["content_type"]=>
  NULL
  ["http_code"]=>
  int(499)
  ["header_size"]=>
  int(220)
  ["request_size"]=>
  int(420)
  ["filetime"]=>
  int(-1)
  ["ssl_verify_result"]=>
  int(0)
  ["redirect_count"]=>
  int(0)
  ["total_time"]=>
  float(20.251316)
  ["namelookup_time"]=>
  float(4.2E-5)
  ["connect_time"]=>
  float(0.004587)
  ["pretransfer_time"]=>
  float(0.066884)
  ["size_upload"]=>
  float(0)
  ["size_download"]=>
  float(0)
  ["speed_download"]=>
  float(0)
  ["speed_upload"]=>
  float(0)
  ["download_content_length"]=>
  float(0)
  ["upload_content_length"]=>
  float(214618104)
  ["starttransfer_time"]=>
  float(20.251286)
  ["redirect_time"]=>
  float(0)
  ["redirect_url"]=>
  string(0) ""
  ["primary_ip"]=>
  string(13) "87.250.250.53"
  ["certinfo"]=>
  array(0) {
  }
  ["primary_port"]=>
  int(443)
  ["local_ip"]=>
  string(15) "ip"
  ["local_port"]=>
  int(39674)
}

function __construct($user, $pass) {
        $this->headers[] = "Authorization: Basic " . base64_encode($user . ":" . $pass);

        $this->ch = curl_init();
        curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17");
        curl_setopt($this->ch, CURLOPT_HEADER, 0);
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($this->ch, CURLOPT_BINARYTRANSFER, 1);
        curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, false);
    }
    function put($file, $url) {
        curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'PUT');
        curl_setopt($this->ch, CURLOPT_URL, 'https://webdav.yandex.ru' . $url);
        curl_setopt($this->ch, CURLOPT_POSTFIELDS, file_get_contents($file));

        $this->my_exec();
        return $this->ansver;
    }
    function my_exec() {
        curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->headers);
        $this->ansver = curl_exec($this->ch);
        $this->info = curl_getinfo($this->ch);
        //print_r($this->info);
        curl_close($this->ch);
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question