How to use the wsgiref.util.guess_scheme function in wsgiref

To help you get started, we’ve selected a few wsgiref examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gevent / gevent / src / greentest / 3.8 / test_wsgiref.py View on Github external
def testGuessScheme(self):
        self.assertEqual(util.guess_scheme({}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
github gevent / gevent / src / greentest / 3.7 / test_wsgiref.py View on Github external
def testGuessScheme(self):
        self.assertEqual(util.guess_scheme({}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
github gevent / gevent / src / greentest / 3.5 / test_wsgiref.py View on Github external
def testGuessScheme(self):
        self.assertEqual(util.guess_scheme({}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
github minixalpha / SourceLearning / wsgiref-0.1.2 / src / test_wsgiref.py View on Github external
def testGuessScheme(self):
        self.assertEqual(util.guess_scheme({}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
github gevent / gevent / greentest / 2.6 / test_wsgiref.py View on Github external
def testGuessScheme(self):
        self.assertEqual(util.guess_scheme({}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
        self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
        self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
github pylover / nanohttp / nanohttp / contexts.py View on Github external
def request_scheme(self):
        """Request Scheme (http|https)
        """
        return wsgiref.util.guess_scheme(self.environ)
github indico / indico / indico / web / wsgi / indico_wsgi_handler.py View on Github external
def is_https(self):
        scheme = self.__environ.get('wsgi.url_scheme', guess_scheme(self.__environ))
        return int(scheme == 'https')
github mgalgs / trackthatthing / google_appengine / google / appengine / ext / webapp / util.py View on Github external
def run_bare_wsgi_app(application):
  """Like run_wsgi_app() but doesn't add WSGI middleware."""
  env = dict(os.environ)
  env["wsgi.input"] = sys.stdin
  env["wsgi.errors"] = sys.stderr
  env["wsgi.version"] = (1, 0)
  env["wsgi.run_once"] = True
  env["wsgi.url_scheme"] = wsgiref.util.guess_scheme(env)
  env["wsgi.multithread"] = False
  env["wsgi.multiprocess"] = False
  result = application(env, _start_response)
  if result is not None:
    for data in result:
      sys.stdout.write(data)
github Khan / frankenserver / python / google / appengine / ext / webapp / util.py View on Github external
def run_bare_wsgi_app(application):
  """Like run_wsgi_app() but doesn't add WSGI middleware."""
  env = dict(os.environ)
  env["wsgi.input"] = sys.stdin
  env["wsgi.errors"] = sys.stderr
  env["wsgi.version"] = (1, 0)
  env["wsgi.run_once"] = True
  env["wsgi.url_scheme"] = wsgiref.util.guess_scheme(env)
  env["wsgi.multithread"] = False
  env["wsgi.multiprocess"] = False
  result = application(env, _start_response)
  try:
    if result is not None:
      for data in result:
        sys.stdout.write(data)
  finally:
    if hasattr(result, 'close'):
      result.close()