-
Notifications
You must be signed in to change notification settings - Fork 1
/
headers.txt
25 lines (22 loc) · 1009 Bytes
/
headers.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
This file is defining the headers used by the server & client during data transfer
client requests:
<1 byte for method> <50 bytes max for name>
method:
1 for ls
2 for get
if ls is used then name can by empty or can be a subdirectory
name:
file/directory name converted in ascii and with null byte appended,
null byte is required else the last byte will be replaced by null char.
example byte by byte of get request for "file.txt":
1 102 105 108 101 46 116 120 116 0 - <get> <"file.txt"> <null byte>
server ls response:
<1 byte for status> <1 byte for type of file n> <1 byte for name length of file n> <name of file n> <1 byte for type of file n+1> <1 byte for size of file n+1> <name of file n+1> <null byte>
status:
1 for success
0 for error
2 for invalid path requested
type:
1 for file
2 for directory
status is a header, and [type, name length, name] are specific to each file name