group__http.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.11"/>
  7. <title>libwebsockets: HTTP</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="resize.js"></script>
  13. <script type="text/javascript" src="navtreedata.js"></script>
  14. <script type="text/javascript" src="navtree.js"></script>
  15. <script type="text/javascript">
  16. $(document).ready(initResizable);
  17. $(window).load(resizeHeight);
  18. </script>
  19. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  20. </head>
  21. <body>
  22. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  23. <div id="titlearea">
  24. <table cellspacing="0" cellpadding="0">
  25. <tbody>
  26. <tr style="height: 56px;">
  27. <td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
  28. <td id="projectalign" style="padding-left: 0.5em;">
  29. <div id="projectname">libwebsockets
  30. </div>
  31. <div id="projectbrief">Lightweight C library for HTML5 websockets</div>
  32. </td>
  33. </tr>
  34. </tbody>
  35. </table>
  36. </div>
  37. <!-- end header part -->
  38. <!-- Generated by Doxygen 1.8.11 -->
  39. <div id="navrow1" class="tabs">
  40. <ul class="tablist">
  41. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  42. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  43. <li class="current"><a href="modules.html"><span>Modules</span></a></li>
  44. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  45. <li><a href="files.html"><span>Files</span></a></li>
  46. </ul>
  47. </div>
  48. </div><!-- top -->
  49. <div id="side-nav" class="ui-resizable side-nav-resizable">
  50. <div id="nav-tree">
  51. <div id="nav-tree-contents">
  52. <div id="nav-sync" class="sync"></div>
  53. </div>
  54. </div>
  55. <div id="splitbar" style="-moz-user-select:none;"
  56. class="ui-resizable-handle">
  57. </div>
  58. </div>
  59. <script type="text/javascript">
  60. $(document).ready(function(){initNavTree('group__http.html','');});
  61. </script>
  62. <div id="doc-content">
  63. <div class="header">
  64. <div class="summary">
  65. <a href="#groups">Modules</a> &#124;
  66. <a href="#nested-classes">Data Structures</a> &#124;
  67. <a href="#func-members">Functions</a> </div>
  68. <div class="headertitle">
  69. <div class="title">HTTP</div> </div>
  70. </div><!--header-->
  71. <div class="contents">
  72. <table class="memberdecls">
  73. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
  74. Modules</h2></td></tr>
  75. <tr class="memitem:group__form-parsing"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__form-parsing.html">Form Parsing</a></td></tr>
  76. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  77. <tr class="memitem:group__html-chunked-substitution"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__html-chunked-substitution.html">HTML Chunked Substitution</a></td></tr>
  78. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  79. <tr class="memitem:group__httpft"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpft.html">HTTP File transfer</a></td></tr>
  80. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  81. <tr class="memitem:group__HTTP-headers-create"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__HTTP-headers-create.html">HTTP headers: create</a></td></tr>
  82. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  83. <tr class="memitem:group__HTTP-headers-read"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__HTTP-headers-read.html">HTTP headers: read</a></td></tr>
  84. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  85. <tr class="memitem:group__urlendec"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__urlendec.html">Urlencode and Urldecode</a></td></tr>
  86. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  87. </table><table class="memberdecls">
  88. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  89. Data Structures</h2></td></tr>
  90. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlws__tokens.html">lws_tokens</a></td></tr>
  91. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  92. </table><table class="memberdecls">
  93. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  94. Functions</h2></td></tr>
  95. <tr class="memitem:gac8a4a71240857dc6b2ed70456b6923f4"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__http.html#gac8a4a71240857dc6b2ed70456b6923f4">lws_return_http_status</a> (struct lws *wsi, unsigned int code, const char *html_body)</td></tr>
  96. <tr class="separator:gac8a4a71240857dc6b2ed70456b6923f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  97. <tr class="memitem:ga8fbf01e473ac421fc33ad9f8da8b8a25"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__http.html#ga8fbf01e473ac421fc33ad9f8da8b8a25">lws_http_redirect</a> (struct lws *wsi, int code, const unsigned char *loc, int len, unsigned char **p, unsigned char *end)</td></tr>
  98. <tr class="separator:ga8fbf01e473ac421fc33ad9f8da8b8a25"><td class="memSeparator" colspan="2">&#160;</td></tr>
  99. <tr class="memitem:gad27aed6c66a41b2b89ffe4da2a309e8a"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__http.html#gad27aed6c66a41b2b89ffe4da2a309e8a">lws_http_transaction_completed</a> (struct lws *wsi)</td></tr>
  100. <tr class="separator:gad27aed6c66a41b2b89ffe4da2a309e8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
  101. </table>
  102. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  103. <p>Modules related to handling HTTP </p>
  104. <h2 class="groupheader">Function Documentation</h2>
  105. <a class="anchor" id="ga8fbf01e473ac421fc33ad9f8da8b8a25"></a>
  106. <div class="memitem">
  107. <div class="memproto">
  108. <table class="memname">
  109. <tr>
  110. <td class="memname">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_redirect </td>
  111. <td>(</td>
  112. <td class="paramtype">struct lws *&#160;</td>
  113. <td class="paramname"><em>wsi</em>, </td>
  114. </tr>
  115. <tr>
  116. <td class="paramkey"></td>
  117. <td></td>
  118. <td class="paramtype">int&#160;</td>
  119. <td class="paramname"><em>code</em>, </td>
  120. </tr>
  121. <tr>
  122. <td class="paramkey"></td>
  123. <td></td>
  124. <td class="paramtype">const unsigned char *&#160;</td>
  125. <td class="paramname"><em>loc</em>, </td>
  126. </tr>
  127. <tr>
  128. <td class="paramkey"></td>
  129. <td></td>
  130. <td class="paramtype">int&#160;</td>
  131. <td class="paramname"><em>len</em>, </td>
  132. </tr>
  133. <tr>
  134. <td class="paramkey"></td>
  135. <td></td>
  136. <td class="paramtype">unsigned char **&#160;</td>
  137. <td class="paramname"><em>p</em>, </td>
  138. </tr>
  139. <tr>
  140. <td class="paramkey"></td>
  141. <td></td>
  142. <td class="paramtype">unsigned char *&#160;</td>
  143. <td class="paramname"><em>end</em>&#160;</td>
  144. </tr>
  145. <tr>
  146. <td></td>
  147. <td>)</td>
  148. <td></td><td></td>
  149. </tr>
  150. </table>
  151. </div><div class="memdoc">
  152. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  153. <p><a class="el" href="group__http.html#ga8fbf01e473ac421fc33ad9f8da8b8a25">lws_http_redirect()</a> - write http redirect into buffer</p>
  154. <dl class="params"><dt>Parameters</dt><dd>
  155. <table class="params">
  156. <tr><td class="paramname">wsi</td><td>websocket connection </td></tr>
  157. <tr><td class="paramname">code</td><td>HTTP response code (eg, 301) </td></tr>
  158. <tr><td class="paramname">loc</td><td>where to redirect to </td></tr>
  159. <tr><td class="paramname">len</td><td>length of loc </td></tr>
  160. <tr><td class="paramname">p</td><td>pointer current position in buffer (updated as we write) </td></tr>
  161. <tr><td class="paramname">end</td><td>pointer to end of buffer </td></tr>
  162. </table>
  163. </dd>
  164. </dl>
  165. </div>
  166. </div>
  167. <a class="anchor" id="gad27aed6c66a41b2b89ffe4da2a309e8a"></a>
  168. <div class="memitem">
  169. <div class="memproto">
  170. <table class="memname">
  171. <tr>
  172. <td class="memname">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_transaction_completed </td>
  173. <td>(</td>
  174. <td class="paramtype">struct lws *&#160;</td>
  175. <td class="paramname"><em>wsi</em></td><td>)</td>
  176. <td></td>
  177. </tr>
  178. </table>
  179. </div><div class="memdoc">
  180. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  181. <p><a class="el" href="group__http.html#gad27aed6c66a41b2b89ffe4da2a309e8a">lws_http_transaction_completed()</a> - wait for new http transaction or close </p><dl class="params"><dt>Parameters</dt><dd>
  182. <table class="params">
  183. <tr><td class="paramname">wsi</td><td>websocket connection <pre class="fragment"> Returns 1 if the HTTP connection must close now
  184. Returns 0 and resets connection to wait for new HTTP header /
  185. transaction if possible</pre> </td></tr>
  186. </table>
  187. </dd>
  188. </dl>
  189. </div>
  190. </div>
  191. <a class="anchor" id="gac8a4a71240857dc6b2ed70456b6923f4"></a>
  192. <div class="memitem">
  193. <div class="memproto">
  194. <table class="memname">
  195. <tr>
  196. <td class="memname">LWS_VISIBLE LWS_EXTERN int lws_return_http_status </td>
  197. <td>(</td>
  198. <td class="paramtype">struct lws *&#160;</td>
  199. <td class="paramname"><em>wsi</em>, </td>
  200. </tr>
  201. <tr>
  202. <td class="paramkey"></td>
  203. <td></td>
  204. <td class="paramtype">unsigned int&#160;</td>
  205. <td class="paramname"><em>code</em>, </td>
  206. </tr>
  207. <tr>
  208. <td class="paramkey"></td>
  209. <td></td>
  210. <td class="paramtype">const char *&#160;</td>
  211. <td class="paramname"><em>html_body</em>&#160;</td>
  212. </tr>
  213. <tr>
  214. <td></td>
  215. <td>)</td>
  216. <td></td><td></td>
  217. </tr>
  218. </table>
  219. </div><div class="memdoc">
  220. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  221. <p><a class="el" href="group__http.html#gac8a4a71240857dc6b2ed70456b6923f4">lws_return_http_status()</a> - Return simple http status </p><dl class="params"><dt>Parameters</dt><dd>
  222. <table class="params">
  223. <tr><td class="paramname">wsi</td><td>Websocket instance (available from user callback) </td></tr>
  224. <tr><td class="paramname">code</td><td>Status index, eg, 404 </td></tr>
  225. <tr><td class="paramname">html_body</td><td>User-readable HTML description &lt; 1KB, or NULL <pre class="fragment"> Helper to report HTTP errors back to the client cleanly and
  226. consistently</pre> </td></tr>
  227. </table>
  228. </dd>
  229. </dl>
  230. </div>
  231. </div>
  232. </div><!-- contents -->
  233. </div><!-- doc-content -->
  234. <!-- start footer part -->
  235. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  236. <ul>
  237. <li class="footer">Generated by
  238. <a href="http://www.doxygen.org/index.html">
  239. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  240. </ul>
  241. </div>
  242. </body>
  243. </html>