我注意到,自 2013 年 7 月 29 日以来,GCS 网络服务开始返回“HTTP/1.1 100 Continue”而不是通常的“HTTP/1.1 200 OK”(后面是一些关于服务器的元数据)。
这在我做 PUT 对象时可以看到。
我的问题是,我该如何解决这个问题?我只是重新发送请求吗?我是否将请求重定向到另一个位置?
这是我的请求的样子:
$headers = array('Host: '.$bucket.'.commondatastorage.googleapis.com',
'Date: '.$timestamp, $version_header, 'Content-Type: text/plain',
$project_header, 'Content-Length: '.filesize($objectPath),
'Authorization: OAuth '.$accessToken);
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_PUT, 1);
curl_setopt($c, CURLOPT_INFILE, $fp);
curl_setopt($c, CURLOPT_INFILESIZE, filesize($objectPath));
curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($c, CURLOPT_TIMEOUT, 60); //timeout in 60s
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($c);