9cfe02dd507f87b4cc2435cffceecf06ef70bde3
[project/luci.git] / modules / luci-base / luasrc / http / protocol / conditionals.luadoc
1 ---[[
2 LuCI http protocol implementation - HTTP/1.1 bits.
3
4 This class provides basic ETag handling and implements most of the
5 conditional HTTP/1.1 headers specified in RFC2616 Sct. 14.24 - 14.28 .
6 ]]
7 module "luci.http.protocol.conditionals"
8
9 ---[[
10 Implement 14.19 / ETag.
11
12 @class function
13 @name mk_etag
14 @param stat     A file.stat structure
15 @return         String containing the generated tag suitable for ETag headers
16 ]]
17
18 ---[[
19 14.24 / If-Match
20
21 Test whether the given message object contains an "If-Match" header and
22 compare it against the given stat object.
23 @class function
24 @name if_match
25 @param req      HTTP request message object
26 @param stat     A file.stat object
27 @return         Boolean indicating whether the precondition is ok
28 @return         Alternative status code if the precondition failed
29 ]]
30
31 ---[[
32 14.25 / If-Modified-Since
33
34 Test whether the given message object contains an "If-Modified-Since" header
35 and compare it against the given stat object.
36 @class function
37 @name if_modified_since
38 @param req      HTTP request message object
39 @param stat     A file.stat object
40 @return         Boolean indicating whether the precondition is ok
41 @return         Alternative status code if the precondition failed
42 @return         Table containing extra HTTP headers if the precondition failed
43 ]]
44
45 ---[[
46 14.26 / If-None-Match
47
48 Test whether the given message object contains an "If-None-Match" header and
49 compare it against the given stat object.
50 @class function
51 @name if_none_match
52 @param req      HTTP request message object
53 @param stat     A file.stat object
54 @return         Boolean indicating whether the precondition is ok
55 @return         Alternative status code if the precondition failed
56 @return         Table containing extra HTTP headers if the precondition failed
57 ]]
58
59 ---[[
60 14.27 / If-Range
61
62 The If-Range header is currently not implemented due to the lack of general
63 byte range stuff in luci.http.protocol . This function will always return
64 false, 412 to indicate a failed precondition.
65 @class function
66 @name if_range
67 @param req      HTTP request message object
68 @param stat     A file.stat object
69 @return         Boolean indicating whether the precondition is ok
70 @return         Alternative status code if the precondition failed
71 ]]
72
73 ---[[
74 14.28 / If-Unmodified-Since
75
76 Test whether the given message object contains an "If-Unmodified-Since"
77 header and compare it against the given stat object.
78 @class function
79 @name if_unmodified_since
80 @param req      HTTP request message object
81 @param stat     A file.stat object
82 @return         Boolean indicating whether the precondition is ok
83 @return         Alternative status code if the precondition failed
84 ]]
85