Crow/master/reference/http__request_8h_source.html

234 lines
30 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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crow: include/crow/http_request.h Source File</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
<link href="custom_dark_theme.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="projectlogo"><img alt="Logo" src="logo55.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Crow
&#160;<span id="projectnumber">1.1</span>
</div>
<div id="projectbrief">A C++ microframework for the web</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
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.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part --><!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('http__request_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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="headertitle">
<div class="title">http_request.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="preprocessor">#ifdef CROW_USE_BOOST</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="preprocessor">#include &lt;boost/asio.hpp&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#ifndef ASIO_STANDALONE</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#define ASIO_STANDALONE</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#include &lt;asio.hpp&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#include &quot;crow/common.h&quot;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#include &quot;crow/ci_map.h&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#include &quot;crow/query_string.h&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacecrow.html">crow</a> <span class="comment">// NOTE: Already documented in &quot;crow/app.h&quot;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;{</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#ifdef CROW_USE_BOOST</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="keyword">namespace </span>asio = boost::asio;</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment"> /// Find and return the value associated with the key. (returns an empty string if nothing is found)</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment"></span> <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="namespacecrow.html#ac0940ae1e094df6107d3a2604537279a"> 24</a></span>&#160; <span class="keyword">inline</span> <span class="keyword">const</span> std::string&amp; <a class="code" href="namespacecrow.html#ac0940ae1e094df6107d3a2604537279a">get_header_value</a>(<span class="keyword">const</span> T&amp; headers, <span class="keyword">const</span> std::string&amp; key)</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; <span class="keywordflow">if</span> (headers.count(key))</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; {</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="keywordflow">return</span> headers.find(key)-&gt;second;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; }</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keyword">static</span> std::string empty;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keywordflow">return</span> empty;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; }</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="comment"> /// An HTTP request.</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html"> 35</a></span>&#160;<span class="comment"></span> <span class="keyword">struct </span><a class="code" href="structcrow_1_1request.html">request</a></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; {</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; HTTPMethod method;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a"> 38</a></span>&#160; std::string <a class="code" href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a">raw_url</a>; <span class="comment">///&lt; The full URL containing the `?` and URL parameters.</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167"> 39</a></span>&#160; std::string <a class="code" href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167">url</a>; <span class="comment">///&lt; The endpoint without any parameters.</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0"> 40</a></span>&#160; <a class="code" href="classcrow_1_1query__string.html">query_string</a> <a class="code" href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0">url_params</a>; <span class="comment">///&lt; The parameters associated with the request. (everything after the `?` in the URL)</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; ci_map headers;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; std::string body;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#aa8a04e30e2249f04614f233d25ffaad7"> 43</a></span>&#160; std::string <a class="code" href="structcrow_1_1request.html#aa8a04e30e2249f04614f233d25ffaad7">remote_ip_address</a>; <span class="comment">///&lt; The IP address from which the request was sent.</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> http_ver_major, http_ver_minor;</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a5148ce95969d261e50ee977c1dc7960c"> 45</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="structcrow_1_1request.html#a5148ce95969d261e50ee977c1dc7960c">keep_alive</a>, <span class="comment">///&lt; Whether or not the server should send a `connection: Keep-Alive` header to the client.</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a4a3e4bcd0cd626ceaee38f4c17d28c8d"> 46</a></span>&#160; <a class="code" href="structcrow_1_1request.html#a4a3e4bcd0cd626ceaee38f4c17d28c8d">close_connection</a>, <span class="comment">///&lt; Whether or not the server should shut down the TCP connection once a response is sent.</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#ac4b5e2e32e2e0b633211925158b03559"> 47</a></span>&#160; <a class="code" href="structcrow_1_1request.html#ac4b5e2e32e2e0b633211925158b03559">upgrade</a>; <span class="comment">///&lt; Whether or noth the server should change the HTTP connection to a different connection.</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; </div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="keywordtype">void</span>* middleware_context{};</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordtype">void</span>* middleware_container{};</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; asio::io_service* io_service{};</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="comment"> /// Construct an empty request. (sets the method to `GET`)</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a838c9a8c9a5eb2283d57e66f3630b5a6"> 54</a></span>&#160;<span class="comment"></span> <a class="code" href="structcrow_1_1request.html#a838c9a8c9a5eb2283d57e66f3630b5a6">request</a>():</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; method(HTTPMethod::Get)</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; {}</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="comment"> /// Construct a request with all values assigned.</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a111b70ddb2a100a79415b539e152e145"> 59</a></span>&#160;<span class="comment"></span> <a class="code" href="structcrow_1_1request.html#a111b70ddb2a100a79415b539e152e145">request</a>(HTTPMethod method, std::string <a class="code" href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a">raw_url</a>, std::string <a class="code" href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167">url</a>, <a class="code" href="classcrow_1_1query__string.html">query_string</a> <a class="code" href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0">url_params</a>, ci_map headers, std::string body, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> http_major, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> http_minor, <span class="keywordtype">bool</span> has_keep_alive, <span class="keywordtype">bool</span> has_close_connection, <span class="keywordtype">bool</span> is_upgrade):</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; method(method), <a class="code" href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a">raw_url</a>(std::move(<a class="code" href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a">raw_url</a>)), <a class="code" href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167">url</a>(std::move(<a class="code" href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167">url</a>)), <a class="code" href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0">url_params</a>(std::move(<a class="code" href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0">url_params</a>)), headers(std::move(headers)), body(std::move(body)), http_ver_major(http_major), http_ver_minor(http_minor), <a class="code" href="structcrow_1_1request.html#a5148ce95969d261e50ee977c1dc7960c">keep_alive</a>(has_keep_alive), <a class="code" href="structcrow_1_1request.html#a4a3e4bcd0cd626ceaee38f4c17d28c8d">close_connection</a>(has_close_connection), <a class="code" href="structcrow_1_1request.html#ac4b5e2e32e2e0b633211925158b03559">upgrade</a>(is_upgrade)</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; {}</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keywordtype">void</span> add_header(std::string key, std::string value)</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; {</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; headers.emplace(std::move(key), std::move(value));</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; }</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keyword">const</span> std::string&amp; get_header_value(<span class="keyword">const</span> std::string&amp; key)<span class="keyword"> const</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keywordflow">return</span> <a class="code" href="namespacecrow.html#ac0940ae1e094df6107d3a2604537279a">crow::get_header_value</a>(headers, key);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; }</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; </div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="keywordtype">bool</span> check_version(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> major, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> minor)<span class="keyword"> const</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">return</span> http_ver_major == major &amp;&amp; http_ver_minor == minor;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; }</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="comment"> /// Get the body as parameters in QS format.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="comment"></span><span class="comment"></span> </div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="comment"> ///</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment"> /// This is meant to be used with requests of type &quot;application/x-www-form-urlencoded&quot;</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#af2679155b496b7d8d80a82c0d9a175b5"> 82</a></span>&#160;<span class="comment"></span> <span class="keyword">const</span> <a class="code" href="classcrow_1_1query__string.html">query_string</a> <a class="code" href="structcrow_1_1request.html#af2679155b496b7d8d80a82c0d9a175b5">get_body_params</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<span class="keyword"> </span>{</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classcrow_1_1query__string.html">query_string</a>(body, <span class="keyword">false</span>);</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; }</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;<span class="comment"> /// Send data to whoever made this request with a completion handler and return immediately.</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;<span class="comment"></span> <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CompletionHandler&gt;</div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#a33aa146a3914864ce82ef22136451601"> 89</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="structcrow_1_1request.html#a33aa146a3914864ce82ef22136451601">post</a>(CompletionHandler handler)</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; {</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; io_service-&gt;post(handler);</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; }</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="comment"> /// Send data to whoever made this request with a completion handler.</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="comment"></span> <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CompletionHandler&gt;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="structcrow_1_1request.html#ac3e72e3fe415c68618dee999e3984160"> 96</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="structcrow_1_1request.html#ac3e72e3fe415c68618dee999e3984160">dispatch</a>(CompletionHandler handler)</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; {</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; io_service-&gt;dispatch(handler);</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; }</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; };</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;} <span class="comment">// namespace crow</span></div>
<div class="ttc" id="aclasscrow_1_1query__string_html"><div class="ttname"><a href="classcrow_1_1query__string.html">crow::query_string</a></div><div class="ttdoc">A class to represent any data coming after the ? in the request URL into key-value pairs.</div><div class="ttdef"><b>Definition:</b> query_string.h:294</div></div>
<div class="ttc" id="anamespacecrow_html"><div class="ttname"><a href="namespacecrow.html">crow</a></div><div class="ttdoc">The main namespace of the library. In this namespace is defined the most important classes and functi...</div></div>
<div class="ttc" id="anamespacecrow_html_ac0940ae1e094df6107d3a2604537279a"><div class="ttname"><a href="namespacecrow.html#ac0940ae1e094df6107d3a2604537279a">crow::get_header_value</a></div><div class="ttdeci">const std::string &amp; get_header_value(const T &amp;headers, const std::string &amp;key)</div><div class="ttdoc">Find and return the value associated with the key. (returns an empty string if nothing is found)</div><div class="ttdef"><b>Definition:</b> http_request.h:24</div></div>
<div class="ttc" id="astructcrow_1_1request_html"><div class="ttname"><a href="structcrow_1_1request.html">crow::request</a></div><div class="ttdoc">An HTTP request.</div><div class="ttdef"><b>Definition:</b> http_request.h:36</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a111b70ddb2a100a79415b539e152e145"><div class="ttname"><a href="structcrow_1_1request.html#a111b70ddb2a100a79415b539e152e145">crow::request::request</a></div><div class="ttdeci">request(HTTPMethod method, std::string raw_url, std::string url, query_string url_params, ci_map headers, std::string body, unsigned char http_major, unsigned char http_minor, bool has_keep_alive, bool has_close_connection, bool is_upgrade)</div><div class="ttdoc">Construct a request with all values assigned.</div><div class="ttdef"><b>Definition:</b> http_request.h:59</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a33aa146a3914864ce82ef22136451601"><div class="ttname"><a href="structcrow_1_1request.html#a33aa146a3914864ce82ef22136451601">crow::request::post</a></div><div class="ttdeci">void post(CompletionHandler handler)</div><div class="ttdoc">Send data to whoever made this request with a completion handler and return immediately.</div><div class="ttdef"><b>Definition:</b> http_request.h:89</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a4a3e4bcd0cd626ceaee38f4c17d28c8d"><div class="ttname"><a href="structcrow_1_1request.html#a4a3e4bcd0cd626ceaee38f4c17d28c8d">crow::request::close_connection</a></div><div class="ttdeci">bool close_connection</div><div class="ttdoc">Whether or not the server should shut down the TCP connection once a response is sent.</div><div class="ttdef"><b>Definition:</b> http_request.h:46</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a5148ce95969d261e50ee977c1dc7960c"><div class="ttname"><a href="structcrow_1_1request.html#a5148ce95969d261e50ee977c1dc7960c">crow::request::keep_alive</a></div><div class="ttdeci">bool keep_alive</div><div class="ttdoc">Whether or not the server should send a connection: Keep-Alive header to the client.</div><div class="ttdef"><b>Definition:</b> http_request.h:45</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a72f5504a56f9ba70d7d33f86aaf9bc8a"><div class="ttname"><a href="structcrow_1_1request.html#a72f5504a56f9ba70d7d33f86aaf9bc8a">crow::request::raw_url</a></div><div class="ttdeci">std::string raw_url</div><div class="ttdoc">The full URL containing the ? and URL parameters.</div><div class="ttdef"><b>Definition:</b> http_request.h:38</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a745d5a94e9e9ae1fed64674aae0194b0"><div class="ttname"><a href="structcrow_1_1request.html#a745d5a94e9e9ae1fed64674aae0194b0">crow::request::url_params</a></div><div class="ttdeci">query_string url_params</div><div class="ttdoc">The parameters associated with the request. (everything after the ? in the URL)</div><div class="ttdef"><b>Definition:</b> http_request.h:40</div></div>
<div class="ttc" id="astructcrow_1_1request_html_a838c9a8c9a5eb2283d57e66f3630b5a6"><div class="ttname"><a href="structcrow_1_1request.html#a838c9a8c9a5eb2283d57e66f3630b5a6">crow::request::request</a></div><div class="ttdeci">request()</div><div class="ttdoc">Construct an empty request. (sets the method to GET)</div><div class="ttdef"><b>Definition:</b> http_request.h:54</div></div>
<div class="ttc" id="astructcrow_1_1request_html_aa3df34c56847d6d42887e73655276167"><div class="ttname"><a href="structcrow_1_1request.html#aa3df34c56847d6d42887e73655276167">crow::request::url</a></div><div class="ttdeci">std::string url</div><div class="ttdoc">The endpoint without any parameters.</div><div class="ttdef"><b>Definition:</b> http_request.h:39</div></div>
<div class="ttc" id="astructcrow_1_1request_html_aa8a04e30e2249f04614f233d25ffaad7"><div class="ttname"><a href="structcrow_1_1request.html#aa8a04e30e2249f04614f233d25ffaad7">crow::request::remote_ip_address</a></div><div class="ttdeci">std::string remote_ip_address</div><div class="ttdoc">The IP address from which the request was sent.</div><div class="ttdef"><b>Definition:</b> http_request.h:43</div></div>
<div class="ttc" id="astructcrow_1_1request_html_ac3e72e3fe415c68618dee999e3984160"><div class="ttname"><a href="structcrow_1_1request.html#ac3e72e3fe415c68618dee999e3984160">crow::request::dispatch</a></div><div class="ttdeci">void dispatch(CompletionHandler handler)</div><div class="ttdoc">Send data to whoever made this request with a completion handler.</div><div class="ttdef"><b>Definition:</b> http_request.h:96</div></div>
<div class="ttc" id="astructcrow_1_1request_html_ac4b5e2e32e2e0b633211925158b03559"><div class="ttname"><a href="structcrow_1_1request.html#ac4b5e2e32e2e0b633211925158b03559">crow::request::upgrade</a></div><div class="ttdeci">bool upgrade</div><div class="ttdoc">Whether or noth the server should change the HTTP connection to a different connection.</div><div class="ttdef"><b>Definition:</b> http_request.h:47</div></div>
<div class="ttc" id="astructcrow_1_1request_html_af2679155b496b7d8d80a82c0d9a175b5"><div class="ttname"><a href="structcrow_1_1request.html#af2679155b496b7d8d80a82c0d9a175b5">crow::request::get_body_params</a></div><div class="ttdeci">const query_string get_body_params() const</div><div class="ttdoc">Get the body as parameters in QS format.</div><div class="ttdef"><b>Definition:</b> http_request.h:82</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d22c1cb87b72f01e1a7f207eb3bfd1ca.html">crow</a></li><li class="navelem"><b>http_request.h</b></li>
<li class="footer">
Generated on Mon May 6 2024 for Crow by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1.
Dark theme by <a href="http://majerle.eu" target="_new">Tilen Majerle</a>. Edited by <a href="https://github.com/The-EDev" target="_new">Farook Al-Sammarraie</a>. All rights reserved.
</li>
</ul>
</div>
<script src="custom.js"></script>
</body>
</html>