@@ -106,21 +106,21 @@ def handle_static(environ, start_response, path):
106106 :return: wsgi response for the static file.
107107 """
108108 try :
109- text = open (path ).read ()
109+ data = open (path , 'rb' ).read ()
110110 if path .endswith (".ico" ):
111- resp = Response (text , headers = [('Content-Type' , "image/x-icon" )])
111+ resp = Response (data , headers = [('Content-Type' , "image/x-icon" )])
112112 elif path .endswith (".html" ):
113- resp = Response (text , headers = [('Content-Type' , 'text/html' )])
113+ resp = Response (data , headers = [('Content-Type' , 'text/html' )])
114114 elif path .endswith (".txt" ):
115- resp = Response (text , headers = [('Content-Type' , 'text/plain' )])
115+ resp = Response (data , headers = [('Content-Type' , 'text/plain' )])
116116 elif path .endswith (".css" ):
117- resp = Response (text , headers = [('Content-Type' , 'text/css' )])
117+ resp = Response (data , headers = [('Content-Type' , 'text/css' )])
118118 elif path .endswith (".js" ):
119- resp = Response (text , headers = [('Content-Type' , 'text/javascript' )])
119+ resp = Response (data , headers = [('Content-Type' , 'text/javascript' )])
120120 elif path .endswith (".png" ):
121- resp = Response (text , headers = [('Content-Type' , 'image/png' )])
121+ resp = Response (data , headers = [('Content-Type' , 'image/png' )])
122122 else :
123- resp = Response (text )
123+ resp = Response (data )
124124 except IOError :
125125 resp = NotFound ()
126126 return resp (environ , start_response )
0 commit comments