MCPcopy Index your code
hub / github.com/RustPython/RustPython / BaseHTTPRequestHandler

Class BaseHTTPRequestHandler

Lib/http/server.py:199–703  ·  view source on GitHub ↗

HTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an ext

Source from the content-addressed store, hash-verified

197
198
199class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
200
201 """HTTP request handler base class.
202
203 The following explanation of HTTP serves to guide you through the
204 code as well as to expose any misunderstandings I may have about
205 HTTP (so you don't need to read the code to figure out I'm wrong
206 :-).
207
208 HTTP (HyperText Transfer Protocol) is an extensible protocol on
209 top of a reliable stream transport (e.g. TCP/IP). The protocol
210 recognizes three parts to a request:
211
212 1. One line identifying the request type and path
213 2. An optional set of RFC-822-style headers
214 3. An optional data part
215
216 The headers and data are separated by a blank line.
217
218 The first line of the request has the form
219
220 <command> <path> <version>
221
222 where <command> is a (case-sensitive) keyword such as GET or POST,
223 <path> is a string containing path information for the request,
224 and <version> should be the string "HTTP/1.0" or "HTTP/1.1".
225 <path> is encoded using the URL encoding scheme (using %xx to signify
226 the ASCII character with hex code xx).
227
228 The specification specifies that lines are separated by CRLF but
229 for compatibility with the widest range of clients recommends
230 servers also handle LF. Similarly, whitespace in the request line
231 is treated sensibly (allowing multiple spaces between components
232 and allowing trailing whitespace).
233
234 Similarly, for output, lines ought to be separated by CRLF pairs
235 but most clients grok LF characters just fine.
236
237 If the first line of the request has the form
238
239 <command> <path>
240
241 (i.e. <version> is left out) then this is assumed to be an HTTP
242 0.9 request; this form has no optional headers and data part and
243 the reply consists of just the data.
244
245 The reply form of the HTTP 1.x protocol again has three parts:
246
247 1. One line giving the response code
248 2. An optional set of RFC-822-style headers
249 3. The data
250
251 Again, the headers and data are separated by a blank line.
252
253 The response code line has the form
254
255 <version> <responsecode> <responsestring>
256

Callers

nothing calls this directly

Calls 5

ordFunction · 0.85
chainMethod · 0.80
splitMethod · 0.45
maketransMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected