mirror of
https://github.com/cwyark/sdk-ameba-v4.0b_without_nda_gcc.git
synced 2024-12-26 16:15:23 +00:00
1537 lines
78 KiB
HTML
1537 lines
78 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.11"/>
|
|
<title>SDK4.0: HTTPD</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { init_search(); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">SDK4.0
|
|
</div>
|
|
<div id="projectbrief">This document shows Ameba SDK 4.0 APIs</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.11 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Data Structures</a> |
|
|
<a href="#define-members">Macros</a> |
|
|
<a href="#func-members">Functions</a> |
|
|
<a href="#var-members">Variables</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">HTTPD<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> » <a class="el" href="group__network.html">Network</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>HTTP/HTTPS server functions.
|
|
<a href="#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
|
Data Structures</h2></td></tr>
|
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structhttp__request.html">http_request</a></td></tr>
|
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">The structure is the context used for HTTP request header parsing. <a href="structhttp__request.html#details">More...</a><br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structhttpd__conn.html">httpd_conn</a></td></tr>
|
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">The structure is the context used for client connection. <a href="structhttpd__conn.html#details">More...</a><br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
|
|
Macros</h2></td></tr>
|
|
<tr class="memitem:gaac2c508a3dc44e69a204f330df6a2e4a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaac2c508a3dc44e69a204f330df6a2e4a">HTTPD_SECURE_NONE</a>   0</td></tr>
|
|
<tr class="separator:gaac2c508a3dc44e69a204f330df6a2e4a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gab563b2fbb1ec4151c727b4837b5e8809"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gab563b2fbb1ec4151c727b4837b5e8809">HTTPD_SECURE_TLS</a>   1</td></tr>
|
|
<tr class="separator:gab563b2fbb1ec4151c727b4837b5e8809"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaddc2172312b46ea82f3069e3196e5283"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaddc2172312b46ea82f3069e3196e5283">HTTPD_SECURE_TLS_VERIFY</a>   2</td></tr>
|
|
<tr class="separator:gaddc2172312b46ea82f3069e3196e5283"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaccdec55027a8a93e61d404fefe7e1fbe"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaccdec55027a8a93e61d404fefe7e1fbe">HTTPD_THREAD_SINGLE</a>   0</td></tr>
|
|
<tr class="separator:gaccdec55027a8a93e61d404fefe7e1fbe"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gab4c1858eddeabd52f0c061e4cd39e759"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gab4c1858eddeabd52f0c061e4cd39e759">HTTPD_THREAD_MULTIPLE</a>   1</td></tr>
|
|
<tr class="separator:gab4c1858eddeabd52f0c061e4cd39e759"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae0331f7074d34acc1eee666a8735b7a5"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gae0331f7074d34acc1eee666a8735b7a5">HTTPD_DEBUG_OFF</a>   0</td></tr>
|
|
<tr class="separator:gae0331f7074d34acc1eee666a8735b7a5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gad70451306fd45bed81dde3d4ca2c3faf"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gad70451306fd45bed81dde3d4ca2c3faf">HTTPD_DEBUG_ON</a>   1</td></tr>
|
|
<tr class="separator:gad70451306fd45bed81dde3d4ca2c3faf"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gac59f6da9d0f1a5b180983cceebc8245a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gac59f6da9d0f1a5b180983cceebc8245a">HTTPD_DEBUG_VERBOSE</a>   2</td></tr>
|
|
<tr class="separator:gac59f6da9d0f1a5b180983cceebc8245a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga3aa0406119b3d415aaee4300fbc6563e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga3aa0406119b3d415aaee4300fbc6563e">HTTPD_TLS_POLARSSL</a>   0</td></tr>
|
|
<tr class="separator:ga3aa0406119b3d415aaee4300fbc6563e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga2f5ceee4fd0f1339d0d67d02dd52af25"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga2f5ceee4fd0f1339d0d67d02dd52af25">HTTPD_TLS_MBEDTLS</a>   1</td></tr>
|
|
<tr class="separator:ga2f5ceee4fd0f1339d0d67d02dd52af25"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga085c5f3a7227aae5a50403c190fb296d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga085c5f3a7227aae5a50403c190fb296d">httpd_start</a> (uint16_t port, uint8_t max_conn, uint32_t stack_bytes, uint8_t thread_mode, uint8_t secure)</td></tr>
|
|
<tr class="memdesc:ga085c5f3a7227aae5a50403c190fb296d"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to start an HTTP or HTTPS server. <a href="#ga085c5f3a7227aae5a50403c190fb296d">More...</a><br /></td></tr>
|
|
<tr class="separator:ga085c5f3a7227aae5a50403c190fb296d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga15a5ac9d142870a6675ee36f406b705c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga15a5ac9d142870a6675ee36f406b705c">httpd_stop</a> (void)</td></tr>
|
|
<tr class="memdesc:ga15a5ac9d142870a6675ee36f406b705c"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to stop a running server. <a href="#ga15a5ac9d142870a6675ee36f406b705c">More...</a><br /></td></tr>
|
|
<tr class="separator:ga15a5ac9d142870a6675ee36f406b705c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga24ffd68ef2010c13a3b6ad570cbbbcf0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga24ffd68ef2010c13a3b6ad570cbbbcf0">httpd_reg_page_callback</a> (char *path, void(*callback)(struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn))</td></tr>
|
|
<tr class="memdesc:ga24ffd68ef2010c13a3b6ad570cbbbcf0"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to register a callback function for a Web page request handling. <a href="#ga24ffd68ef2010c13a3b6ad570cbbbcf0">More...</a><br /></td></tr>
|
|
<tr class="separator:ga24ffd68ef2010c13a3b6ad570cbbbcf0"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga58a31d5bc908cba8457f4c7918a8ac62"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga58a31d5bc908cba8457f4c7918a8ac62">httpd_clear_page_callbacks</a> (void)</td></tr>
|
|
<tr class="memdesc:ga58a31d5bc908cba8457f4c7918a8ac62"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to clear all registered page callback functions. <a href="#ga58a31d5bc908cba8457f4c7918a8ac62">More...</a><br /></td></tr>
|
|
<tr class="separator:ga58a31d5bc908cba8457f4c7918a8ac62"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga0ca663ed9723846f0d97faf624b65d81"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga0ca663ed9723846f0d97faf624b65d81">httpd_setup_debug</a> (uint8_t debug)</td></tr>
|
|
<tr class="memdesc:ga0ca663ed9723846f0d97faf624b65d81"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to setup httpd debug. <a href="#ga0ca663ed9723846f0d97faf624b65d81">More...</a><br /></td></tr>
|
|
<tr class="separator:ga0ca663ed9723846f0d97faf624b65d81"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga82ea68c857a76a0725c5a789b4e9e316"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga82ea68c857a76a0725c5a789b4e9e316">httpd_setup_cert</a> (const char *server_cert, const char *server_key, const char *ca_certs)</td></tr>
|
|
<tr class="memdesc:ga82ea68c857a76a0725c5a789b4e9e316"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to setup certificate and key for server before starting with HTTPS. <a href="#ga82ea68c857a76a0725c5a789b4e9e316">More...</a><br /></td></tr>
|
|
<tr class="separator:ga82ea68c857a76a0725c5a789b4e9e316"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaa908456ef2b22e67f73604970561d01f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaa908456ef2b22e67f73604970561d01f">httpd_setup_user_password</a> (char *user, char *password)</td></tr>
|
|
<tr class="memdesc:gaa908456ef2b22e67f73604970561d01f"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to setup authorization for server. <a href="#gaa908456ef2b22e67f73604970561d01f">More...</a><br /></td></tr>
|
|
<tr class="separator:gaa908456ef2b22e67f73604970561d01f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga1ea34d10cf66218c839a7b96439eade3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga1ea34d10cf66218c839a7b96439eade3">httpd_free</a> (void *ptr)</td></tr>
|
|
<tr class="memdesc:ga1ea34d10cf66218c839a7b96439eade3"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to free memory allocated by httpd API, such as <a class="el" href="group__httpd.html#ga3400d81efd9476a1bd8d21c1cd2860ee" title="This function is used to get a header field from HTTP header of connection context. ">httpd_request_get_header_field()</a> and <a class="el" href="group__httpd.html#gaf19f6408b7260d7edbc672a726c4149c" title="This function is used to get a key value from query string in HTTP header of connection context...">httpd_request_get_query_key()</a>. <a href="#ga1ea34d10cf66218c839a7b96439eade3">More...</a><br /></td></tr>
|
|
<tr class="separator:ga1ea34d10cf66218c839a7b96439eade3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae0d2c9272325462ca98f4a4bc60d6a81"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gae0d2c9272325462ca98f4a4bc60d6a81">httpd_conn_close</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn)</td></tr>
|
|
<tr class="memdesc:gae0d2c9272325462ca98f4a4bc60d6a81"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to close a client connection and release context resource. <a href="#gae0d2c9272325462ca98f4a4bc60d6a81">More...</a><br /></td></tr>
|
|
<tr class="separator:gae0d2c9272325462ca98f4a4bc60d6a81"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga139ad7c144b97e75971c33b4ec173d4b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga139ad7c144b97e75971c33b4ec173d4b">httpd_conn_dump_header</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn)</td></tr>
|
|
<tr class="memdesc:ga139ad7c144b97e75971c33b4ec173d4b"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to dump the parsed HTTP header of request in connection context. <a href="#ga139ad7c144b97e75971c33b4ec173d4b">More...</a><br /></td></tr>
|
|
<tr class="separator:ga139ad7c144b97e75971c33b4ec173d4b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga335c776ebd6d211b856345cb8c3c906a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga335c776ebd6d211b856345cb8c3c906a">httpd_request_is_method</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *method)</td></tr>
|
|
<tr class="memdesc:ga335c776ebd6d211b856345cb8c3c906a"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to check HTTP method of request in connection context. <a href="#ga335c776ebd6d211b856345cb8c3c906a">More...</a><br /></td></tr>
|
|
<tr class="separator:ga335c776ebd6d211b856345cb8c3c906a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gacd38791ae4d6d4735b6f0f0710372788"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gacd38791ae4d6d4735b6f0f0710372788">httpd_request_read_header</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn)</td></tr>
|
|
<tr class="memdesc:gacd38791ae4d6d4735b6f0f0710372788"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to read HTTP header from client socket descriptor and parse content to connection context. <a href="#gacd38791ae4d6d4735b6f0f0710372788">More...</a><br /></td></tr>
|
|
<tr class="separator:gacd38791ae4d6d4735b6f0f0710372788"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga7f4339dcd1edd7292a9adb903f185423"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga7f4339dcd1edd7292a9adb903f185423">httpd_request_read_data</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, uint8_t *data, size_t data_len)</td></tr>
|
|
<tr class="memdesc:ga7f4339dcd1edd7292a9adb903f185423"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to read data from HTTP/HTTPS connection. <a href="#ga7f4339dcd1edd7292a9adb903f185423">More...</a><br /></td></tr>
|
|
<tr class="separator:ga7f4339dcd1edd7292a9adb903f185423"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga3400d81efd9476a1bd8d21c1cd2860ee"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga3400d81efd9476a1bd8d21c1cd2860ee">httpd_request_get_header_field</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *field, char **value)</td></tr>
|
|
<tr class="memdesc:ga3400d81efd9476a1bd8d21c1cd2860ee"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to get a header field from HTTP header of connection context. <a href="#ga3400d81efd9476a1bd8d21c1cd2860ee">More...</a><br /></td></tr>
|
|
<tr class="separator:ga3400d81efd9476a1bd8d21c1cd2860ee"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaf19f6408b7260d7edbc672a726c4149c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaf19f6408b7260d7edbc672a726c4149c">httpd_request_get_query_key</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *key, char **value)</td></tr>
|
|
<tr class="memdesc:gaf19f6408b7260d7edbc672a726c4149c"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to get a key value from query string in HTTP header of connection context. <a href="#gaf19f6408b7260d7edbc672a726c4149c">More...</a><br /></td></tr>
|
|
<tr class="separator:gaf19f6408b7260d7edbc672a726c4149c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaca05e8fa7def9a54a3f239c7a639d428"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaca05e8fa7def9a54a3f239c7a639d428">httpd_response_write_header_start</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *status, char *content_type, size_t content_len)</td></tr>
|
|
<tr class="memdesc:gaca05e8fa7def9a54a3f239c7a639d428"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to start a HTTP response in connection. <a href="#gaca05e8fa7def9a54a3f239c7a639d428">More...</a><br /></td></tr>
|
|
<tr class="separator:gaca05e8fa7def9a54a3f239c7a639d428"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga8e08c7e8618b7bda27621094f1c63e75"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga8e08c7e8618b7bda27621094f1c63e75">httpd_response_write_header</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *name, char *value)</td></tr>
|
|
<tr class="memdesc:ga8e08c7e8618b7bda27621094f1c63e75"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to add an HTTP header field to HTTP response. <a href="#ga8e08c7e8618b7bda27621094f1c63e75">More...</a><br /></td></tr>
|
|
<tr class="separator:ga8e08c7e8618b7bda27621094f1c63e75"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gabfc54de543b1369eeb3572d842cf744f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gabfc54de543b1369eeb3572d842cf744f">httpd_response_write_header_finish</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn)</td></tr>
|
|
<tr class="memdesc:gabfc54de543b1369eeb3572d842cf744f"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write HTTP response header data to connection. <a href="#gabfc54de543b1369eeb3572d842cf744f">More...</a><br /></td></tr>
|
|
<tr class="separator:gabfc54de543b1369eeb3572d842cf744f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga91867923509e525e10089b981d631411"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga91867923509e525e10089b981d631411">httpd_response_write_data</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, uint8_t *data, size_t data_len)</td></tr>
|
|
<tr class="memdesc:ga91867923509e525e10089b981d631411"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write HTTP response body data to connection. <a href="#ga91867923509e525e10089b981d631411">More...</a><br /></td></tr>
|
|
<tr class="separator:ga91867923509e525e10089b981d631411"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gacc31716c49136c83b5f8fe6a5ca23ea1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gacc31716c49136c83b5f8fe6a5ca23ea1">httpd_response_bad_request</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:gacc31716c49136c83b5f8fe6a5ca23ea1"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 400 Bad Request. <a href="#gacc31716c49136c83b5f8fe6a5ca23ea1">More...</a><br /></td></tr>
|
|
<tr class="separator:gacc31716c49136c83b5f8fe6a5ca23ea1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaf00a7244e66530937ccf836342fd898f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaf00a7244e66530937ccf836342fd898f">httpd_response_unauthorized</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:gaf00a7244e66530937ccf836342fd898f"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 401 Unauthorized. <a href="#gaf00a7244e66530937ccf836342fd898f">More...</a><br /></td></tr>
|
|
<tr class="separator:gaf00a7244e66530937ccf836342fd898f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga8c07a9b80fc4db1ef9a2abbbb4c78438"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga8c07a9b80fc4db1ef9a2abbbb4c78438">httpd_response_not_found</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:ga8c07a9b80fc4db1ef9a2abbbb4c78438"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 404 Not Found. <a href="#ga8c07a9b80fc4db1ef9a2abbbb4c78438">More...</a><br /></td></tr>
|
|
<tr class="separator:ga8c07a9b80fc4db1ef9a2abbbb4c78438"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gacf78de8ebd80ebf5cb7bc24635500824"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gacf78de8ebd80ebf5cb7bc24635500824">httpd_response_method_not_allowed</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:gacf78de8ebd80ebf5cb7bc24635500824"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 405 Method Not Allowed. <a href="#gacf78de8ebd80ebf5cb7bc24635500824">More...</a><br /></td></tr>
|
|
<tr class="separator:gacf78de8ebd80ebf5cb7bc24635500824"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga385a71379329d1709292cb1f136f84be"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga385a71379329d1709292cb1f136f84be">httpd_response_too_many_requests</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:ga385a71379329d1709292cb1f136f84be"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 429 Too Many Requests. <a href="#ga385a71379329d1709292cb1f136f84be">More...</a><br /></td></tr>
|
|
<tr class="separator:ga385a71379329d1709292cb1f136f84be"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga2fcbd28b0ca4613a844357f97694092c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga2fcbd28b0ca4613a844357f97694092c">httpd_response_internal_server_error</a> (struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn, char *msg)</td></tr>
|
|
<tr class="memdesc:ga2fcbd28b0ca4613a844357f97694092c"><td class="mdescLeft"> </td><td class="mdescRight">This function is used to write a default HTTP response for error of 500 Internal Server Error. <a href="#ga2fcbd28b0ca4613a844357f97694092c">More...</a><br /></td></tr>
|
|
<tr class="separator:ga2fcbd28b0ca4613a844357f97694092c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
|
|
Variables</h2></td></tr>
|
|
<tr class="memitem:gae03d1b90c2727670f2b8c66acea94084"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gae03d1b90c2727670f2b8c66acea94084">header</a></td></tr>
|
|
<tr class="separator:gae03d1b90c2727670f2b8c66acea94084"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gad60e9f446c76025dc95318ee2631d56c"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gad60e9f446c76025dc95318ee2631d56c">header_len</a></td></tr>
|
|
<tr class="separator:gad60e9f446c76025dc95318ee2631d56c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga4e46cd2c0d78f582c1285f843a277e47"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga4e46cd2c0d78f582c1285f843a277e47">method</a></td></tr>
|
|
<tr class="separator:ga4e46cd2c0d78f582c1285f843a277e47"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga61e727947447cf845ed684dccfea375d"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga61e727947447cf845ed684dccfea375d">method_len</a></td></tr>
|
|
<tr class="separator:ga61e727947447cf845ed684dccfea375d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaa1c8c3be5413cba4cd0418512b25bdd1"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaa1c8c3be5413cba4cd0418512b25bdd1">path</a></td></tr>
|
|
<tr class="separator:gaa1c8c3be5413cba4cd0418512b25bdd1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga3879669bcad2218290d3bad25387118c"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga3879669bcad2218290d3bad25387118c">path_len</a></td></tr>
|
|
<tr class="separator:ga3879669bcad2218290d3bad25387118c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gafeb7a6bf15fe0f441739bc02d5716622"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gafeb7a6bf15fe0f441739bc02d5716622">query</a></td></tr>
|
|
<tr class="separator:gafeb7a6bf15fe0f441739bc02d5716622"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga0872855f82eafc3f135c6aee3cf75b8e"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga0872855f82eafc3f135c6aee3cf75b8e">query_len</a></td></tr>
|
|
<tr class="separator:ga0872855f82eafc3f135c6aee3cf75b8e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaa8b9d638c9f39cd46d6f67237f8615ae"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gaa8b9d638c9f39cd46d6f67237f8615ae">version</a></td></tr>
|
|
<tr class="separator:gaa8b9d638c9f39cd46d6f67237f8615ae"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga4a192c1f443088208aa8c39b3b7d8cbd"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga4a192c1f443088208aa8c39b3b7d8cbd">version_len</a></td></tr>
|
|
<tr class="separator:ga4a192c1f443088208aa8c39b3b7d8cbd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga5bedcec9394358a012798ab7842b96e6"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga5bedcec9394358a012798ab7842b96e6">host</a></td></tr>
|
|
<tr class="separator:ga5bedcec9394358a012798ab7842b96e6"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gab2d48230da2c343effde0fb4d263e1a7"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gab2d48230da2c343effde0fb4d263e1a7">host_len</a></td></tr>
|
|
<tr class="separator:gab2d48230da2c343effde0fb4d263e1a7"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae4ec598c4010f361bfd6b22cd127cca1"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#gae4ec598c4010f361bfd6b22cd127cca1">content_type</a></td></tr>
|
|
<tr class="separator:gae4ec598c4010f361bfd6b22cd127cca1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga034b8afd7f1a03442248a6175ae7ffec"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga034b8afd7f1a03442248a6175ae7ffec">content_type_len</a></td></tr>
|
|
<tr class="separator:ga034b8afd7f1a03442248a6175ae7ffec"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga53a9724e885c3ef860d1d41018071c9f"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga53a9724e885c3ef860d1d41018071c9f">content_len</a></td></tr>
|
|
<tr class="separator:ga53a9724e885c3ef860d1d41018071c9f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga5903d0b282fc5eae503de618f896b5e1"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga5903d0b282fc5eae503de618f896b5e1">sock</a></td></tr>
|
|
<tr class="separator:ga5903d0b282fc5eae503de618f896b5e1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga6b04e98412beccad0e8a2c2c0657acc8"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structhttp__request.html">http_request</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga6b04e98412beccad0e8a2c2c0657acc8">request</a></td></tr>
|
|
<tr class="separator:ga6b04e98412beccad0e8a2c2c0657acc8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga5419e62641a60710811bfb71146c42f1"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga5419e62641a60710811bfb71146c42f1">tls</a></td></tr>
|
|
<tr class="separator:ga5419e62641a60710811bfb71146c42f1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga71aed106dbe8feb65829ea6e62d6b276"><td class="memItemLeft" align="right" valign="top">uint8_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpd.html#ga71aed106dbe8feb65829ea6e62d6b276">response_header</a></td></tr>
|
|
<tr class="separator:ga71aed106dbe8feb65829ea6e62d6b276"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>HTTP/HTTPS server functions. </p>
|
|
<h2 class="groupheader">Macro Definition Documentation</h2>
|
|
<a class="anchor" id="gae0331f7074d34acc1eee666a8735b7a5"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_DEBUG_OFF   0</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Disable httpd debug log </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gad70451306fd45bed81dde3d4ca2c3faf"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_DEBUG_ON   1</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Enable httpd debug log </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gac59f6da9d0f1a5b180983cceebc8245a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_DEBUG_VERBOSE   2</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Enable httpd verbose debug log </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaac2c508a3dc44e69a204f330df6a2e4a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_SECURE_NONE   0</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Running with HTTP server </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gab563b2fbb1ec4151c727b4837b5e8809"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_SECURE_TLS   1</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Running with HTTPS server </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaddc2172312b46ea82f3069e3196e5283"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_SECURE_TLS_VERIFY   2</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Running with HTTPS server and verify client </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gab4c1858eddeabd52f0c061e4cd39e759"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_THREAD_MULTIPLE   1</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Single-thread mode for request handling </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaccdec55027a8a93e61d404fefe7e1fbe"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_THREAD_SINGLE   0</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Multi-thread mode for request handling </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga2f5ceee4fd0f1339d0d67d02dd52af25"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_TLS_MBEDTLS   1</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Use mbedTLS for TLS when HTTPS </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga3aa0406119b3d415aaee4300fbc6563e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">#define HTTPD_TLS_POLARSSL   0</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Use PolarSSL for TLS when HTTPS </p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="ga58a31d5bc908cba8457f4c7918a8ac62"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_clear_page_callbacks </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to clear all registered page callback functions. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>All page callback will be cleared automatically if <a class="el" href="group__httpd.html#ga15a5ac9d142870a6675ee36f406b705c" title="This function is used to stop a running server. ">httpd_stop()</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae0d2c9272325462ca98f4a4bc60d6a81"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_conn_close </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to close a client connection and release context resource. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>Multiple requests/response can be handled in a connection before connection closed. All connections will be closed automatically if <a class="el" href="group__httpd.html#ga15a5ac9d142870a6675ee36f406b705c" title="This function is used to stop a running server. ">httpd_stop()</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga139ad7c144b97e75971c33b4ec173d4b"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_conn_dump_header </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to dump the parsed HTTP header of request in connection context. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga1ea34d10cf66218c839a7b96439eade3"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_free </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void * </td>
|
|
<td class="paramname"><em>ptr</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to free memory allocated by httpd API, such as <a class="el" href="group__httpd.html#ga3400d81efd9476a1bd8d21c1cd2860ee" title="This function is used to get a header field from HTTP header of connection context. ">httpd_request_get_header_field()</a> and <a class="el" href="group__httpd.html#gaf19f6408b7260d7edbc672a726c4149c" title="This function is used to get a key value from query string in HTTP header of connection context...">httpd_request_get_query_key()</a>. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">ptr</td><td>pointer to memory to be deallocated </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga24ffd68ef2010c13a3b6ad570cbbbcf0"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_reg_page_callback </td>
|
|
<td>(</td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>path</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">void(*)(struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> *conn) </td>
|
|
<td class="paramname"><em>callback</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to register a callback function for a Web page request handling. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">path</td><td>resource path for a page </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>callback function to handle the request to page </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga3400d81efd9476a1bd8d21c1cd2860ee"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_request_get_header_field </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>field</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char ** </td>
|
|
<td class="paramname"><em>value</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to get a header field from HTTP header of connection context. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">field</td><td>header field string to search </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>search result stored in memory allocated </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if found </dd>
|
|
<dd>
|
|
-1 : if not found </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>The search result memory should be free by <a class="el" href="group__httpd.html#ga1ea34d10cf66218c839a7b96439eade3" title="This function is used to free memory allocated by httpd API, such as httpd_request_get_header_field()...">httpd_free()</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaf19f6408b7260d7edbc672a726c4149c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_request_get_query_key </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>key</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char ** </td>
|
|
<td class="paramname"><em>value</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to get a key value from query string in HTTP header of connection context. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>key name string to search </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>search result stored in memory allocated </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if found </dd>
|
|
<dd>
|
|
-1 : if not found </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>The search result memory should be free by <a class="el" href="group__httpd.html#ga1ea34d10cf66218c839a7b96439eade3" title="This function is used to free memory allocated by httpd API, such as httpd_request_get_header_field()...">httpd_free()</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga335c776ebd6d211b856345cb8c3c906a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_request_is_method </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>method</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to check HTTP method of request in connection context. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">method</td><td>HTTP method string to compare with </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if different </dd>
|
|
<dd>
|
|
1 : if matched </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga7f4339dcd1edd7292a9adb903f185423"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_request_read_data </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>data_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to read data from HTTP/HTTPS connection. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>buffer for data read </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">data_len</td><td>buffer length </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket read() for HTTP and PolarSSL ssl_read() for HTTPS </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gacd38791ae4d6d4735b6f0f0710372788"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_request_read_header </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to read HTTP header from client socket descriptor and parse content to connection context. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__httpd.html#gacd38791ae4d6d4735b6f0f0710372788" title="This function is used to read HTTP header from client socket descriptor and parse content to connecti...">httpd_request_read_header()</a> is automatically invoked by httpd server to parse request before executing page callback </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gacc31716c49136c83b5f8fe6a5ca23ea1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_bad_request </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 400 Bad Request. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga2fcbd28b0ca4613a844357f97694092c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_internal_server_error </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 500 Internal Server Error. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gacf78de8ebd80ebf5cb7bc24635500824"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_method_not_allowed </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 405 Method Not Allowed. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga8c07a9b80fc4db1ef9a2abbbb4c78438"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_not_found </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 404 Not Found. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga385a71379329d1709292cb1f136f84be"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_too_many_requests </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 429 Too Many Requests. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaf00a7244e66530937ccf836342fd898f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_response_unauthorized </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>msg</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write a default HTTP response for error of 401 Unauthorized. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>message write to HTTP response body. A default message will be used if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga91867923509e525e10089b981d631411"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_response_write_data </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>data_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write HTTP response body data to connection. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>data to be written </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">data_len</td><td>data length </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket write() for HTTP and PolarSSL ssl_write() for HTTPS </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga8e08c7e8618b7bda27621094f1c63e75"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_response_write_header </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>name</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>value</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to add an HTTP header field to HTTP response. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>HTTP header field name string </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>HTTP header field value </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gabfc54de543b1369eeb3572d842cf744f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_response_write_header_finish </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to write HTTP response header data to connection. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>return value of lwip socket write() for HTTP and PolarSSL ssl_write() for HTTPS </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaca05e8fa7def9a54a3f239c7a639d428"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_response_write_header_start </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structhttpd__conn.html">httpd_conn</a> * </td>
|
|
<td class="paramname"><em>conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>status</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>content_type</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>content_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to start a HTTP response in connection. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">conn</td><td>pointer to connection context </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">status</td><td>string of status code in HTTP response </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">content_type</td><td>string of Content-Type header field written to HTTP response. No Content-Type in HTTP response if NULL. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">content_len</td><td>value of Content-Length header field written to HTTP response. No Content-Length in HTTP response if NULL. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga82ea68c857a76a0725c5a789b4e9e316"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_setup_cert </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>server_cert</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>server_key</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>ca_certs</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to setup certificate and key for server before starting with HTTPS. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">server_cert</td><td>string of server certificate </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">server_key</td><td>string of server private key </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">ca_certs</td><td>string including certificates in CA trusted chain </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>Must be used before <a class="el" href="group__httpd.html#ga085c5f3a7227aae5a50403c190fb296d" title="This function is used to start an HTTP or HTTPS server. ">httpd_start()</a> if staring HTTPS server </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga0ca663ed9723846f0d97faf624b65d81"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_setup_debug </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>debug</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to setup httpd debug. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">debug</td><td>flag to enable/disable httpd debug. Must be HTTPD_DEBUG_OFF, HTTPD_DEBUG_ON, HTTPD_DEBUG_VERBOSE. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaa908456ef2b22e67f73604970561d01f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_setup_user_password </td>
|
|
<td>(</td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>user</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>password</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to setup authorization for server. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">user</td><td>string of user name for authorization </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">password</td><td>string of password for authorization </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
<dl class="section note"><dt>Note</dt><dd>Must be used before <a class="el" href="group__httpd.html#ga085c5f3a7227aae5a50403c190fb296d" title="This function is used to start an HTTP or HTTPS server. ">httpd_start()</a> if basic authorization is used </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga085c5f3a7227aae5a50403c190fb296d"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int httpd_start </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint16_t </td>
|
|
<td class="paramname"><em>port</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>max_conn</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>stack_bytes</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>thread_mode</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>secure</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to start an HTTP or HTTPS server. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>service port </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">max_conn</td><td>max client connections allowed </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">stack_bytes</td><td>thread stack size in bytes </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">thread_mode</td><td>server running thread mode. Must be HTTPD_THREAD_SINGLE, HTTPD_THREAD_MULTIPLE. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">secure</td><td>security mode for HTTP or HTTPS. Must be HTTPD_SECURE_NONE, HTTPD_SECURE_TLS, HTTPD_SECURE_TLS_VERIFY. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 : if successful </dd>
|
|
<dd>
|
|
-1 : if error occurred </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga15a5ac9d142870a6675ee36f406b705c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void httpd_stop </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>This function is used to stop a running server. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>None </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Variable Documentation</h2>
|
|
<a class="anchor" id="ga53a9724e885c3ef860d1d41018071c9f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t content_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Value of Content-Length header field parsed in HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae4ec598c4010f361bfd6b22cd127cca1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* content_type</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to Content-Type header field in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga034b8afd7f1a03442248a6175ae7ffec"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t content_type_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Content-Type header field data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae03d1b90c2727670f2b8c66acea94084"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* header</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>HTTP header string parsed in HTTP request </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gad60e9f446c76025dc95318ee2631d56c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t header_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>HTTP header string length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga5bedcec9394358a012798ab7842b96e6"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* host</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to Host header field in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gab2d48230da2c343effde0fb4d263e1a7"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t host_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Host header field data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga4e46cd2c0d78f582c1285f843a277e47"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* method</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to HTTP method in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga61e727947447cf845ed684dccfea375d"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t method_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>HTTP method data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaa1c8c3be5413cba4cd0418512b25bdd1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* path</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to resource path in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga3879669bcad2218290d3bad25387118c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t path_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Resource path data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gafeb7a6bf15fe0f441739bc02d5716622"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* query</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to query string in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga0872855f82eafc3f135c6aee3cf75b8e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t query_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Query string data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga6b04e98412beccad0e8a2c2c0657acc8"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct <a class="el" href="structhttp__request.html">http_request</a> request</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Context for HTTP request </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga71aed106dbe8feb65829ea6e62d6b276"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* response_header</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to transmission buffer of HTTP response header </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga5903d0b282fc5eae503de618f896b5e1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int sock</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Client socket descriptor for connection </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga5419e62641a60710811bfb71146c42f1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void* tls</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Context for TLS connection </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaa8b9d638c9f39cd46d6f67237f8615ae"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t* version</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Pointer to HTTP version in the parsed HTTP header string </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga4a192c1f443088208aa8c39b3b7d8cbd"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t version_len</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>HTTP version data length </p>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.11
|
|
</small></address>
|
|
</body>
|
|
</html>
|