httpserver: Fix issue with Python 2 if no favicon is set.

This commit is contained in:
Valentin Lorentz 2013-05-31 16:12:49 +02:00
parent cefd91d4f1
commit 9ea1019970

View File

@ -32,6 +32,7 @@ An embedded and centralized HTTP server for Supybot's plugins.
"""
import os
import sys
import cgi
import socket
from threading import Event, Thread
@ -347,7 +348,9 @@ class Favicon(SupyHTTPServerCallback):
self.send_header('Content-type', 'text/plain')
self.send_header('Content-Length', len(response))
self.end_headers()
self.wfile.write(response.encode())
if sys.version_info[0] >= 3:
response = response.encode()
self.wfile.write(response)
http_servers = None