-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05_TypicalRequestFlow.html
More file actions
145 lines (143 loc) · 7.18 KB
/
05_TypicalRequestFlow.html
File metadata and controls
145 lines (143 loc) · 7.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!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.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Squid Web Cache: Flow of a Typical Request</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>
<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">Squid Web Cache<span id="projectnumber"> master</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<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>
</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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(document).ready(function(){initNavTree('05_TypicalRequestFlow.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">
<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><div class="header">
<div class="headertitle"><div class="title">Flow of a Typical Request</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section user"><dt></dt><dd><ul>
<li>A client connection is accepted by the client-side socket support and parsed.</li>
</ul>
<ul>
<li>The access controls are checked. The client-side-request builds an ACL state data structure and registers a callback function for notification when access control checking is completed.</li>
</ul>
<ul>
<li>After the access controls have been verified, the request may be redirected.</li>
</ul>
<ul>
<li>The client-side-request is forwarded up the client stream to GetMoreData() which looks for the requested object in the cache, and or Vary: versions of the same. If is a cache hit, then the client-side registers its interest in the <a class="el" href="classStoreEntry.html">StoreEntry</a>. Otherwise, Squid needs to forward the request, perhaps with an If-Modified-Since header.</li>
</ul>
<ul>
<li>The request-forwarding process begins with protoDispatch(). This function begins the peer selection procedure, which may involve sending ICP queries and receiving ICP replies. The peer selection procedure also involves checking configuration options such as <em>never_direct</em> and <em>always_direct</em>.</li>
</ul>
<ul>
<li>When the ICP replies (if any) have been processed, we end up at protoStart(). This function calls an appropriate protocol-specific function for forwarding the request. Here we will assume it is an HTTP request.</li>
</ul>
<ul>
<li>The HTTP module first opens a connection to the origin server or cache peer. If there is no idle persistent socket available, a new connection request is given to the Network Communication module with a callback function. The comm.c routines may try establishing a connection multiple times before giving up.</li>
</ul>
<ul>
<li>When a TCP connection has been established, HTTP builds a request buffer and submits it for writing on the socket. It then registers a read handler to receive and process the HTTP reply.</li>
</ul>
<ul>
<li>As the reply is initially received, the HTTP reply headers are parsed and placed into a reply data structure. As reply data is read, it is appended to the <a class="el" href="classStoreEntry.html">StoreEntry</a>. Every time data is appended to the <a class="el" href="classStoreEntry.html">StoreEntry</a>, the client-side is notified of the new data via a callback function. The rate at which reading occurs is regulated by the delay pools routines, via the deferred read mechanism.</li>
</ul>
<ul>
<li>As the client-side is notified of new data, it copies the data from the <a class="el" href="classStoreEntry.html">StoreEntry</a> and submits it for writing on the client socket.</li>
</ul>
<ul>
<li>As data is appended to the <a class="el" href="classStoreEntry.html">StoreEntry</a>, and the client(s) read it, the data may be submitted for writing to disk.</li>
</ul>
<ul>
<li>When the HTTP module finishes reading the reply from the upstream server, it marks the <a class="el" href="classStoreEntry.html">StoreEntry</a> as "complete". The server socket is either closed or given to the persistent connection pool for future use.</li>
</ul>
<ul>
<li>When the client-side has written all of the object data, it unregisters itself from the <a class="el" href="classStoreEntry.html">StoreEntry</a>. At the same time it either waits for another request from the client, or closes the client connection. </li>
</ul>
</dd></dl>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">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.8 </li>
</ul>
</div>
</body>
</html>