CDN Transfer Layer
Jump to navigation
Jump to search
The CDN HTTP Interface
There are three different types of requests
Name Lookups
A name lookup is an HTTP HEAD request that, given a named file, will return metadata. Example:
curl -v --head http://cdn.sirikata.com/dns/global/jkusnerz/Boulder_Spire_01.mesh
> HEAD /dns/global/jkusnerz/Boulder_Spire_01.mesh HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: cdn.sirikata.com > Accept: */*
HTTP/1.1 200 OK Date: Fri, 18 Jun 2010 18:34:25 GMT Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6 Accept-Ranges: bytes Hash: ddde4f8bed9a8bc97d8cbd4137c63efd5e625fabbbe695bc26756a3f5f430aa4 File-Size: 11650 Content-Type: text/html; charset=UTF-8
File Metadata
You can also do an HTTP HEAD request to get metadata for a hash directly. Example:
curl -v --head http://cdn.sirikata.com/files/global/ddde4f8bed9a8bc97d8cbd4137c63efd5e625fabbbe695bc26756a3f5f430aa4
> HEAD /files/global/ddde4f8bed9a8bc97d8cbd4137c63efd5e625fabbbe695bc26756a3f5f430aa4 HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: cdn.sirikata.com > Accept: */*
HTTP/1.1 200 OK Date: Fri, 18 Jun 2010 18:11:59 GMT Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6 Accept-Ranges: bytes Content-Length: 11650 Content-Type: text/html; charset=UTF-8
File Download
Once the hash is known, you can download the file, and range requests are supported. Example:
curl -v --range 500-999 http://cdn.sirikata.com/files/global/ddde4f8bed9a8bc97d8cbd4137c63efd5e625fabbbe695bc26756a3f5f430aa4
> GET /files/global/ddde4f8bed9a8bc97d8cbd4137c63efd5e625fabbbe695bc26756a3f5f430aa4 HTTP/1.1 > Range: bytes=500-999 > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 > Host: cdn.sirikata.com > Accept: */*
HTTP/1.1 200 OK Date: Fri, 18 Jun 2010 18:16:36 GMT Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6 Accept-Ranges: bytes Content-Length: 500 Content-Range: bytes 500-999/11650 Content-Type: text/html; charset=UTF-8
<500 bytes of binary data>