I'm noticing that, since July 29 2013, The GCS webservice has started returning "HTTP/1.1 100 Continue" instead of the usual "HTTP/1.1 200 OK"(followed by some metadata about the server).
This is seen when doing a PUT Object on my end.
My question is, how do I resolve this? Do I just re-send the request? Do I re-direct the request to another location?
here is what my request looks like:
$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);
It's a feature of HTTP 1.1;
Basically, your client sends the header only with an extra line;
Expect: 100-continue
...and waits with posting the body for a few hundred milliseconds. If the timeout expires or there is a 100 Continue
response from the server, the client proceeds with the upload, if there's a 417 Expectation Failed
, the upload is aborted.
That allows the server to check if it will accept the request before the upload. For example if the size of a file is greater than the remaining quota of Google Cloud Storage, it would be useless to upload it before getting refused.
When the upload is complete, you will get an additional 200 OK
response as usual.
EDIT:
I see you're running PHP. More about this in PHP/Curl is available in this question.