⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classpion_1_1_h_t_t_p_response.html

📁 用c++编写http server的源码库,对socket等网络处理的代码可迅速转为己用.
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>libpion: pion::HTTPResponse Class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.2 --><div class="tabs">  <ul>    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>    <li><a href="namespaces.html"><span>Namespaces</span></a></li>    <li class="current"><a href="annotated.html"><span>Classes</span></a></li>    <li><a href="files.html"><span>Files</span></a></li>  </ul></div><div class="tabs">  <ul>    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>  </ul></div><div class="nav"><a class="el" href="namespacepion.html">pion</a>::<a class="el" href="classpion_1_1_h_t_t_p_response.html">HTTPResponse</a></div><h1>pion::HTTPResponse Class Reference</h1><!-- doxytag: class="pion::HTTPResponse" --><code>#include &lt;<a class="el" href="_h_t_t_p_response_8hpp-source.html">HTTPResponse.hpp</a>&gt;</code><p><a href="classpion_1_1_h_t_t_p_response-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2><a class="el" href="classpion_1_1_h_t_t_p_response.html">HTTPResponse</a>: container for HTTP response information <p><p>Definition at line <a class="el" href="_h_t_t_p_response_8hpp-source.html#l00032">32</a> of file <a class="el" href="_h_t_t_p_response_8hpp-source.html">HTTPResponse.hpp</a>.<table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="99b714d17753868a80474d3472522f61"></a><!-- doxytag: member="pion::HTTPResponse::~HTTPResponse" ref="99b714d17753868a80474d3472522f61" args="()" -->virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#99b714d17753868a80474d3472522f61">~HTTPResponse</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">default destructor <br></td></tr><tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename T&gt; </td></tr><tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#e8939b9db481fc1f14c359965c933a23">write</a> (const T &amp;data)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#dd72716c96b9ff539675e545552d6a9b">write</a> (const void *data, size_t length)</td></tr><tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename T&gt; </td></tr><tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#1738cab55e8fd24a3a145f1f07d8f13a">writeNoCopy</a> (const T &amp;data)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#990278957e0b9201cbce0f2e1ea8865c">writeNoCopy</a> (const std::string &amp;data)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#f21b12e9708e6762c7b22d2ea48216d9">writeNoCopy</a> (void *data, size_t length)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="10a7ef4e77a4e7903a50657f78142777"></a><!-- doxytag: member="pion::HTTPResponse::addHeader" ref="10a7ef4e77a4e7903a50657f78142777" args="(const std::string &amp;key, const std::string &amp;value)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#10a7ef4e77a4e7903a50657f78142777">addHeader</a> (const std::string &amp;key, const std::string &amp;value)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">adds an HTTP response header <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#01e450de281fb46e722431c5033cdffd">setCookie</a> (const std::string &amp;name, const std::string &amp;value)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#ebf871a686e33012dc9b465c110b23b8">setCookie</a> (const std::string &amp;name, const std::string &amp;value, const std::string &amp;path)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#9d5d2abe9d8a07ed77671825693a446e">setCookie</a> (const std::string &amp;name, const std::string &amp;value, const std::string &amp;path, const unsigned long max_age)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#4a4e5eb443e03d4bb2cbb9d69232ea5d">setCookie</a> (const std::string &amp;name, const std::string &amp;value, const unsigned long max_age)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="92a113a21a6b8dae87653c4d971c279e"></a><!-- doxytag: member="pion::HTTPResponse::deleteCookie" ref="92a113a21a6b8dae87653c4d971c279e" args="(const std::string &amp;name)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#92a113a21a6b8dae87653c4d971c279e">deleteCookie</a> (const std::string &amp;name)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">deletes cookie called name by adding a Set-Cookie header (cookie has no path) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c2038ae5462f5159f1e28a3696890aa9"></a><!-- doxytag: member="pion::HTTPResponse::deleteCookie" ref="c2038ae5462f5159f1e28a3696890aa9" args="(const std::string &amp;name, const std::string &amp;path)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#c2038ae5462f5159f1e28a3696890aa9">deleteCookie</a> (const std::string &amp;name, const std::string &amp;path)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">deletes cookie called name by adding a Set-Cookie header (cookie has a path) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0fccb1e11ae8811c4ec4e81eb4e3f57f"></a><!-- doxytag: member="pion::HTTPResponse::setResponseCode" ref="0fccb1e11ae8811c4ec4e81eb4e3f57f" args="(const unsigned int n)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#0fccb1e11ae8811c4ec4e81eb4e3f57f">setResponseCode</a> (const unsigned int n)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the response or status code to send <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1604834dc004a4a11a6c667ccbedabcf"></a><!-- doxytag: member="pion::HTTPResponse::setLastModified" ref="1604834dc004a4a11a6c667ccbedabcf" args="(const unsigned long t)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#1604834dc004a4a11a6c667ccbedabcf">setLastModified</a> (const unsigned long t)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the time that the response was last modified (Last-Modified) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="edbab12b67358304a494bb50bd048d23"></a><!-- doxytag: member="pion::HTTPResponse::setResponseMessage" ref="edbab12b67358304a494bb50bd048d23" args="(const std::string &amp;m)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#edbab12b67358304a494bb50bd048d23">setResponseMessage</a> (const std::string &amp;m)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the response or status message to send <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b706516101fb22bd547517d6cfd3b790"></a><!-- doxytag: member="pion::HTTPResponse::setContentType" ref="b706516101fb22bd547517d6cfd3b790" args="(const std::string &amp;t)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#b706516101fb22bd547517d6cfd3b790">setContentType</a> (const std::string &amp;t)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the type of response content to be sent (Content-Type) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="036efba6a21aa579e60778f91046a56b"></a><!-- doxytag: member="pion::HTTPResponse::setLogger" ref="036efba6a21aa579e60778f91046a56b" args="(PionLogger log_ptr)" -->void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#036efba6a21aa579e60778f91046a56b">setLogger</a> (<a class="el" href="namespacepion.html#917bc483e4f692504156efb93c11b322">PionLogger</a> log_ptr)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the logger to be used <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="40dec2e9ff7a8829babfcd1051a811e6"></a><!-- doxytag: member="pion::HTTPResponse::getLogger" ref="40dec2e9ff7a8829babfcd1051a811e6" args="(void)" --><a class="el" href="namespacepion.html#917bc483e4f692504156efb93c11b322">PionLogger</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#40dec2e9ff7a8829babfcd1051a811e6">getLogger</a> (void)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns the logger currently in use <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#ca27596209b962252fc2afc998de6978">send</a> (<a class="el" href="namespacepion.html#1858b89656b28c6498ad9efd6b7e9d41">TCPConnectionPtr</a> &amp;tcp_conn)</td></tr><tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bebd43da5cc60c5ee4245066c58fe244"></a><!-- doxytag: member="pion::HTTPResponse::create" ref="bebd43da5cc60c5ee4245066c58fe244" args="(void)" -->static boost::shared_ptr&lt;<br> <a class="el" href="classpion_1_1_h_t_t_p_response.html">HTTPResponse</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#bebd43da5cc60c5ee4245066c58fe244">create</a> (void)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">creates new <a class="el" href="classpion_1_1_h_t_t_p_response.html">HTTPResponse</a> objects <br></td></tr><tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6cb282b8f63af8996331cf5a8a534c49"></a><!-- doxytag: member="pion::HTTPResponse::HTTPResponse" ref="6cb282b8f63af8996331cf5a8a534c49" args="(void)" -->&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#6cb282b8f63af8996331cf5a8a534c49">HTTPResponse</a> (void)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">protected constructor restricts creation of objects (use <a class="el" href="classpion_1_1_h_t_t_p_response.html#bebd43da5cc60c5ee4245066c58fe244" title="creates new HTTPResponse objects">create()</a>) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpion_1_1_h_t_t_p_response.html#756f5272417267ec27de4fc7cd7ababf">makeSetCookieHeader</a> (const std::string &amp;name, const std::string &amp;value, const std::string &amp;path, const bool has_max_age=false, const unsigned long max_age=0)</td></tr><tr><td colspan="2"><br><h2>Classes</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><b>BinaryCache</b></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">used to cache binary data included within the response <br></td></tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="e8939b9db481fc1f14c359965c933a23"></a><!-- doxytag: member="pion::HTTPResponse::write" ref="e8939b9db481fc1f14c359965c933a23" args="(const T &amp;data)" --><div class="memitem"><div class="memproto"><div class="memtemplate">template&lt;typename T&gt; </div>      <table class="memname">        <tr>          <td class="memname">void pion::HTTPResponse::write           </td>          <td>(</td>          <td class="paramtype">const T &amp;&nbsp;</td>          <td class="paramname"> <em>data</em>          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"><code> [inline]</code></td>        </tr>      </table></div><div class="memdoc"><p>write text (non-binary) response content<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>the data to append to the response content </td></tr>  </table></dl><p>Definition at line <a class="el" href="_h_t_t_p_response_8hpp-source.html#l00053">53</a> of file <a class="el" href="_h_t_t_p_response_8hpp-source.html">HTTPResponse.hpp</a>.</div></div><p><a class="anchor" name="dd72716c96b9ff539675e545552d6a9b"></a><!-- doxytag: member="pion::HTTPResponse::write" ref="dd72716c96b9ff539675e545552d6a9b" args="(const void *data, size_t length)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">void pion::HTTPResponse::write           </td>          <td>(</td>          <td class="paramtype">const void *&nbsp;</td>          <td class="paramname"> <em>data</em>, </td>        </tr>        <tr>          <td class="paramkey"></td>          <td></td>          <td class="paramtype">size_t&nbsp;</td>          <td class="paramname"> <em>length</em></td><td>&nbsp;</td>        </tr>        <tr>          <td></td>          <td>)</td>          <td></td><td></td><td width="100%"><code> [inline]</code></td>        </tr>      </table></div><div class="memdoc"><p>write binary response content<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>points to the binary data to append to the response content </td></tr>    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>the length, in bytes, of the binary data </td></tr>  </table></dl><p>Definition at line <a class="el" href="_h_t_t_p_response_8hpp-source.html#l00064">64</a> of file <a class="el" href="_h_t_t_p_response_8hpp-source.html">HTTPResponse.hpp</a>.</div></div><p><a class="anchor" name="1738cab55e8fd24a3a145f1f07d8f13a"></a><!-- doxytag: member="pion::HTTPResponse::writeNoCopy" ref="1738cab55e8fd24a3a145f1f07d8f13a" args="(const T &amp;data)" --><div class="memitem"><div class="memproto"><div class="memtemplate">template&lt;typename T&gt; </div>      <table class="memname">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -