For some reason my resumable upload fails to work and does not return the "Range:" header after sending the first chunk of data.
First chunk request header:
PUT /feeds/upload/create-session/default/private/full?convert=false&upload_id=AEnB2UqJ68bpomEud6sFRrvR3bimDX5ofW4IOh82TeH0-x3TTKQMjF3YeMYjaxIoS-DHz5dgbi3jqWeJ_fphlB59NpXAcRrHBw
HTTP/1.1
Host: docs.google.com
Content-Type: text/plain
Content-Length: 8
Content-Range: bytes 0-7/50
--
First chunk response header:
HTTP/1.1 308 Resume Incomplete
Server: Upload Server Built on May 13 2011 14:17:29 (1305321449)
Date: Thu, 02 Jun 2011 21:09:50 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html
-----------------
If I continue sending the second chunk it just fails with the following header:
-----------------
Second chunk request header:
PUT /feeds/upload/create-session/default/private/full?convert=false&upload_id=AEnB2UqJ68bpomEud6sFRrvR3bimDX5ofW4IOh82TeH0-x3TTKQMjF3YeMYjaxIoS-DHz5dgbi3jqWeJ_fphlB59NpXAcRrHBw
HTTP/1.1
Host: docs.google.com
Content-Type: text/plain
Content-Length: 8
Content-Range: bytes 8-15/50
--
Second chunk response header
HTTP/1.1 503 Service Unavailable
Server: Upload Server Built on May 13 2011 14:17:29 (1305321449)
Date: Thu, 02 Jun 2011 21:09:50 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html
-----------
Here's my php code for sending the chunks:
$headers = array(
"Content-Type: text/plain",
"Content-Length: 8",
"Content-Range: bytes 0-7/50",
"Accept:"
);
//--Make the upload request
$ureq = curl_init();
curl_setopt($ureq, CURLOPT_URL, $chunk_url);
curl_setopt($ureq, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ureq, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ureq, CURLOPT_HEADER, true);
curl_setopt($ureq, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ureq, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ureq, CURLOPT_POSTFIELDS, $package);
//--Execute upload request
$response = curl_exec($ureq);
//--Get error
if(curl_errno($ureq))
throw new Exception(curl_error($ureq));
echo $response;
Please let me know if you have any ideas,
Thank you!