2
0

conditionals.luadoc 2.5 KB

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