SlashGrid HTTP Profile

From GridSiteWiki

The SlashGrid HTTP Profile defines a way of using components of HTTP, WebDAV and HTML to achieve filesystem semantics similar to POSIX, via HTTP(S) requests. This profile is implemented by GridSite/Apache servers, by GridSite's htcp command-line clients, and the SlashGrid virtual filesystem client. As a profile rather than a new standard, interoperation degrades gracefull when using third-party clients and servers which are unaware of the profile.

Directory Listings

Directory listings are obtaining by making an HTTP GET request for the directory URL, including the trailing slash. The server returns an HTML file, and the HREF attributes of A elements are parsed to construct a list of canonicalised URLs. Those URLs which represent files and immediate subdirectories of the directory are interpreted as its members.

'Long listings' and file stat() operations - including file modification times, length and type - can be constructed by issuing HTTP HEAD requests for the member URLs to obtain the Last-Modified (ctime and mtime) and Content-Length (size) header values. URLs ending in slash are interpreted as directories (and an HTTP 301 redirect response and Location header may be received if a trailing slash is missing from the request URL for a directory.)

Servers may improve the efficiency of this process by: (1) always including a trailing slash when linking to subdirectories; (2) include a content-length attribute in the A element, to give the size in bytes; (3) include a last-modified attribute in the A element, to give the modification time of the file, as seconds since 1 Jan 1970.

POSIX file operations

To be completed

open - null operation (or file descriptor / file name book keeping)

close - null operation

read - GET /... with Range: x-y

write - PUT /... either with Content-Range: x-y; or without range for O_TRUNC; if creating, then create temporary file, seek to end (ie to final size), write one dummy byte, write file from the start, rename to final name on success or destroy. This provides space reservation (based on counting st_size values of all files to find space used/reserved.)

unlink - DELETE /...

rmdir - DELETE /.../

mkdir - PUT /.../

rename - MOVE /... Destination: /...

trunc - PUT with Content-Range: *-*/nnn

stat - HEAD /... (Last-Modified: Content-Length: and trailing slash if directory)

scandir - GET /.../ (HREF="/..." links used to construct list of directory members.)