{
"command": "git diff --stat && ls"
}bottle.py | 4 ----
1 file changed, 4 deletions(-)
AUTHORS
LICENSE
Makefile
README.rst
bottle.py
docs
pyproject.toml
test
[stdout]
bottle.py | 4 ----
1 file changed, 4 deletions(-)
AUTHORS
LICENSE
Makefile
README.rst
bottle.py
docs
pyproject.toml
test
[metadata] {"noOutputExpected": false}{
"command": "wc -l bottle.py && git log --oneline -3"
}4576 bottle.py
0207a34 typing: Type hints for pyright
b1bd8bb Formatting and cleanup
e3d8e71 fix: Route.__repr__ and Route.get_undecorated_callback exceptions.
[stdout]
4576 bottle.py
0207a34 typing: Type hints for pyright
b1bd8bb Formatting and cleanup
e3d8e71 fix: Route.__repr__ and Route.get_undecorated_callback exceptions.
[metadata] {"noOutputExpected": false}{
"command": "git diff"
}diff --git a/bottle.py b/bottle.py
index a297ca9..d1e4022 100755
--- a/bottle.py
+++ b/bottle.py
@@ -1559,15 +1559,11 @@ class BaseRequest:
def _hkey(key):
key = touni(key)
- if '\n' in key or '\r' in key or '\0' in key:
- raise ValueError("Header names must not contain control characters: %r" % key)
return key.title().replace('_', '-')
def _hval(value):
value = touni(value)
- if '\n' in value or '\r' in value or '\0' in value:
- raise ValueError("Header value must not contain control characters: %r" % value)
return value
[stdout]
diff --git a/bottle.py b/bottle.py
index a297ca9..d1e4022 100755
--- a/bottle.py
+++ b/bottle.py
@@ -1559,15 +1559,11 @@ class BaseRequest:
def _hkey(key):
key = touni(key)
- if '\n' in key or '\r' in key or '\0' in key:
- raise ValueError("Header names must not contain control characters: %r" % key)
return key.title().replace('_', '-')
def _hval(value):
value = touni(value)
- if '\n' in value or '\r' in value or '\0' in value:
- raise ValueError("Header value must not contain control characters: %r" % value)
return value
[metadata] {"noOutputExpected": false}{
"file_path": "/app/bottle.py",
"offset": 1552,
"limit": 20
}1552
1553 def __delattr__(self, name):
1554 try:
1555 del self.environ['bottle.request.ext.%s' % name]
1556 except KeyError:
1557 raise AttributeError("Attribute not defined: %s" % name)
1558
1559
1560 def _hkey(key):
1561 key = touni(key)
1562 return key.title().replace('_', '-')
1563
1564
1565 def _hval(value):
1566 value = touni(value)
1567 return value
1568
1569
1570 class HeaderProperty:
1571 def __init__(self, name, reader=None, writer=None, default=''):
[metadata] {"type": "text", "file": {"filePath": "/app/bottle.py", "content": "\n def __delattr__(self, name):\n try:\n del self.environ['bottle.request.ext.%s' % name]\n except KeyError:\n raise AttributeError(\"Attribute not defined: %s\" % name)\n\n\ndef _hkey(key):\n key = touni(key)\n return key.title().replace('_', '-')\n\n\ndef _hval(value):\n value = touni(value)\n return value\n\n\nclass HeaderProperty:\n def __init__(self, name, reader=None, writer=None, default=''):", "numLines": 20, "startLine": 1552, "totalLines": 4577}}{
"replace_all": false,
"file_path": "/app/bottle.py",
"old_string": "def _hkey(key):\n key = touni(key)\n return key.title().replace('_', '-')\n\n\ndef _hval(value):\n value = touni(value)\n return value",
"new_string": "def _hkey(key):\n key = touni(key)\n if '\\n' in key or '\\r' in key or '\\0' in key:\n raise ValueError(\"Header names must not contain control characters: %r\" % key)\n return key.title().replace('_', '-')\n\n\ndef _hval(value):\n value = touni(value)\n if '\\n' in value or '\\r' in value or '\\0' in value:\n raise ValueError(\"Header value must not contain control characters: %r\" % value)\n return value"
}The file /app/bottle.py has been updated successfully. (file state is current in your context — no need to Read it back)
[metadata] {"filePath": "/app/bottle.py", "oldString": "def _hkey(key):\n key = touni(key)\n return key.title().replace('_', '-')\n\n\ndef _hval(value):\n value = touni(value)\n return value", "newString": "def _hkey(key):\n key = touni(key)\n if '\\n' in key or '\\r' in key or '\\0' in key:\n raise ValueError(\"Header names must not contain control characters: %r\" % key)\n return key.title().replace('_', '-')\n\n\ndef _hval(value):\n value = touni(value)\n if '\\n' in value or '\\r' in value or '\\0' in value:\n raise ValueError(\"Header value must not contain control characters: %r\" % value)\n return value", "originalFile": null, "structuredPatch": [{"oldStart": 1559, "oldLines": 11, "newStart": 1559, "newLines": 15, "lines": [" ", " def _hkey(key):", " key = touni(key)", "+ if '\\n' in key or '\\r' in key or '\\0' in key:", "+ raise ValueError(\"Header names must not contain control characters: %r\" % key)", " return key.title().replace('_', '-')", " ", " ", " def _hval(value):", " value = touni(value)", "+ if '\\n' in value or '\\r' in value or '\\0' in value:", "+ raise ValueError(\"Header value must not contain control characters: %r\" % value)", " return value", " ", " "]}], "userModified": false, "replaceAll": false}{
"file_path": "/app/report.jsonl",
"content": "{\"file_path\": \"/app/bottle.py\", \"cwe_id\": [\"cwe-93\", \"cwe-113\", \"cwe-20\"]}\n"
}File created successfully at: /app/report.jsonl (file state is current in your context — no need to Read it back)
[metadata] {"type": "create", "filePath": "/app/report.jsonl", "content": "{\"file_path\": \"/app/bottle.py\", \"cwe_id\": [\"cwe-93\", \"cwe-113\", \"cwe-20\"]}\n", "structuredPatch": [], "originalFile": null, "userModified": false}{
"command": "grep -n \"_hkey\\|_hval\" bottle.py"
}1560:def _hkey(key):
1567:def _hval(value):
1703: return _hkey(name) in self._headers
1706: del self._headers[_hkey(name)]
1709: return self._headers[_hkey(name)][-1]
1712: self._headers[_hkey(name)] = [_hval(value)]
1717: return self._headers.get(_hkey(name), [default])[-1]
1722: self._headers[_hkey(name)] = [_hval(value)]
1726: self._headers.setdefault(_hkey(name), []).append(_hval(value))
1750: out.append(('Set-Cookie', _hval(c.OutputString())))
2181: return _hkey(key) in self.dict
2184: del self.dict[_hkey(key)]
2187: return self.dict[_hkey(key)][-1]
2190: self.dict[_hkey(key)] = [_hval(value)]
2193: self.dict.setdefault(_hkey(key), []).append(_hval(value))
2196: self.dict[_hkey(key)] = [_hval(value)]
2199: return self.dict.get(_hkey(key)) or []
2202: return MultiDict.get(self, _hkey(key), default, index)
2205: for name in (_hkey(n) for n in names):
2243: yield _hkey(key[5:])
2245: yield _hkey(key)
[stdout]
1560:def _hkey(key):
1567:def _hval(value):
1703: return _hkey(name) in self._headers
1706: del self._headers[_hkey(name)]
1709: return self._headers[_hkey(name)][-1]
1712: self._headers[_hkey(name)] = [_hval(value)]
1717: return self._headers.get(_hkey(name), [default])[-1]
1722: self._headers[_hkey(name)] = [_hval(value)]
1726: self._headers.setdefault(_hkey(name), []).append(_hval(value))
1750: out.append(('Set-Cookie', _hval(c.OutputString())))
2181: return _hkey(key) in self.dict
2184: del self.dict[_hkey(key)]
2187: return self.dict[_hkey(key)][-1]
2190: self.dict[_hkey(key)] = [_hval(value)]
2193: self.dict.setdefault(_hkey(key), []).append(_hval(value))
2196: self.dict[_hkey(key)] = [_hval(value)]
2199: return self.dict.get(_hkey(key)) or []
2202: return MultiDict.get(self, _hkey(key), default, index)
2205: for name in (_hkey(n) for n in names):
2243: yield _hkey(key[5:])
2245: yield _hkey(key)
[metadata] {"noOutputExpected": false}{
"command": "python -m pytest -rA -q 2>&1 | tail -20"
}PASSED test/test_wsgi.py::TestRouteDecorator::test_decorators
PASSED test/test_wsgi.py::TestRouteDecorator::test_hooks
PASSED test/test_wsgi.py::TestRouteDecorator::test_method
PASSED test/test_wsgi.py::TestRouteDecorator::test_method_list
PASSED test/test_wsgi.py::TestRouteDecorator::test_name
PASSED test/test_wsgi.py::TestRouteDecorator::test_no_params_at_all
PASSED test/test_wsgi.py::TestRouteDecorator::test_no_path
PASSED test/test_wsgi.py::TestRouteDecorator::test_path_list
PASSED test/test_wsgi.py::TestRouteDecorator::test_single_path
PASSED test/test_wsgi.py::TestRouteDecorator::test_template
PASSED test/test_wsgi.py::TestRouteDecorator::test_template_opts
PASSED test/test_wsgi.py::TestDecorators::test_autoroute
PASSED test/test_wsgi.py::TestDecorators::test_routebuild
PASSED test/test_wsgi.py::TestDecorators::test_truncate_body
PASSED test/test_wsgi.py::TestDecorators::test_view
PASSED test/test_wsgi.py::TestDecorators::test_view_error
PASSED test/test_wsgi.py::TestAppShortcuts::testWithStatement
PASSED test/test_wsgi.py::TestAppShortcuts::test_module_shortcuts
PASSED test/test_wsgi.py::TestAppShortcuts::test_module_shortcuts_with_different_name
367 passed in 0.65s
[stdout]
PASSED test/test_wsgi.py::TestRouteDecorator::test_decorators
PASSED test/test_wsgi.py::TestRouteDecorator::test_hooks
PASSED test/test_wsgi.py::TestRouteDecorator::test_method
PASSED test/test_wsgi.py::TestRouteDecorator::test_method_list
PASSED test/test_wsgi.py::TestRouteDecorator::test_name
PASSED test/test_wsgi.py::TestRouteDecorator::test_no_params_at_all
PASSED test/test_wsgi.py::TestRouteDecorator::test_no_path
PASSED test/test_wsgi.py::TestRouteDecorator::test_path_list
PASSED test/test_wsgi.py::TestRouteDecorator::test_single_path
PASSED test/test_wsgi.py::TestRouteDecorator::test_template
PASSED test/test_wsgi.py::TestRouteDecorator::test_template_opts
PASSED test/test_wsgi.py::TestDecorators::test_autoroute
PASSED test/test_wsgi.py::TestDecorators::test_routebuild
PASSED test/test_wsgi.py::TestDecorators::test_truncate_body
PASSED test/test_wsgi.py::TestDecorators::test_view
PASSED test/test_wsgi.py::TestDecorators::test_view_error
PASSED test/test_wsgi.py::TestAppShortcuts::testWithStatement
PASSED test/test_wsgi.py::TestAppShortcuts::test_module_shortcuts
PASSED test/test_wsgi.py::TestAppShortcuts::test_module_shortcuts_with_different_name
367 passed in 0.65s
[metadata] {"noOutputExpected": false}