fixed filenames returned by flist
[reposerve] / protocol
1 Reposerve protocol v1
2 =====================
3
4 Commands are variable-length strings ending with a newline character (10), with
5 a maximum length of 256 characters, including the newline.
6
7 Responses always start with a result line with either "OK", followed by a byte
8 count of response data to follow, or an "ERR" followed by silence.
9
10 All binary values in response data are in little-endian byte order (LSB-first).
11
12 On connection establishment, the server sends a string of the form:
13     <server name>-<server version> protocol:<max protocol version supported>
14
15 DOS filename mode
16 -----------------
17 Request: "dos"
18 Description:
19 When the client sends a dos request, the server enables DOS filename
20 translation. Filename path components are automatically converted to DOS 8.3
21 form when transmitted to the client. File lists transmitted by the client are
22 translated back to the original names, capital letters for new untracked files
23 are converted to lowercase, except for specific files such as "Makefile*",
24 "GNUmakefile", "README*", and "COPYING*", otherwise for tracked files, the
25 existing capitalization is maintained.
26
27 File list
28 ---------
29 Request: "flist"
30 Response data: 
31
32     offset | size | description
33          0 |   4  | number of file entries (N)
34          4 |  32  | file entry 0
35       4+32 |  32  | file entry 1
36          ...
37     4+i*32 |  32  | file entry i
38          ...
39     4+N*32 |  ??  | file name table    
40
41     
42     File entry (32 bytes):
43     offset | size | description
44          0 |  16  | md5 checksum
45         16 |   4  | last modification timestamp
46         20 |   4  | file size
47         24 |   4  | name string offset (from the start of the name table)
48         28 |   4  | name string length
49
50 Description:
51 Provides a list of files managed by the repo server, with all the relevant
52 metadata about each file.
53
54 Push files
55 ----------
56 Request: "push"
57 Request data: Exactly the same as the "flist" response data, except that after
58 each file name in the name table, the contents of the corresponding file are
59 transmitted.
60
61 Description:
62 Although potentially every file can be sent using this request, the intent is to
63 only push modified files according to either the modification timestamp or the
64 checksum provided in the file list.
65
66 Pull files
67 ----------
68 Request: "pull"
69 Request data: Exactly the same as the "flist" response data.
70 Response data: Exactly the same as the "flist" response data, except that after
71 the file name in the name table, the contents of the corresponding file are
72 transmitted.
73
74 Description:
75 The server compares file checksums or modification timestamps in the request
76 file list, and sends back only those files which are modified.