One has to specify special flag (configurable in fastcgi daemon) in URI and its requested ID must contain one token from provided in config list (like .jpg or .xml), otherwise error is returned to the caller.
If all constraints are met, fascgi daemon will download given object from the storage into its RAM (which basically means that this proxy is not supposed to push very large object throught itself, instead it should be configured to return direct URL) and push it to the client. It will not set tricky things like content type header or anything else, but libfcgi will take care about setting correct content length header (btw, the way it does this shows it will not work with large objects too, looks like it buffers data from multiple FCGI_fwrite() calls).
So, if fastcgi daemon is properly configured, following request will 'force it' to show picture in the browser:
GET /test.mp3?name=123456.jpg&direct=1 Host: devfs1
and following one will return 'redirect' XML with appropriate configurable status (edited to add some newlines for nicer view):
GET /test.mp3?name=123456.jpg Host: devfs1 Location: http://devfs8/1/f5/f58fd51148ce114a88ce9d668fae9b1a28869ea8 Set-Cookie: Our_complany_cookie=87c62d2279e78da1cbabd038a7b7b16fb2678b66c097c92e4806cbc7191e8e03; expires=Mon, 23-Nov-2009 02:15:22 MSK Content-type: application/xml <download-info> <host>devfs8</host> <path>/1/f5/f58fd51148ce114a88ce9d668fae9b1a28869ea8</path> <ts>4b09b7fa</ts> <s>c847dad56d952d44e20a9b57bae4ca9824af531661a8cfb0fc48d65791eca2ab</s> </download-info>
where secret is generated using private key, timestamp and cookie, and cookie itself is either set by the client or generated using client address, timestamp and random data. Its expiration time is also configurable. Cookie is supposed to be used by the storage server software to check whether it is allowed to return its data. Direct object reading does not check cookies.
I will desribe it in details in fcgi README file in the new release, which is scheduled to see the light in a day or so.
I have to admit, that it was easier than writing filesystem, which effectively will do very similar things :)
Although not that much - elliptics network provides library API, so it is simple, but I had to write it at first, which effectively equals to write it in kernel. Unfortunately it is not that simple to use that code in kernel, and actually kernel does not need it all, only basic helpers to maintain stack of attributes in the transaction, everything else (low-level IO for exampl) is actually very different from userspace.
That's it, so far there are no more feature requests for elliptics network and fastcgi daemon, so it will be the next version (it also contains bug fixes, very likely 2.6.2 will not work the way you expect, so use git for now, it allows to download a tarball :)
Recent comments
2 weeks 2 days ago
2 weeks 2 days ago
2 weeks 3 days ago
2 weeks 4 days ago
2 weeks 5 days ago
2 weeks 5 days ago
3 weeks 5 days ago
3 weeks 5 days ago
4 weeks 6 hours ago
4 weeks 6 hours ago