Changeset 2165
- Timestamp:
- 03/30/09 11:14:46
- Files:
-
- branches/python3/cherrypy/__init__.py (modified) (2 diffs)
- branches/python3/cherrypy/_cperror.py (modified) (3 diffs)
- branches/python3/cherrypy/_cprequest.py (modified) (15 diffs)
- branches/python3/cherrypy/_cptree.py (modified) (3 diffs)
- branches/python3/cherrypy/_cpwsgi.py (modified) (3 diffs)
- branches/python3/cherrypy/lib/httputil.py (moved) (moved from branches/python3/cherrypy/lib/http.py) (1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/python3/cherrypy/__init__.py
r2158 r2165 164 164 165 165 from cherrypy import _cprequest 166 from cherrypy.lib import http as _http166 from cherrypy.lib import httputil as _httputil 167 167 168 168 from cherrypy import _cptree … … 266 266 """ 267 267 268 request = _cprequest.Request(_http .Host("127.0.0.1", 80),269 _http .Host("127.0.0.1", 1111))268 request = _cprequest.Request(_httputil.Host("127.0.0.1", 80), 269 _httputil.Host("127.0.0.1", 1111)) 270 270 request__doc = """ 271 271 The request object for the current thread. In the main thread, branches/python3/cherrypy/_cperror.py
r2164 r2165 5 5 from traceback import format_exception as _format_exception 6 6 from urllib.parse import urljoin as _urljoin 7 from cherrypy.lib import http as _http7 from cherrypy.lib import httputil 8 8 9 9 … … 187 187 self.status = status 188 188 try: 189 self.code, self.reason, defaultmsg = _http.valid_status(status)189 self.code, self.reason, defaultmsg = httputil.valid_status(status) 190 190 except ValueError as x: 191 191 raise cherrypy.HTTPError(500, x.args[0]) … … 283 283 284 284 try: 285 code, reason, message = _http.valid_status(status)285 code, reason, message = httputil.valid_status(status) 286 286 except ValueError as x: 287 287 raise cherrypy.HTTPError(500, x.args[0]) branches/python3/cherrypy/_cprequest.py
r2164 r2165 9 9 from cherrypy import _cpcgifs, _cpconfig 10 10 from cherrypy._cperror import format_exc, bare_error 11 from cherrypy.lib import http , file_generator11 from cherrypy.lib import httputil, file_generator 12 12 13 13 … … 174 174 175 175 # Conversation/connection attributes 176 local = http .Host("127.0.0.1", 80)176 local = httputil.Host("127.0.0.1", 80) 177 177 local__doc = \ 178 178 "An http.Host(ip, port, hostname) object for the server socket." 179 179 180 remote = http .Host("127.0.0.1", 1111)180 remote = httputil.Host("127.0.0.1", 1111) 181 181 remote__doc = \ 182 182 "An http.Host(ip, port, hostname) object for the client socket." … … 243 243 In general, you should use request.headers (a dict) instead.""" 244 244 245 headers = http .HeaderMap()245 headers = httputil.HeaderMap() 246 246 headers__doc = """ 247 247 A dict-like object containing the request headers. Keys are header … … 250 250 headers['content-type'] refer to the same value. Values are header 251 251 values (decoded according to RFC 2047 if necessary). See also: 252 http .HeaderMap, http.HeaderElement."""252 httputil.HeaderMap, httputil.HeaderElement.""" 253 253 254 254 cookie = http.cookies.SimpleCookie() … … 457 457 """Populate a new Request object. 458 458 459 local_host should be an http .Host object with the server info.460 remote_host should be an http .Host object with the client info.459 local_host should be an httputil.Host object with the server info. 460 remote_host should be an httputil.Host object with the client info. 461 461 scheme should be a string, either "http" or "https". 462 462 """ … … 534 534 self.header_list = list(headers) 535 535 self.rfile = rfile 536 self.headers = http .HeaderMap()536 self.headers = httputil.HeaderMap() 537 537 self.cookie = http.cookies.SimpleCookie() 538 538 self.handler = None … … 634 634 def process_headers(self): 635 635 """Parse HTTP header data into Python structures. (Core)""" 636 self.params = http .parse_query_string(self.query_string)636 self.params = httputil.parse_query_string(self.query_string) 637 637 638 638 # Process the headers into self.headers … … 648 648 # (but they will be correctly stored in request.cookie). 649 649 if "=?" in value: 650 dict.__setitem__(headers, name, http .decode_TEXT(value))650 dict.__setitem__(headers, name, httputil.decode_TEXT(value)) 651 651 else: 652 652 dict.__setitem__(headers, name, value) … … 714 714 # didn't provide a "Content-Type" header. 715 715 if 'Content-Type' not in self.headers: 716 h = http .HeaderMap(list(self.headers.items()))716 h = httputil.HeaderMap(list(self.headers.items())) 717 717 h['Content-Type'] = '' 718 718 else: … … 740 740 self.body = forms.file 741 741 else: 742 self.body_params = p = http .params_from_CGI_form(forms)742 self.body_params = p = httputil.params_from_CGI_form(forms) 743 743 self.params.update(p) 744 744 … … 802 802 In general, you should use response.headers (a dict) instead.""" 803 803 804 headers = http .HeaderMap()804 headers = httputil.HeaderMap() 805 805 headers__doc = """ 806 806 A dict-like object containing the response headers. Keys are header … … 809 809 headers['content-type'] refer to the same value. Values are header 810 810 values (decoded according to RFC 2047 if necessary). See also: 811 http .HeaderMap, http.HeaderElement."""811 httputil.HeaderMap, httputil.HeaderElement.""" 812 812 813 813 cookie = http.cookies.SimpleCookie() … … 837 837 self.time = time.time() 838 838 839 self.headers = http .HeaderMap()839 self.headers = httputil.HeaderMap() 840 840 # Since we know all our keys are titled strings, we can 841 841 # bypass HeaderMap.update and get a big speed boost. … … 843 843 "Content-Type": 'text/html', 844 844 "Server": "CherryPy/" + cherrypy.__version__, 845 "Date": http .HTTPDate(self.time),845 "Date": httputil.HTTPDate(self.time), 846 846 }) 847 847 self.cookie = http.cookies.SimpleCookie() … … 856 856 """Transform headers (and cookies) into self.header_list. (Core)""" 857 857 try: 858 code, reason, _ = http .valid_status(self.status)858 code, reason, _ = httputil.valid_status(self.status) 859 859 except ValueError as x: 860 860 raise cherrypy.HTTPError(500, x.args[0]) branches/python3/cherrypy/_cptree.py
r2164 r2165 4 4 import cherrypy 5 5 from cherrypy import _cpconfig, _cplogging, _cprequest, _cpwsgi, tools 6 from cherrypy.lib import http as _http6 from cherrypy.lib import httputil 7 7 8 8 … … 211 211 if path is None: 212 212 try: 213 path = _http.urljoin(cherrypy.request.script_name,213 path = httputil.urljoin(cherrypy.request.script_name, 214 214 cherrypy.request.path_info) 215 215 except AttributeError: … … 230 230 # to '' (some WSGI servers always set SCRIPT_NAME to ''). 231 231 # Try to look up the app using the full path. 232 path = _http.urljoin(environ.get('SCRIPT_NAME', ''),232 path = httputil.urljoin(environ.get('SCRIPT_NAME', ''), 233 233 environ.get('PATH_INFO', '')) 234 234 sn = self.script_name(path or "/") branches/python3/cherrypy/_cpwsgi.py
r2158 r2165 6 6 import cherrypy as _cherrypy 7 7 from cherrypy import _cperror 8 from cherrypy.lib import http as _http8 from cherrypy.lib import httputil 9 9 10 10 … … 211 211 """Run self.request and return its response.""" 212 212 meth = self.environ['REQUEST_METHOD'] 213 path = _http.urljoin(self.environ.get('SCRIPT_NAME', ''),213 path = httputil.urljoin(self.environ.get('SCRIPT_NAME', ''), 214 214 self.environ.get('PATH_INFO', '')) 215 215 qs = self.environ.get('QUERY_STRING', '') … … 224 224 env = self.environ.get 225 225 226 local = _http.Host('', int(env('SERVER_PORT', 80)),226 local = httputil.Host('', int(env('SERVER_PORT', 80)), 227 227 env('SERVER_NAME', '')) 228 remote = _http.Host(env('REMOTE_ADDR', ''),228 remote = httputil.Host(env('REMOTE_ADDR', ''), 229 229 int(env('REMOTE_PORT', -1)), 230 230 env('REMOTE_HOST', '')) branches/python3/cherrypy/lib/httputil.py
- Property svn:mergeinfo set

