Last active
May 13, 2016 03:05
-
-
Save elliottwilliams/5842175465ea746741287265b8b07eae to your computer and use it in GitHub Desktop.
grisha/mod_python #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [('__class__', <type 'mp_request'>), | |
| ('__delattr__', <method-wrapper '__delattr__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__doc__', 'Apache request_rec structure\n'), | |
| ('__format__', <built-in method __format__ of mp_request object at 0x7f3b8ee8e438>), | |
| ('__getattribute__', <method-wrapper '__getattribute__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__hash__', <method-wrapper '__hash__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__init__', <method-wrapper '__init__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__new__', <built-in method __new__ of type object at 0x7f3b9af446a0>), | |
| ('__reduce__', <built-in method __reduce__ of mp_request object at 0x7f3b8ee8e438>), | |
| ('__reduce_ex__', <built-in method __reduce_ex__ of mp_request object at 0x7f3b8ee8e438>), | |
| ('__repr__', <method-wrapper '__repr__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__setattr__', <method-wrapper '__setattr__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__sizeof__', <built-in method __sizeof__ of mp_request object at 0x7f3b8ee8e438>), | |
| ('__str__', <method-wrapper '__str__' of mp_request object at 0x7f3b8ee8e438>), | |
| ('__subclasshook__', <built-in method __subclasshook__ of type object at 0x7f3b9af307e0>), | |
| ('_bytes_queued', 0L), | |
| ('_content_type_set', 0), | |
| ('_request_rec', <capsule object NULL at 0x7f3b8ed84e10>), | |
| ('add_cgi_vars', <built-in method add_cgi_vars of mp_request object at 0x7f3b8ee8e438>), | |
| ('add_common_vars', <built-in method add_common_vars of mp_request object at 0x7f3b8ee8e438>), | |
| ('add_handler', <built-in method add_handler of mp_request object at 0x7f3b8ee8e438>), | |
| ('add_input_filter', <built-in method add_input_filter of mp_request object at 0x7f3b8ee8e438>), | |
| ('add_output_filter', <built-in method add_output_filter of mp_request object at 0x7f3b8ee8e438>), | |
| ('allow_methods', <built-in method allow_methods of mp_request object at 0x7f3b8ee8e438>), | |
| ('allowed', 0), | |
| ('allowed_methods', ()), | |
| ('allowed_xmethods', ()), | |
| ('ap_auth_type', None), | |
| ('args', None), | |
| ('assbackwards', 0), | |
| ('auth_name', <built-in method auth_name of mp_request object at 0x7f3b8ee8e438>), | |
| ('auth_type', <built-in method auth_type of mp_request object at 0x7f3b8ee8e438>), | |
| ('build_wsgi_env', <built-in method build_wsgi_env of mp_request object at 0x7f3b8ee8e438>), | |
| ('bytes_sent', 0L), | |
| ('canonical_filename', '/web/groups/GrouperLabNext/public_html/wsgi/test_wsgi.py'), | |
| ('chunked', 0), | |
| ('clength', 0L), | |
| ('connection', <mp_conn object at 0x7f3b8ed84de0>), | |
| ('construct_url', <built-in method construct_url of mp_request object at 0x7f3b8ee8e438>), | |
| ('content_encoding', None), | |
| ('content_languages', ()), | |
| ('content_type', None), | |
| ('discard_request_body', <built-in method discard_request_body of mp_request object at 0x7f3b8ee8e438>), | |
| ('document_root', <built-in method document_root of mp_request object at 0x7f3b8ee8e438>), | |
| ('eos_sent', 0), | |
| ('err_headers_out', {}), | |
| ('expecting_100', 0), | |
| ('extension', None), | |
| ('filename', '/web/groups/GrouperLabNext/public_html/wsgi/test_wsgi.py'), | |
| ('finfo', {'fname': '/web/groups/GrouperLabNext/public_html/wsgi/test_wsgi.py', 'filetype': 0L, 'valid': None, 'protection': None, 'user': None, 'group': None, 'size': None, 'inode': None, 'device': None, 'nlink': None, 'atime': None, 'mtime': None, 'ctime': None, 'name': None}), | |
| ('flush', <built-in method flush of mp_request object at 0x7f3b8ee8e438>), | |
| ('get_addhandler_exts', <built-in method get_addhandler_exts of mp_request object at 0x7f3b8ee8e438>), | |
| ('get_basic_auth_pw', <built-in method get_basic_auth_pw of mp_request object at 0x7f3b8ee8e438>), | |
| ('get_config', <built-in method get_config of mp_request object at 0x7f3b8ee8e438>), | |
| ('get_options', <built-in method get_options of mp_request object at 0x7f3b8ee8e438>), | |
| ('get_remote_host', <built-in method get_remote_host of mp_request object at 0x7f3b8ee8e438>), | |
| ('handler', 'mod_python'), | |
| ('header_only', 0), | |
| ('headers_in', {'Connection': 'Keep-Alive', 'X-Forwarded-Server': 'engineering.purdue.edu', 'X-Forwarded-Host': 'engineering.purdue.edu', 'X-Forwarded-For': '73.168.228.46', 'Accept': '*/*', 'User-Agent': 'curl/7.43.0', 'Host': 'templeton-private.ecn.purdue.edu:3075'}), | |
| ('headers_out', {'Content-Type': 'text/html'}), | |
| ('hlist', {'handler':'mod_python.wsgi','directory':'/web/groups/GrouperLabNext/public_html/wsgi/','is_location':False,'silent':0}), | |
| ('hostname', 'templeton-private.ecn.purdue.edu'), | |
| ('internal_redirect', <built-in method internal_redirect of mp_request object at 0x7f3b8ee8e438>), | |
| ('interpreter', 'Engineering.Purdue.Edu'), | |
| ('is_https', <built-in method is_https of mp_request object at 0x7f3b8ee8e438>), | |
| ('log_error', <built-in method log_error of mp_request object at 0x7f3b8ee8e438>), | |
| ('main', None), | |
| ('meets_conditions', <built-in method meets_conditions of mp_request object at 0x7f3b8ee8e438>), | |
| ('method', 'GET'), | |
| ('method_number', 0), | |
| ('mtime', 0.0), | |
| ('next', None), | |
| ('no_cache', 0), | |
| ('no_local_copy', 0), | |
| ('notes', {'python_init_ran': '1'}), | |
| ('parsed_uri', (None, None, None, None, None, 3075L, '/GrouperLabNext/wsgi/test_wsgi.py', None, None)), | |
| ('path_info', '/test_wsgi.py'), | |
| ('phase', 'PythonHandler'), | |
| ('prev', <mp_request object at 0x7f3b8ee8e690>), | |
| ('proto_num', 1001), | |
| ('protocol', 'HTTP/1.1'), | |
| ('proxyreq', 0), | |
| ('range', None), | |
| ('read', <built-in method read of mp_request object at 0x7f3b8ee8e438>), | |
| ('read_body', 0), | |
| ('read_chunked', 0), | |
| ('read_length', 0L), | |
| ('readline', <built-in method readline of mp_request object at 0x7f3b8ee8e438>), | |
| ('readlines', <built-in method readlines of mp_request object at 0x7f3b8ee8e438>), | |
| ('register_cleanup', <built-in method register_cleanup of mp_request object at 0x7f3b8ee8e438>), | |
| ('register_input_filter', <built-in method register_input_filter of mp_request object at 0x7f3b8ee8e438>), | |
| ('register_output_filter', <built-in method register_output_filter of mp_request object at 0x7f3b8ee8e438>), | |
| ('remaining', 0L), | |
| ('request_time', 1463087020.809285), | |
| ('requires', <built-in method requires of mp_request object at 0x7f3b8ee8e438>), | |
| ('send_http_header', <built-in method send_http_header of mp_request object at 0x7f3b8ee8e438>), | |
| ('sendfile', <built-in method sendfile of mp_request object at 0x7f3b8ee8e438>), | |
| ('sent_bodyct', 0L), | |
| ('server', <mp_server object at 0x7f3b8edfbeb8>), | |
| ('set_content_length', <built-in method set_content_length of mp_request object at 0x7f3b8ee8e438>), | |
| ('set_etag', <built-in method set_etag of mp_request object at 0x7f3b8ee8e438>), | |
| ('set_last_modified', <built-in method set_last_modified of mp_request object at 0x7f3b8ee8e438>), | |
| ('ssl_var_lookup', <built-in method ssl_var_lookup of mp_request object at 0x7f3b8ee8e438>), | |
| ('status', 200), | |
| ('status_line', '201 Created'), | |
| ('subprocess_env', {'REDIRECT_URL': '/GrouperLabNext/test_wsgi.py', 'REMOTE_PORT': '56665', 'SCRIPT_FILENAME': '/web/groups/GrouperLabNext/public_html/wsgi/test_wsgi.py', 'SERVER_ADMIN': 'webmaster@ecn.purdue.edu', 'DOCUMENT_ROOT': '/web/groups', 'REMOTE_ADDR': '192.168.1.11', 'SERVER_PORT': '443', 'SERVER_ADDR': '128.46.104.5', 'SERVER_NAME': 'Engineering.Purdue.Edu', 'SERVER_SOFTWARE': 'Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_python/3.5.0- Python/2.7.7', 'SERVER_SIGNATURE': '', 'PATH': '/usr/local/bin:/bin:/usr/bin', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_X_FORWARDED_SERVER': 'engineering.purdue.edu', 'HTTP_X_FORWARDED_HOST': 'engineering.purdue.edu', 'HTTP_X_FORWARDED_FOR': '73.168.228.46', 'HTTP_ACCEPT': '*/*', 'HTTP_USER_AGENT': 'curl/7.43.0', 'HTTP_HOST': 'Engineering.Purdue.Edu', 'PATH_INFO': '/test_wsgi.py', 'SCRIPT_NAME': '/GrouperLabNext/wsgi', 'REQUEST_URI': '/GrouperLabNext/wsgi/test_wsgi.py', 'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'SERVER_PROTOCOL': 'HTTP/1.1', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_SSL': 'on', 'REDIRECT_STATUS': '200', 'REDIRECT_HTTP_SSL': 'on', 'REDIRECT_ECN-Override-SERVER_PORT': '443', 'REDIRECT_ECN-Override-SERVER_ADDR': '128.46.104.5', 'REDIRECT_ECN-Override-SERVER_NAME': 'Engineering.Purdue.Edu', 'REDIRECT_ECN-Override-HTTP_HOST': 'Engineering.Purdue.Edu'}), | |
| ('the_request', 'GET /GrouperLabNext/test_wsgi.py HTTP/1.1'), | |
| ('unparsed_uri', '/GrouperLabNext/wsgi/test_wsgi.py'), | |
| ('update_mtime', <built-in method update_mtime of mp_request object at 0x7f3b8ee8e438>), | |
| ('uri', '/GrouperLabNext/wsgi/test_wsgi.py'), | |
| ('used_path_info', 2), | |
| ('user', None), | |
| ('vlist_validator', None), | |
| ('write', <built-in method write of mp_request object at 0x7f3b8ee8e438>), | |
| ('wsgi_start_response', <built-in method wsgi_start_response of mp_request object at 0x7f3b8ee8e438>)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cgi import parse_qs, escape | |
| import inspect | |
| def application(environ, start_response): | |
| parameters = parse_qs(environ.get('QUERY_STRING', '')) | |
| if 'subject' in parameters: | |
| subject = escape(parameters['subject'][0]) | |
| else: | |
| subject = 'World' | |
| res = start_response('201 Created', [('Content-Type', 'text/html'), ('Location', 'https://google.com')]) | |
| res.__self__.status = 201 | |
| return str(res.__self__.headers_out) | |
| #return '<html><body>yo</body></html>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment