Commit 6a8e5a8d authored by Sébastien Helleu's avatar Sébastien Helleu

urlserver.py 2.2: fix write on socket with python 3.x

parent e420523f
......@@ -44,6 +44,8 @@
#
# History:
#
# 2017-07-26, Sébastien Helleu <flashcode@flashtux.org>:
# v2.2: fix write on socket with python 3.x
# 2016-11-01, Sébastien Helleu <flashcode@flashtux.org>:
# v2.1: add option "msg_filtered"
# 2016-01-20, Yves Stadler <yves.stadler@gmail.com>:
......@@ -110,7 +112,7 @@
SCRIPT_NAME = 'urlserver'
SCRIPT_AUTHOR = 'Sébastien Helleu <flashcode@flashtux.org>'
SCRIPT_VERSION = '2.1'
SCRIPT_VERSION = '2.2'
SCRIPT_LICENSE = 'GPL3'
SCRIPT_DESC = 'Shorten URLs with own HTTP server'
......@@ -645,9 +647,11 @@ def urlserver_server_fd_cb(data, fd):
'<meta http-equiv="refresh" content="0; '
'url=%s">' % urlserver['urls'][number][3])
else:
conn.sendall('HTTP/1.1 302\r\n'
'Location: %s\r\n\r\n' %
urlserver['urls'][number][3])
conn.sendall(
'HTTP/1.1 302\r\n'
'Location: {}\r\n\r\n'
.format(urlserver['urls'][number][3])
.encode('utf-8'))
else:
urlserver_server_reply_auth_required(conn)
replysent = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment