From 884c868d9b1dc344833de631f1fef75bbcee3373 Mon Sep 17 00:00:00 2001 From: Izaya Date: Mon, 19 Feb 2018 22:11:25 +1100 Subject: [PATCH] rev 2 of the FRequest protocol --- FRequest/FRequest-protocol.md | 39 ++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/FRequest/FRequest-protocol.md b/FRequest/FRequest-protocol.md index 5e1ed1c..ab05e52 100644 --- a/FRequest/FRequest-protocol.md +++ b/FRequest/FRequest-protocol.md @@ -1,10 +1,39 @@ -# FRequest - Simple file transfer protocol +# FRequest - Simple file transfer protocol - Revision 1 -FRequest is a dumb simple file transfer protocol for use on Minitel networks. A file transfer occurs as follows: +FRequest is a simple file transfer protocol for use on Minitel or similar networks. + +## Requests + +A client request consists of the following: + + - A single-character request type + - The path for the file the client is requesting + - A newline + +Request types can be the following characters: + + - t - **t**ransfer - request file contents + - s - **s**tat - request file size and type (format: (d or f)<size>) + +## Server responses + +The server should respond with: + + - A single character status code + - The result of the request + +Status codes can be the following characters: + + - y - **y**es - file found, read and sent + - d - **d**irectory - directory listing sent + - n - **n**ot found - no such file or directory + - f - **f**ailure - other type of failure, reason sent + +## Example exchange 1. The client initiates a connection to the server on the FRequest port (default 70) -2. The client sends the path to the file they want, followed by a newline. -3. The server responds with either the contents of the requested file, a directory listing, or "file not found" if there is an error. -4. The server closes the connection. +2. The client sends *t* to ask for a transfer, the path *example.txt*, and a newline. +3. The server finds the file and responds with *y* followed by the file contents. +4. The server closes the connection when the transfer is completed. Servers may wish to implement restricting users to a specific directory.