OLD | NEW |
1 :mod:`http.server` --- HTTP servers | 1 :mod:`http.server` --- HTTP servers |
2 =================================== | 2 =================================== |
3 | 3 |
4 .. module:: http.server | 4 .. module:: http.server |
5 :synopsis: HTTP server and request handlers. | 5 :synopsis: HTTP server and request handlers. |
6 | 6 |
7 | 7 |
8 .. index:: | 8 .. index:: |
9 pair: WWW; server | 9 pair: WWW; server |
10 pair: HTTP; protocol | 10 pair: HTTP; protocol |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 response. | 180 response. |
181 | 181 |
182 .. method:: log_request(code='-', size='-') | 182 .. method:: log_request(code='-', size='-') |
183 | 183 |
184 Logs an accepted (successful) request. *code* should specify the numeric | 184 Logs an accepted (successful) request. *code* should specify the numeric |
185 HTTP code associated with the response. If a size of the response is | 185 HTTP code associated with the response. If a size of the response is |
186 available, then it should be passed as the *size* parameter. | 186 available, then it should be passed as the *size* parameter. |
187 | 187 |
188 .. method:: log_error(...) | 188 .. method:: log_error(...) |
189 | 189 |
190 Logs an error when a request cannot be fulfilled. By default, it passes | 190 Logs an error message to ``sys.stderr`` when a request cannot be |
191 the message to :meth:`log_message`, so it takes the same arguments | 191 fulfilled. By default, it passes the message to :meth:`log_message`, |
192 (*format* and additional values). | 192 so it takes the same arguments (*format* and additional values). |
193 | 193 |
194 | 194 |
195 .. method:: log_message(format, ...) | 195 .. method:: log_message(format, ...) |
196 | 196 |
197 Logs an arbitrary message to ``sys.stderr``. This is typically overridden | 197 Logs an arbitrary message to ``sys.stdout``. This is typically overridden |
198 to create custom error logging mechanisms. The *format* argument is a | 198 to create custom error logging mechanisms. The *format* argument is a |
199 standard printf-style format string, where the additional arguments to | 199 standard printf-style format string, where the additional arguments to |
200 :meth:`log_message` are applied as inputs to the formatting. The client | 200 :meth:`log_message` are applied as inputs to the formatting. The client |
201 address and current date and time are prefixed to every message logged. | 201 address and current date and time are prefixed to every message logged. |
202 | 202 |
203 .. method:: version_string() | 203 .. method:: version_string() |
204 | 204 |
205 Returns the server software's version string. This is a combination of the | 205 Returns the server software's version string. This is a combination of the |
206 :attr:`server_version` and :attr:`sys_version` class variables. | 206 :attr:`server_version` and :attr:`sys_version` class variables. |
207 | 207 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 The :class:`CGIHTTPRequestHandler` defines the following method: | 340 The :class:`CGIHTTPRequestHandler` defines the following method: |
341 | 341 |
342 .. method:: do_POST() | 342 .. method:: do_POST() |
343 | 343 |
344 This method serves the ``'POST'`` request type, only allowed for CGI | 344 This method serves the ``'POST'`` request type, only allowed for CGI |
345 scripts. Error 501, "Can only POST to CGI scripts", is output when trying | 345 scripts. Error 501, "Can only POST to CGI scripts", is output when trying |
346 to POST to a non-CGI url. | 346 to POST to a non-CGI url. |
347 | 347 |
348 Note that CGI scripts will be run with UID of user nobody, for security | 348 Note that CGI scripts will be run with UID of user nobody, for security |
349 reasons. Problems with the CGI script will be translated to error 403. | 349 reasons. Problems with the CGI script will be translated to error 403. |
OLD | NEW |