perkeep/doc/blob-upload-protocol.txt

58 lines
1.5 KiB
Plaintext
Raw Normal View History

2010-06-21 06:14:30 +00:00
POST /camli/preupload HTTP/1.1
Host: example.com
camliversion=1&
blob1=sha1-9b03f7aca1ac60d40b5e570c34f79a3e07c918e8&
blob2=sha1-9242dbadb7827d697fab034a1e73f366b451ce4d
HTTP/1.1 200 OK
Content-Length: ...
Content-Type: text/plain
{
"maxUploadSize": 1048576,
"alreadyHave": [
{"blobRef": "sha1-9242dbadb7827d697fab034a1e73f366b451ce4d",
"size": 12312}
],
"uploadUrl": "http://example.com/SDALKSJDALKSJDKLASJD",
2010-06-21 06:17:56 +00:00
"uploadUrlExpirationSeconds": 7200,
2010-06-21 06:14:30 +00:00
}
POST /SDALKSJDALKSJDKLASJD HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=----------------------------9782c16cfc60
----------------------------9782c16cfc60
Content-Disposition: form-data; name="sha1-9b03f7aca1ac60d40b5e570c34f79a3e07c918e8"
Content-Type: application/octet-stream
(binary blob data)
----------------------------9782c16cfc60
Content-Disposition: form-data; name="sha1-9242dbadb7827d697fab034a1e73f366b451ce4d"
Content-Type: application/octet-stream
(binary blob data)
----------------------------9782c16cfc60--
2010-06-21 06:17:56 +00:00
HTTP/1.1 200 OK
Content-Type: text/plain
{
"maxUploadSize": 1048576,
"uploadUrl": "http://example.com/TheNextUploadUrlRandomString",
"uploadUrlExpirationSeconds": 7200,
}
2010-06-21 06:14:30 +00:00
If connection drops during a POST to an upload URL, you should re-do a
2010-06-21 06:17:56 +00:00
preupload request to verify which objects were received by the server
and which were not. Also, the URL you received from preupload
might've been bogus.
2010-06-21 06:14:30 +00:00
2010-07-11 04:58:30 +00:00
TODO: resuming uploading large blobs on slow crappy phone links