You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
33 KiB
215 lines
33 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.9.7"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Webserv: srcs/load/Route.cpp 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="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>
|
|
<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 id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">Webserv
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.7 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<!-- 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">
|
|
<div id="MSearchResults">
|
|
<div class="SRPage">
|
|
<div id="SRIndex">
|
|
<div id="SRResults"></div>
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_b73b02d482d1c4a3db20c3d9ad52d395.html">srcs</a></li><li class="navelem"><a class="el" href="dir_5fca218e70541e091643ad2320ad7111.html">load</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle"><div class="title">Route.cpp</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="Route_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include "<a class="code" href="webserv_8hpp.html">webserv.hpp</a>"</span></div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="classRoute.html#a3e7545442240c05dc562e2c9254c27ba"> 20</a></span><a class="code hl_function" href="classRoute.html#a3e7545442240c05dc562e2c9254c27ba">Route::Route</a>(<a class="code hl_class" href="classServer.html">Server</a> *server, <span class="keywordtype">string</span> location, <a class="code hl_class" href="classJSONNode.html">JSONNode</a> *datas) : _server(server), _location(location) {</div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <a class="code hl_typedef" href="webserv_8hpp.html#adfa52a9e5ae79ca0eff47012a29449e3">JSONObject</a> <span class="keywordtype">object</span> = datas-><a class="code hl_function" href="classJSONNode.html#a6412ecbb284cfddb5de9818b72c785f9">obj</a>();</div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <a class="code hl_class" href="classJSONNode.html">JSONNode</a> *tmp;</div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <a class="code hl_variable" href="classRoute.html#a9b02eecb856d31da63cd1cd84600c43a">_autoindex</a> = <span class="keyword">false</span>;</div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <a class="code hl_variable" href="classRoute.html#a554deee37019d76b96a3411301b1d380">_client_max_body_size</a> = -1;</div>
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"root"</span>]))</div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <a class="code hl_variable" href="classRoute.html#a56499c8c2520297a62e2a117475e9e7c">_root</a> = tmp-><a class="code hl_function" href="classJSONNode.html#acc698e882b650c5679469ccd376b39db">str</a>();</div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"return"</span>]))</div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <a class="code hl_variable" href="classRoute.html#ac3f11aed02ce019d0d556230b119d217">_ret</a> = tmp-><a class="code hl_function" href="classJSONNode.html#acc698e882b650c5679469ccd376b39db">str</a>();</div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"autoindex"</span>]))</div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <a class="code hl_variable" href="classRoute.html#a9b02eecb856d31da63cd1cd84600c43a">_autoindex</a> = tmp-><a class="code hl_function" href="classJSONNode.html#aed3bd34b9670b2e14dc2a3d08cb19d89">boo</a>();</div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"indexs"</span>])) {</div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <a class="code hl_typedef" href="webserv_8hpp.html#aa3529ef9abc60facb73497ed5062d913">JSONList</a> indexs = tmp-><a class="code hl_function" href="classJSONNode.html#ac6290ea016718b625b5a60ce176c75b8">lst</a>();</div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">for</span> (JSONList::iterator it = indexs.begin(); it < indexs.end(); it++)</div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <a class="code hl_variable" href="classRoute.html#a59d3fd535c995846b0d81b69d9b268f1">_indexs</a>.push_back((*it)->str());</div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> }</div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"allowed_methods"</span>])) {</div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <a class="code hl_typedef" href="webserv_8hpp.html#aa3529ef9abc60facb73497ed5062d913">JSONList</a> headers = tmp-><a class="code hl_function" href="classJSONNode.html#ac6290ea016718b625b5a60ce176c75b8">lst</a>();</div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">for</span> (JSONList::iterator it = headers.begin(); it < headers.end(); it++)</div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <a class="code hl_variable" href="classRoute.html#a3096f41064cf24c0c884d4c26f2fa07f">_allowed_methods</a>.push_back((*it)->str());</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> }</div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"cgi"</span>])) {</div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <a class="code hl_typedef" href="webserv_8hpp.html#adfa52a9e5ae79ca0eff47012a29449e3">JSONObject</a> cgis = tmp-><a class="code hl_function" href="classJSONNode.html#a6412ecbb284cfddb5de9818b72c785f9">obj</a>();</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">for</span> (JSONObject::iterator it = cgis.begin(); it != cgis.end(); it++)</div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <a class="code hl_variable" href="classRoute.html#a1688ba652b72bb3a1a0055e7e9cd3e41">_cgi</a>[(*it).first] = (*it).second->str();</div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> }</div>
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">if</span> ((tmp = <span class="keywordtype">object</span>[<span class="stringliteral">"client_max_body_size"</span>]))</div>
|
|
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <a class="code hl_variable" href="classRoute.html#a554deee37019d76b96a3411301b1d380">_client_max_body_size</a> = tmp-><a class="code hl_function" href="classJSONNode.html#a3c65ea4af29daa3869273af827ebe43c">nbr</a>();</div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>}</div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"><a class="line" href="classRoute.html#a6c8cb0aaef581d3c14fff8ad99b3894f"> 51</a></span><a class="code hl_function" href="classRoute.html#a6c8cb0aaef581d3c14fff8ad99b3894f">Route::~Route</a>(<span class="keywordtype">void</span>) {}</div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="comment">// Getters</span></div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"><a class="line" href="classRoute.html#a888d6e2bc84b59421e9909e075a6e8bb"> 54</a></span><span class="keywordtype">string</span> <a class="code hl_function" href="classRoute.html#a888d6e2bc84b59421e9909e075a6e8bb">Route::getLocation</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> <a class="code hl_variable" href="classRoute.html#a7e6bd355bcfd1c4110d300649291b58a">_location</a>; }</div>
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="classRoute.html#afd1fe00a85e85ac4964f618f8f2d7bdf"> 55</a></span><span class="keywordtype">string</span> <a class="code hl_function" href="classRoute.html#afd1fe00a85e85ac4964f618f8f2d7bdf">Route::getRoot</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> <a class="code hl_variable" href="classRoute.html#a56499c8c2520297a62e2a117475e9e7c">_root</a>; }</div>
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="classRoute.html#af9b27a012c16f0105b7c5caf25e033ef"> 56</a></span><span class="keywordtype">string</span> <a class="code hl_function" href="classRoute.html#af9b27a012c16f0105b7c5caf25e033ef">Route::getReturn</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> <a class="code hl_variable" href="classRoute.html#ac3f11aed02ce019d0d556230b119d217">_ret</a>; }</div>
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="classRoute.html#aa71b39273ba7bc2f683f40a6573ff810"> 66</a></span><span class="keywordtype">string</span> <a class="code hl_function" href="classRoute.html#aa71b39273ba7bc2f683f40a6573ff810">Route::getIndex</a>(<span class="keywordtype">string</span> uri, <span class="keywordtype">string</span> path) {</div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> std::stringstream body, ret;</div>
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> DIR *dir;</div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">struct </span>dirent *entry;</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">struct </span>stat info;</div>
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> vec_string::iterator it;</div>
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">if</span> ((dir = opendir(path.c_str()))) {</div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">if</span> (<a class="code hl_define" href="webserv_8hpp.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a>)</div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> cout << <span class="stringliteral">"get index(): path="</span> << path << <span class="stringliteral">"\n"</span>;</div>
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> body << <span class="stringliteral">"<h3 style=\"text-align: center;\">"</span> << path << <span class="stringliteral">" files :</h3>\n<ul>\n"</span>;</div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">while</span> ((entry = readdir(dir)) != NULL) {</div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordflow">if</span> (entry->d_name[0] == <span class="charliteral">'.'</span>)</div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">continue</span>;</div>
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">for</span> (it = <a class="code hl_variable" href="classRoute.html#a59d3fd535c995846b0d81b69d9b268f1">_indexs</a>.begin(); it < <a class="code hl_variable" href="classRoute.html#a59d3fd535c995846b0d81b69d9b268f1">_indexs</a>.end(); it++) {</div>
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordflow">if</span> (entry->d_name == *it)</div>
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">return</span> (<a class="code hl_function" href="tools_8cpp.html#a044b9a41ee6f56019e039d36e91dc265">read_file</a>(path + <span class="stringliteral">"/"</span> + *it));</div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> }</div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> body << <span class="stringliteral">"<li><a href=\""</span> << uri + <span class="stringliteral">"/"</span> + entry->d_name << <span class="stringliteral">"\">"</span> << entry->d_name << <span class="stringliteral">"</a></li>\n"</span>;</div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">if</span> (stat(path.c_str(), &info) != 0)</div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> std::cerr << <span class="stringliteral">"stat() error on "</span> << path << <span class="stringliteral">": "</span> << strerror(errno) << <span class="stringliteral">"\n"</span>;</div>
|
|
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> }</div>
|
|
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> body << <span class="stringliteral">"</ul>"</span>;</div>
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> closedir(dir);</div>
|
|
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> }</div>
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keywordflow">if</span> (!dir || !<a class="code hl_variable" href="classRoute.html#a9b02eecb856d31da63cd1cd84600c43a">_autoindex</a>)</div>
|
|
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">return</span> <span class="stringliteral">""</span>;</div>
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordflow">if</span> (<a class="code hl_define" href="webserv_8hpp.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a>)</div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> cout << <span class="stringliteral">"Getting autoindex\n"</span>;</div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> ret << <span class="stringliteral">"Content-type: text/html \r\n"</span>;</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> ret << <span class="stringliteral">"Content-length: "</span> << body.str().length() << <span class="stringliteral">"\r\n"</span>;</div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> ret << <span class="stringliteral">"\r\n"</span> << body.str();</div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">return</span> ret.str();</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span>}</div>
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span><span class="comment">/* |==========|</span></div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span><span class="comment"> * Correct the uri the client asked</span></div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span><span class="comment"> *</span></div>
|
|
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span><span class="comment"> * Input: The uri</span></div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span><span class="comment"> * Output: The local path corresponding to that uri in the route</span></div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"><a class="line" href="classRoute.html#a5826254afb1e57c980c4b671bea8370a"> 115</a></span><span class="keywordtype">string</span> <a class="code hl_function" href="classRoute.html#a5826254afb1e57c980c4b671bea8370a">Route::correctUri</a>(<span class="keywordtype">string</span> uri) {</div>
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> std::stringstream ret;</div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> vec_string::iterator loc_word, uri_word;</div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> </div>
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_typedef" href="webserv_8hpp.html#aba96a6988a5bc02b5c8b908af07d0bbb">vec_string</a> loc_words = <a class="code hl_function" href="tools_8cpp.html#a4a79e98b5dec14d16875307f7e77dfb3">split</a>(<a class="code hl_variable" href="classRoute.html#a7e6bd355bcfd1c4110d300649291b58a">_location</a>, <span class="stringliteral">"/"</span>);</div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <a class="code hl_typedef" href="webserv_8hpp.html#aba96a6988a5bc02b5c8b908af07d0bbb">vec_string</a> uri_words = <a class="code hl_function" href="tools_8cpp.html#a4a79e98b5dec14d16875307f7e77dfb3">split</a>(uri, <span class="stringliteral">"/"</span>);</div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> uri_word = uri_words.begin();</div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">for</span> (loc_word = loc_words.begin(); loc_word < loc_words.end(); loc_word++) {</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordflow">while</span> (uri_word < uri_words.end() && *uri_word == <span class="stringliteral">""</span>)</div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> uri_word++;</div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keywordflow">while</span> (loc_word < loc_words.end() && *loc_word == <span class="stringliteral">""</span>)</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> loc_word++;</div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">if</span> (loc_word != loc_words.end())</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> uri_word++;</div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> ret << <span class="stringliteral">"./"</span> << <a class="code hl_variable" href="classRoute.html#a56499c8c2520297a62e2a117475e9e7c">_root</a>;</div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">while</span> (uri_word < uri_words.end())</div>
|
|
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> ret << <span class="stringliteral">"/"</span> << *(uri_word++);</div>
|
|
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <span class="keywordflow">return</span> ret.str();</div>
|
|
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span>}</div>
|
|
<div class="ttc" id="aclassJSONNode_html"><div class="ttname"><a href="classJSONNode.html">JSONNode</a></div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8hpp_source.html#l00004">Nodes.hpp:4</a></div></div>
|
|
<div class="ttc" id="aclassJSONNode_html_a3c65ea4af29daa3869273af827ebe43c"><div class="ttname"><a href="classJSONNode.html#a3c65ea4af29daa3869273af827ebe43c">JSONNode::nbr</a></div><div class="ttdeci">int nbr()</div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8cpp_source.html#l00018">Nodes.cpp:18</a></div></div>
|
|
<div class="ttc" id="aclassJSONNode_html_a6412ecbb284cfddb5de9818b72c785f9"><div class="ttname"><a href="classJSONNode.html#a6412ecbb284cfddb5de9818b72c785f9">JSONNode::obj</a></div><div class="ttdeci">JSONObject obj()</div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8cpp_source.html#l00003">Nodes.cpp:3</a></div></div>
|
|
<div class="ttc" id="aclassJSONNode_html_ac6290ea016718b625b5a60ce176c75b8"><div class="ttname"><a href="classJSONNode.html#ac6290ea016718b625b5a60ce176c75b8">JSONNode::lst</a></div><div class="ttdeci">JSONList lst()</div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8cpp_source.html#l00008">Nodes.cpp:8</a></div></div>
|
|
<div class="ttc" id="aclassJSONNode_html_acc698e882b650c5679469ccd376b39db"><div class="ttname"><a href="classJSONNode.html#acc698e882b650c5679469ccd376b39db">JSONNode::str</a></div><div class="ttdeci">string str()</div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8cpp_source.html#l00013">Nodes.cpp:13</a></div></div>
|
|
<div class="ttc" id="aclassJSONNode_html_aed3bd34b9670b2e14dc2a3d08cb19d89"><div class="ttname"><a href="classJSONNode.html#aed3bd34b9670b2e14dc2a3d08cb19d89">JSONNode::boo</a></div><div class="ttdeci">bool boo()</div><div class="ttdef"><b>Definition:</b> <a href="Nodes_8cpp_source.html#l00023">Nodes.cpp:23</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a1688ba652b72bb3a1a0055e7e9cd3e41"><div class="ttname"><a href="classRoute.html#a1688ba652b72bb3a1a0055e7e9cd3e41">Route::_cgi</a></div><div class="ttdeci">std::map< string, string > _cgi</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00012">Route.hpp:12</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a3096f41064cf24c0c884d4c26f2fa07f"><div class="ttname"><a href="classRoute.html#a3096f41064cf24c0c884d4c26f2fa07f">Route::_allowed_methods</a></div><div class="ttdeci">vec_string _allowed_methods</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00011">Route.hpp:11</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a3e7545442240c05dc562e2c9254c27ba"><div class="ttname"><a href="classRoute.html#a3e7545442240c05dc562e2c9254c27ba">Route::Route</a></div><div class="ttdeci">Route(Server *server, string location, JSONNode *datas)</div><div class="ttdoc">Constructor.</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00020">Route.cpp:20</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a554deee37019d76b96a3411301b1d380"><div class="ttname"><a href="classRoute.html#a554deee37019d76b96a3411301b1d380">Route::_client_max_body_size</a></div><div class="ttdeci">int _client_max_body_size</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00013">Route.hpp:13</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a56499c8c2520297a62e2a117475e9e7c"><div class="ttname"><a href="classRoute.html#a56499c8c2520297a62e2a117475e9e7c">Route::_root</a></div><div class="ttdeci">string _root</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00007">Route.hpp:7</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a5826254afb1e57c980c4b671bea8370a"><div class="ttname"><a href="classRoute.html#a5826254afb1e57c980c4b671bea8370a">Route::correctUri</a></div><div class="ttdeci">string correctUri(string uri)</div><div class="ttdoc">Find the local path corresponding to the uri asked by te client.</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00115">Route.cpp:115</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a59d3fd535c995846b0d81b69d9b268f1"><div class="ttname"><a href="classRoute.html#a59d3fd535c995846b0d81b69d9b268f1">Route::_indexs</a></div><div class="ttdeci">vec_string _indexs</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00011">Route.hpp:11</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a6c8cb0aaef581d3c14fff8ad99b3894f"><div class="ttname"><a href="classRoute.html#a6c8cb0aaef581d3c14fff8ad99b3894f">Route::~Route</a></div><div class="ttdeci">~Route(void)</div><div class="ttdoc">Destructor.</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00051">Route.cpp:51</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a7e6bd355bcfd1c4110d300649291b58a"><div class="ttname"><a href="classRoute.html#a7e6bd355bcfd1c4110d300649291b58a">Route::_location</a></div><div class="ttdeci">string _location</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00007">Route.hpp:7</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a888d6e2bc84b59421e9909e075a6e8bb"><div class="ttname"><a href="classRoute.html#a888d6e2bc84b59421e9909e075a6e8bb">Route::getLocation</a></div><div class="ttdeci">string getLocation(void)</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00054">Route.cpp:54</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_a9b02eecb856d31da63cd1cd84600c43a"><div class="ttname"><a href="classRoute.html#a9b02eecb856d31da63cd1cd84600c43a">Route::_autoindex</a></div><div class="ttdeci">bool _autoindex</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00008">Route.hpp:8</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_aa71b39273ba7bc2f683f40a6573ff810"><div class="ttname"><a href="classRoute.html#aa71b39273ba7bc2f683f40a6573ff810">Route::getIndex</a></div><div class="ttdeci">string getIndex(string uri, string path)</div><div class="ttdoc">Search for an index while generating autoindex.</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00066">Route.cpp:66</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_ac3f11aed02ce019d0d556230b119d217"><div class="ttname"><a href="classRoute.html#ac3f11aed02ce019d0d556230b119d217">Route::_ret</a></div><div class="ttdeci">string _ret</div><div class="ttdef"><b>Definition:</b> <a href="Route_8hpp_source.html#l00007">Route.hpp:7</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_af9b27a012c16f0105b7c5caf25e033ef"><div class="ttname"><a href="classRoute.html#af9b27a012c16f0105b7c5caf25e033ef">Route::getReturn</a></div><div class="ttdeci">string getReturn(void)</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00056">Route.cpp:56</a></div></div>
|
|
<div class="ttc" id="aclassRoute_html_afd1fe00a85e85ac4964f618f8f2d7bdf"><div class="ttname"><a href="classRoute.html#afd1fe00a85e85ac4964f618f8f2d7bdf">Route::getRoot</a></div><div class="ttdeci">string getRoot(void)</div><div class="ttdef"><b>Definition:</b> <a href="Route_8cpp_source.html#l00055">Route.cpp:55</a></div></div>
|
|
<div class="ttc" id="aclassServer_html"><div class="ttname"><a href="classServer.html">Server</a></div><div class="ttdef"><b>Definition:</b> <a href="Server_8hpp_source.html#l00004">Server.hpp:4</a></div></div>
|
|
<div class="ttc" id="atools_8cpp_html_a044b9a41ee6f56019e039d36e91dc265"><div class="ttname"><a href="tools_8cpp.html#a044b9a41ee6f56019e039d36e91dc265">read_file</a></div><div class="ttdeci">string read_file(string path)</div><div class="ttdef"><b>Definition:</b> <a href="tools_8cpp_source.html#l00058">tools.cpp:58</a></div></div>
|
|
<div class="ttc" id="atools_8cpp_html_a4a79e98b5dec14d16875307f7e77dfb3"><div class="ttname"><a href="tools_8cpp.html#a4a79e98b5dec14d16875307f7e77dfb3">split</a></div><div class="ttdeci">vec_string split(string str, string delim)</div><div class="ttdef"><b>Definition:</b> <a href="tools_8cpp_source.html#l00020">tools.cpp:20</a></div></div>
|
|
<div class="ttc" id="awebserv_8hpp_html"><div class="ttname"><a href="webserv_8hpp.html">webserv.hpp</a></div></div>
|
|
<div class="ttc" id="awebserv_8hpp_html_aa3529ef9abc60facb73497ed5062d913"><div class="ttname"><a href="webserv_8hpp.html#aa3529ef9abc60facb73497ed5062d913">JSONList</a></div><div class="ttdeci">std::vector< JSONNode * > JSONList</div><div class="ttdef"><b>Definition:</b> <a href="webserv_8hpp_source.html#l00049">webserv.hpp:49</a></div></div>
|
|
<div class="ttc" id="awebserv_8hpp_html_aba96a6988a5bc02b5c8b908af07d0bbb"><div class="ttname"><a href="webserv_8hpp.html#aba96a6988a5bc02b5c8b908af07d0bbb">vec_string</a></div><div class="ttdeci">std::vector< string > vec_string</div><div class="ttdef"><b>Definition:</b> <a href="webserv_8hpp_source.html#l00050">webserv.hpp:50</a></div></div>
|
|
<div class="ttc" id="awebserv_8hpp_html_ad72dbcf6d0153db1b8d8a58001feed83"><div class="ttname"><a href="webserv_8hpp.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a></div><div class="ttdeci">#define DEBUG</div><div class="ttdef"><b>Definition:</b> <a href="webserv_8hpp_source.html#l00002">webserv.hpp:2</a></div></div>
|
|
<div class="ttc" id="awebserv_8hpp_html_adfa52a9e5ae79ca0eff47012a29449e3"><div class="ttname"><a href="webserv_8hpp.html#adfa52a9e5ae79ca0eff47012a29449e3">JSONObject</a></div><div class="ttdeci">std::map< string, JSONNode * > JSONObject</div><div class="ttdef"><b>Definition:</b> <a href="webserv_8hpp_source.html#l00048">webserv.hpp:48</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|