(self, environ)
| 55 | |
| 56 | class WSGIRequest(HttpRequest): |
| 57 | def __init__(self, environ): |
| 58 | script_name = get_script_name(environ) |
| 59 | # If PATH_INFO is empty (e.g. accessing the SCRIPT_NAME URL without a |
| 60 | # trailing slash), operate as if '/' was requested. |
| 61 | path_info = get_path_info(environ) or "/" |
| 62 | self.environ = environ |
| 63 | self.path_info = path_info |
| 64 | # be careful to only replace the first slash in the path because of |
| 65 | # http://test/something and http://test//something being different as |
| 66 | # stated in RFC 3986. |
| 67 | self.path = "%s/%s" % (script_name.rstrip("/"), path_info.replace("/", "", 1)) |
| 68 | self.META = environ |
| 69 | self.META["PATH_INFO"] = path_info |
| 70 | self.META["SCRIPT_NAME"] = script_name |
| 71 | self.method = environ["REQUEST_METHOD"].upper() |
| 72 | # Set content_type, content_params, and encoding. |
| 73 | self._set_content_type_params(environ) |
| 74 | try: |
| 75 | content_length = int(environ.get("CONTENT_LENGTH")) |
| 76 | except (ValueError, TypeError): |
| 77 | content_length = 0 |
| 78 | self._stream = LimitedStream(self.environ["wsgi.input"], content_length) |
| 79 | self._read_started = False |
| 80 | self.resolver_match = None |
| 81 | |
| 82 | def _get_scheme(self): |
| 83 | return self.environ.get("wsgi.url_scheme") |
no test coverage detected