Skip to content

Commit 0b1da5a

Browse files
author
Roland Hedberg
committed
Merge pull request #291 from rebeckag/example_sp_cookie_fix
Only use six and make sure the cookie can be read.
2 parents 8036710 + f8cea46 commit 0b1da5a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

example/sp-wsgi/sp.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import re
55
import argparse
66
import os
7-
try:
8-
from future.backports.http.cookies import SimpleCookie
9-
except:
10-
from Cookie import SimpleCookie
7+
8+
from six.moves.http_cookies import SimpleCookie
119
import six
1210

1311
from saml2.extension.pefim import SPCertEnc
@@ -172,7 +170,6 @@ def __init__(self):
172170

173171
def get_user(self, environ):
174172
cookie = environ.get("HTTP_COOKIE", '')
175-
cookie = cookie.decode("UTF-8")
176173
logger.debug("Cookie: %s", cookie)
177174
if cookie:
178175
cookie_obj = SimpleCookie(cookie)
@@ -847,7 +844,6 @@ def application(environ, start_response):
847844

848845
if __name__ == '__main__':
849846
from cherrypy import wsgiserver
850-
from cherrypy.wsgiserver import ssl_pyopenssl
851847

852848
_parser = argparse.ArgumentParser()
853849
_parser.add_argument('-d', dest='debug', action='store_true',
@@ -907,6 +903,7 @@ def application(environ, start_response):
907903

908904
_https = ""
909905
if service_conf.HTTPS:
906+
from cherrypy.wsgiserver import ssl_pyopenssl
910907
SRV.ssl_adapter = ssl_pyopenssl.pyOpenSSLAdapter(SERVER_CERT,
911908
SERVER_KEY, CERT_CHAIN)
912909
_https = " using SSL/TLS"

0 commit comments

Comments
 (0)