|
39 | 39 | import sys
|
40 | 40 | import os
|
41 | 41 | import re
|
42 |
| -import cgi |
| 42 | +import html |
43 | 43 | import glob
|
44 | 44 | import getopt
|
45 | 45 | import errno
|
@@ -124,8 +124,8 @@ def fixanchor(current, match):
|
124 | 124 | rfcnum = int(match.group('rfcnum'))
|
125 | 125 | link = RFCURL % rfcnum
|
126 | 126 | if link:
|
127 |
| - return '<a href="%s">%s</a>' % (cgi.escape(link), cgi.escape(text)) |
128 |
| - return cgi.escape(match.group(0)) # really slow, but it works... |
| 127 | + return '<a href="%s">%s</a>' % (html.escape(link), html.escape(text)) |
| 128 | + return html.escape(match.group(0)) # really slow, but it works... |
129 | 129 |
|
130 | 130 |
|
131 | 131 | NON_MASKED_EMAILS = [
|
@@ -246,18 +246,18 @@ def fixfile(inpath, input_lines, outfile):
|
246 | 246 | time.localtime(os.stat(inpath)[8]))
|
247 | 247 | try:
|
248 | 248 | url = REPGITURL % int(rep)
|
249 |
| - v = '<a href="%s">%s</a> ' % (url, cgi.escape(date)) |
| 249 | + v = '<a href="%s">%s</a> ' % (url, html.escape(date)) |
250 | 250 | except ValueError as error:
|
251 | 251 | v = date
|
252 | 252 | elif k.lower() in ('content-type',):
|
253 | 253 | url = REPURL % 9
|
254 | 254 | rep_type = v or 'text/plain'
|
255 |
| - v = '<a href="%s">%s</a> ' % (url, cgi.escape(rep_type)) |
| 255 | + v = '<a href="%s">%s</a> ' % (url, html.escape(rep_type)) |
256 | 256 | else:
|
257 |
| - v = cgi.escape(v) |
| 257 | + v = html.escape(v) |
258 | 258 | print((' <tr class="field"><th class="field-name">%s: </th>' +
|
259 | 259 | '<td class="field-body">%s</td></tr>') %
|
260 |
| - (cgi.escape(k), v), file=outfile) |
| 260 | + (html.escape(k), v), file=outfile) |
261 | 261 | print('</table>', file=outfile)
|
262 | 262 | print('</div>', file=outfile)
|
263 | 263 | print('<hr />', file=outfile)
|
|
0 commit comments