• Home
  • Raw
  • Download

Lines Matching refs:environ

42 def guess_scheme(environ):  argument
45 if environ.get("HTTPS") in ('yes','on','1'):
50 def application_uri(environ): argument
52 url = environ['wsgi.url_scheme']+'://'
55 if environ.get('HTTP_HOST'):
56 url += environ['HTTP_HOST']
58 url += environ['SERVER_NAME']
60 if environ['wsgi.url_scheme'] == 'https':
61 if environ['SERVER_PORT'] != '443':
62 url += ':' + environ['SERVER_PORT']
64 if environ['SERVER_PORT'] != '80':
65 url += ':' + environ['SERVER_PORT']
67 url += quote(environ.get('SCRIPT_NAME') or '/', encoding='latin1')
70 def request_uri(environ, include_query=True): argument
72 url = application_uri(environ)
74 path_info = quote(environ.get('PATH_INFO',''), safe='/;=,', encoding='latin1')
75 if not environ.get('SCRIPT_NAME'):
79 if include_query and environ.get('QUERY_STRING'):
80 url += '?' + environ['QUERY_STRING']
83 def shift_path_info(environ): argument
96 path_info = environ.get('PATH_INFO','')
105 script_name = environ.get('SCRIPT_NAME','')
112 environ['SCRIPT_NAME'] = script_name
113 environ['PATH_INFO'] = '/'.join(path_parts)
124 def setup_testing_defaults(environ): argument
137 environ.setdefault('SERVER_NAME','127.0.0.1')
138 environ.setdefault('SERVER_PROTOCOL','HTTP/1.0')
140 environ.setdefault('HTTP_HOST',environ['SERVER_NAME'])
141 environ.setdefault('REQUEST_METHOD','GET')
143 if 'SCRIPT_NAME' not in environ and 'PATH_INFO' not in environ:
144 environ.setdefault('SCRIPT_NAME','')
145 environ.setdefault('PATH_INFO','/')
147 environ.setdefault('wsgi.version', (1,0))
148 environ.setdefault('wsgi.run_once', 0)
149 environ.setdefault('wsgi.multithread', 0)
150 environ.setdefault('wsgi.multiprocess', 0)
153 environ.setdefault('wsgi.input', BytesIO())
154 environ.setdefault('wsgi.errors', StringIO())
155 environ.setdefault('wsgi.url_scheme',guess_scheme(environ))
157 if environ['wsgi.url_scheme']=='http':
158 environ.setdefault('SERVER_PORT', '80')
159 elif environ['wsgi.url_scheme']=='https':
160 environ.setdefault('SERVER_PORT', '443')