Bump cherrypy from 18.6.1 to 18.8.0 (#1796)

* Bump cherrypy from 18.6.1 to 18.8.0

Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.6.1 to 18.8.0.
- [Release notes](https://github.com/cherrypy/cherrypy/releases)
- [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst)
- [Commits](https://github.com/cherrypy/cherrypy/compare/v18.6.1...v18.8.0)

---
updated-dependencies:
- dependency-name: cherrypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update cherrypy==18.8.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2022-11-12 17:53:03 -08:00 committed by GitHub
commit 76cc56a215
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 19150 additions and 1339 deletions

View file

@ -505,7 +505,8 @@ server.ssl_private_key: r'%s'
def get_pid(self):
if self.daemonize:
return int(open(self.pid_file, 'rb').read())
with open(self.pid_file, 'rb') as f:
return int(f.read())
return self._proc.pid
def join(self):

View file

@ -97,7 +97,8 @@ class LogCase(object):
def emptyLog(self):
"""Overwrite self.logfile with 0 bytes."""
open(self.logfile, 'wb').write('')
with open(self.logfile, 'wb') as f:
f.write('')
def markLog(self, key=None):
"""Insert a marker line into the log and set self.lastmarker."""
@ -105,10 +106,11 @@ class LogCase(object):
key = str(time.time())
self.lastmarker = key
open(self.logfile, 'ab+').write(
b'%s%s\n'
% (self.markerPrefix, key.encode('utf-8'))
)
with open(self.logfile, 'ab+') as f:
f.write(
b'%s%s\n'
% (self.markerPrefix, key.encode('utf-8'))
)
def _read_marked_region(self, marker=None):
"""Return lines from self.logfile in the marked region.
@ -122,20 +124,23 @@ class LogCase(object):
logfile = self.logfile
marker = marker or self.lastmarker
if marker is None:
return open(logfile, 'rb').readlines()
with open(logfile, 'rb') as f:
return f.readlines()
if isinstance(marker, str):
marker = marker.encode('utf-8')
data = []
in_region = False
for line in open(logfile, 'rb'):
if in_region:
if line.startswith(self.markerPrefix) and marker not in line:
break
else:
data.append(line)
elif marker in line:
in_region = True
with open(logfile, 'rb') as f:
for line in f:
if in_region:
if (line.startswith(self.markerPrefix)
and marker not in line):
break
else:
data.append(line)
elif marker in line:
in_region = True
return data
def assertInLog(self, line, marker=None):

View file

@ -14,7 +14,7 @@ KNOWN BUGS
1. Apache processes Range headers automatically; CherryPy's truncated
output is then truncated again by Apache. See test_core.testRanges.
This was worked around in http://www.cherrypy.org/changeset/1319.
This was worked around in http://www.cherrypy.dev/changeset/1319.
2. Apache does not allow custom HTTP methods like CONNECT as per the spec.
See test_core.testHTTPMethods.
3. Max request header and body settings do not work with Apache.
@ -112,15 +112,12 @@ class ModFCGISupervisor(helper.LocalWSGISupervisor):
fcgiconf = os.path.join(curdir, fcgiconf)
# Write the Apache conf file.
f = open(fcgiconf, 'wb')
try:
with open(fcgiconf, 'wb') as f:
server = repr(os.path.join(curdir, 'fastcgi.pyc'))[1:-1]
output = self.template % {'port': self.port, 'root': curdir,
'server': server}
output = output.replace('\r\n', '\n')
f.write(output)
finally:
f.close()
result = read_process(APACHE_PATH, '-k start -f %s' % fcgiconf)
if result:

View file

@ -14,7 +14,7 @@ KNOWN BUGS
1. Apache processes Range headers automatically; CherryPy's truncated
output is then truncated again by Apache. See test_core.testRanges.
This was worked around in http://www.cherrypy.org/changeset/1319.
This was worked around in http://www.cherrypy.dev/changeset/1319.
2. Apache does not allow custom HTTP methods like CONNECT as per the spec.
See test_core.testHTTPMethods.
3. Max request header and body settings do not work with Apache.
@ -101,15 +101,12 @@ class ModFCGISupervisor(helper.LocalSupervisor):
fcgiconf = os.path.join(curdir, fcgiconf)
# Write the Apache conf file.
f = open(fcgiconf, 'wb')
try:
with open(fcgiconf, 'wb') as f:
server = repr(os.path.join(curdir, 'fastcgi.pyc'))[1:-1]
output = self.template % {'port': self.port, 'root': curdir,
'server': server}
output = ntob(output.replace('\r\n', '\n'))
f.write(output)
finally:
f.close()
result = read_process(APACHE_PATH, '-k start -f %s' % fcgiconf)
if result:

View file

@ -15,7 +15,7 @@ KNOWN BUGS
1. Apache processes Range headers automatically; CherryPy's truncated
output is then truncated again by Apache. See test_core.testRanges.
This was worked around in http://www.cherrypy.org/changeset/1319.
This was worked around in http://www.cherrypy.dev/changeset/1319.
2. Apache does not allow custom HTTP methods like CONNECT as per the spec.
See test_core.testHTTPMethods.
3. Max request header and body settings do not work with Apache.
@ -107,13 +107,10 @@ class ModPythonSupervisor(helper.Supervisor):
if not os.path.isabs(mpconf):
mpconf = os.path.join(curdir, mpconf)
f = open(mpconf, 'wb')
try:
with open(mpconf, 'wb') as f:
f.write(self.template %
{'port': self.port, 'modulename': modulename,
'host': self.host})
finally:
f.close()
result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
if result:

View file

@ -11,7 +11,7 @@ KNOWN BUGS
1. Apache processes Range headers automatically; CherryPy's truncated
output is then truncated again by Apache. See test_core.testRanges.
This was worked around in http://www.cherrypy.org/changeset/1319.
This was worked around in http://www.cherrypy.dev/changeset/1319.
2. Apache does not allow custom HTTP methods like CONNECT as per the spec.
See test_core.testHTTPMethods.
3. Max request header and body settings do not work with Apache.
@ -109,14 +109,11 @@ class ModWSGISupervisor(helper.Supervisor):
if not os.path.isabs(mpconf):
mpconf = os.path.join(curdir, mpconf)
f = open(mpconf, 'wb')
try:
with open(mpconf, 'wb') as f:
output = (self.template %
{'port': self.port, 'testmod': modulename,
'curdir': curdir})
f.write(output)
finally:
f.close()
result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
if result:

View file

@ -1,4 +1,4 @@
# This file is part of CherryPy <http://www.cherrypy.org/>
# This file is part of CherryPy <http://www.cherrypy.dev/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8

View file

@ -1,4 +1,4 @@
# This file is part of CherryPy <http://www.cherrypy.org/>
# This file is part of CherryPy <http://www.cherrypy.dev/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8

View file

@ -586,9 +586,8 @@ class CoreRequestHandlingTest(helper.CPWebCase):
def testFavicon(self):
# favicon.ico is served by staticfile.
icofilename = os.path.join(localDir, '../favicon.ico')
icofile = open(icofilename, 'rb')
data = icofile.read()
icofile.close()
with open(icofilename, 'rb') as icofile:
data = icofile.read()
self.getPage('/favicon.ico')
self.assertBody(data)

View file

@ -46,7 +46,7 @@ class EncodingTests(helper.CPWebCase):
# any part which is unicode (even ascii), the response
# should not fail.
cherrypy.response.cookie['candy'] = 'bar'
cherrypy.response.cookie['candy']['domain'] = 'cherrypy.org'
cherrypy.response.cookie['candy']['domain'] = 'cherrypy.dev'
cherrypy.response.headers[
'Some-Header'] = 'My d\xc3\xb6g has fleas'
cherrypy.response.headers[

View file

@ -113,7 +113,7 @@ def test_normal_return(log_tracker, server):
resp = requests.get(
'http://%s:%s/as_string' % (host, port),
headers={
'Referer': 'http://www.cherrypy.org/',
'Referer': 'http://www.cherrypy.dev/',
'User-Agent': 'Mozilla/5.0',
},
)
@ -135,7 +135,7 @@ def test_normal_return(log_tracker, server):
log_tracker.assertLog(
-1,
'] "GET /as_string HTTP/1.1" 200 %s '
'"http://www.cherrypy.org/" "Mozilla/5.0"'
'"http://www.cherrypy.dev/" "Mozilla/5.0"'
% content_length,
)

View file

@ -342,7 +342,7 @@ class RequestObjectTests(helper.CPWebCase):
self.assertBody('/pathinfo/foo/bar')
def testAbsoluteURIPathInfo(self):
# http://cherrypy.org/ticket/1061
# http://cherrypy.dev/ticket/1061
self.getPage('http://localhost/pathinfo/foo/bar')
self.assertBody('/pathinfo/foo/bar')
@ -375,10 +375,10 @@ class RequestObjectTests(helper.CPWebCase):
# Make sure that encoded = and & get parsed correctly
self.getPage(
'/params/code?url=http%3A//cherrypy.org/index%3Fa%3D1%26b%3D2')
'/params/code?url=http%3A//cherrypy.dev/index%3Fa%3D1%26b%3D2')
self.assertBody('args: %s kwargs: %s' %
(('code',),
[('url', ntou('http://cherrypy.org/index?a=1&b=2'))]))
[('url', ntou('http://cherrypy.dev/index?a=1&b=2'))]))
# Test coordinates sent by <img ismap>
self.getPage('/params/ismap?223,114')
@ -756,6 +756,16 @@ class RequestObjectTests(helper.CPWebCase):
headers=[('Content-type', 'application/json')])
self.assertBody('application/json')
def test_dangerous_host(self):
"""
Dangerous characters like newlines should be elided.
Ref #1974.
"""
# foo\nbar
encoded = '=?iso-8859-1?q?foo=0Abar?='
self.getPage('/headers/Host', headers=[('Host', encoded)])
self.assertBody('foobar')
def test_basic_HTTPMethods(self):
helper.webtest.methods_with_bodies = ('POST', 'PUT', 'PROPFIND',
'PATCH')

View file

@ -424,11 +424,12 @@ test_case_name: "test_signal_handler_unsubscribe"
p.join()
# Assert the old handler ran.
log_lines = list(open(p.error_log, 'rb'))
assert any(
line.endswith(b'I am an old SIGTERM handler.\n')
for line in log_lines
)
with open(p.error_log, 'rb') as f:
log_lines = list(f)
assert any(
line.endswith(b'I am an old SIGTERM handler.\n')
for line in log_lines
)
def test_safe_wait_INADDR_ANY(): # pylint: disable=invalid-name

View file

@ -78,7 +78,7 @@ class TutorialTest(helper.CPWebCase):
<ul>
<li><a href="http://del.icio.us">del.icio.us</a></li>
<li><a href="http://www.cherrypy.org">CherryPy</a></li>
<li><a href="http://www.cherrypy.dev">CherryPy</a></li>
</ul>
<p>[<a href="../">Return to links page</a>]</p>'''
@ -166,7 +166,7 @@ class TutorialTest(helper.CPWebCase):
self.assertHeader('Content-Disposition',
# Make sure the filename is quoted.
'attachment; filename="pdf_file.pdf"')
self.assertEqual(len(self.body), 85698)
self.assertEqual(len(self.body), 11961)
def test10HTTPErrors(self):
self.setup_tutorial('tut10_http_errors', 'HTTPErrorDemo')