summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-httpprotoutils/luasrc/http/conditionals.luadoc
blob: 7ce0b5ebe34669bbfd239a6867f8527f9c048f62 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---[[
LuCI http protocol implementation - HTTP/1.1 bits.

This class provides basic ETag handling and implements most of the
conditional HTTP/1.1 headers specified in RFC2616 Sct. 14.24 - 14.28 .
]]
module "luci.http.conditionals"

---[[
Implement 14.19 / ETag.

@class function
@name mk_etag
@param stat	A file.stat structure
@return		String containing the generated tag suitable for ETag headers
]]

---[[
14.24 / If-Match

Test whether the given message object contains an "If-Match" header and
compare it against the given stat object.
@class function
@name if_match
@param req	HTTP request message object
@param stat	A file.stat object
@return		Boolean indicating whether the precondition is ok
@return		Alternative status code if the precondition failed
]]

---[[
14.25 / If-Modified-Since

Test whether the given message object contains an "If-Modified-Since" header
and compare it against the given stat object.
@class function
@name if_modified_since
@param req	HTTP request message object
@param stat	A file.stat object
@return		Boolean indicating whether the precondition is ok
@return		Alternative status code if the precondition failed
@return		Table containing extra HTTP headers if the precondition failed
]]

---[[
14.26 / If-None-Match

Test whether the given message object contains an "If-None-Match" header and
compare it against the given stat object.
@class function
@name if_none_match
@param req	HTTP request message object
@param stat	A file.stat object
@return		Boolean indicating whether the precondition is ok
@return		Alternative status code if the precondition failed
@return		Table containing extra HTTP headers if the precondition failed
]]

---[[
14.27 / If-Range

The If-Range header is currently not implemented due to the lack of general
byte range stuff in luci.http.protocol . This function will always return
false, 412 to indicate a failed precondition.
@class function
@name if_range
@param req	HTTP request message object
@param stat	A file.stat object
@return		Boolean indicating whether the precondition is ok
@return		Alternative status code if the precondition failed
]]

---[[
14.28 / If-Unmodified-Since

Test whether the given message object contains an "If-Unmodified-Since"
header and compare it against the given stat object.
@class function
@name if_unmodified_since
@param req	HTTP request message object
@param stat	A file.stat object
@return		Boolean indicating whether the precondition is ok
@return		Alternative status code if the precondition failed
]]