http.luadoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ---[[
  2. LuCI Web Framework high-level HTTP functions.
  3. module "luci.http"
  4. ]]
  5. ---[[
  6. Close the HTTP-Connection.
  7. @class function
  8. @name close
  9. ]]
  10. ---[[
  11. Return the request content if the request was of unknown type.
  12. @class function
  13. @name content
  14. @return HTTP request body
  15. @return HTTP request body length
  16. ]]
  17. ---[[
  18. Get a certain HTTP input value or a table of all input values.
  19. @class function
  20. @name formvalue
  21. @param name Name of the GET or POST variable to fetch
  22. @param noparse Don't parse POST data before getting the value
  23. @return HTTP input value or table of all input value
  24. ]]
  25. ---[[
  26. Get a table of all HTTP input values with a certain prefix.
  27. @class function
  28. @name formvaluetable
  29. @param prefix Prefix
  30. @return Table of all HTTP input values with given prefix
  31. ]]
  32. ---[[
  33. Get the value of a certain HTTP-Cookie.
  34. @class function
  35. @name getcookie
  36. @param name Cookie Name
  37. @return String containing cookie data
  38. ]]
  39. ---[[
  40. Get the value of a certain HTTP environment variable
  41. or the environment table itself.
  42. @class function
  43. @name getenv
  44. @param name Environment variable
  45. @return HTTP environment value or environment table
  46. ]]
  47. ---[[
  48. Set a handler function for incoming user file uploads.
  49. @class function
  50. @name setfilehandler
  51. @param callback Handler function
  52. ]]
  53. ---[[
  54. Send a HTTP-Header.
  55. @class function
  56. @name header
  57. @param key Header key
  58. @param value Header value
  59. ]]
  60. ---[[
  61. Set the mime type of following content data.
  62. @class function
  63. @name prepare_content
  64. @param mime Mimetype of following content
  65. ]]
  66. ---[[
  67. Get the RAW HTTP input source
  68. @class function
  69. @name source
  70. @return HTTP LTN12 source
  71. ]]
  72. ---[[
  73. Set the HTTP status code and status message.
  74. @class function
  75. @name status
  76. @param code Status code
  77. @param message Status message
  78. ]]
  79. ---[[
  80. Send a chunk of content data to the client.
  81. This function is as a valid LTN12 sink.
  82. If the content chunk is nil this function will automatically invoke close.
  83. @class function
  84. @name write
  85. @param content Content chunk
  86. @param src_err Error object from source (optional)
  87. @see close
  88. ]]
  89. ---[[
  90. Splice data from a filedescriptor to the client.
  91. @class function
  92. @name splice
  93. @param fp File descriptor
  94. @param size Bytes to splice (optional)
  95. ]]
  96. ---[[
  97. Redirects the client to a new URL and closes the connection.
  98. @class function
  99. @name redirect
  100. @param url Target URL
  101. ]]
  102. ---[[
  103. Create a querystring out of a table of key - value pairs.
  104. @class function
  105. @name build_querystring
  106. @param table Query string source table
  107. @return Encoded HTTP query string
  108. ]]
  109. ---[[
  110. Return the URL-decoded equivalent of a string.
  111. @param str URL-encoded string
  112. @param no_plus Don't decode + to " "
  113. @return URL-decoded string
  114. @see urlencode
  115. ]]
  116. ---[[
  117. Return the URL-encoded equivalent of a string.
  118. @param str Source string
  119. @return URL-encoded string
  120. @see urldecode
  121. ]]
  122. ---[[
  123. Send the given data as JSON encoded string.
  124. @class function
  125. @name write_json
  126. @param data Data to send
  127. ]]