💾 Archived View for goodclover.xyz › texts › WIP › olive-file-access-protocol.gmi captured on 2021-12-03 at 14:04:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2022-01-08)

-=-=-=-=-=-=-

Olive's File Access protocol

As always, I wrote this for fun and is just a concept.

Definitions

A byte is an octet, 8 bits.

Whitespace used in request/resonse headers must be a singular space.

Paths

Pretty much your standard URI domain+path.

The trailing slash must only be used for directories.

Servers should be strict about this, returning client errors.

path        = [domain-path] (file-path / dir-path)
domain-path = "//" name
file-path   = 1*("/" name
dir-path    = "/" / file-path "/"
; <name> is a non-zero sequence of printing UTF-8 characters

Interaction

The client will initiate the transaction, and send a <client-message>.

The server will then respond, either with a <server-resp>.

Client messages

((TODO: Client item-meta requests))

There are two kinds of client message:

Request codes:

L is identical to repeating I on every file in the folder.

The list may be in any order.

Upload codes:

client-message = request / upload
request        = "r" ("R" / "L" / "I") SP path CRLF
upload         = "u" ("W" / "P") SP path SP length CRLF body
length         = 1*DIGIT    ; Decimal digits
body           = *(%x01-FF)    ; Non-null bytes

<length> is the length of the body in bytes.

Server responses

Errors:

client/request error (fix & retry)

file/permisson error (don't retry)

server error

; WIP TODO
server-response = 

Requests

If the requested path doesn't exist, an error should be returned.

Listings

((TODO: Should files and dirs get a different symbol or should the trailing slash be relied on??))

item-list   = *(item CRLF)
item        = file / dir
file        = " " perms SP length SP file-path
dir         = "d" perms SP length SP dir-path
length      = 1*DIGIT    ; Decimal digits
perms       = ("r"/"-")("w"/"-")("m"/"-")

<length> is the length of the file in bytes.

<perms> is the permissions that the client has on that item.

Permissions

There are three permissons:

((TODO: Better name for "modify meta"))

The read permisson tells the client it can read (R).

The write permisson tells the client it can write (W,P).

The meta permisson tells the client it can modify perms, delete & move.

For directories:

Reading is listing a directories's contents.

Writing is creating new items/moving items to this directory.

((TODO: deleting/moving from??))

Permissons may be different on sub-directories.

e.g. a client may no perms on "/foo/", but may have full perms on "/foo/bar/".

((TODO: Having modify perms on an item inside a dir with no write perms??))

Uploads

If an upload was succesful, the server should repond with an OK and then info for the file (as if the client had I requested).