Gina Häußge
49621a65b0
Merge branch 'maintenance' into devel
2021-05-20 12:23:26 +02:00
cp2004
2c03ecdfff
🐛 Fix SameSite=None cookie
...
When passing Python's NoneType down to Werkzeug, it uses this logic:
```python
if samesite is not None:
samesite = samesite.title()
if samesite not in {"Strict", "Lax", "None"}:
raise ValueError("SameSite must be 'Strict', 'Lax', or 'None'.")
```
This means that when OctoPrint converted any strings 'None' into NoneType,
they would not show up in the Set-Cookie header.
Investigation: https://community.octoprint.org/t/unable-to-log-into-octoprint-through-an-iframe-on-home-assistant/33977/20?u=charlie_powell
Link to werkzeug source: https://github.com/pallets/werkzeug/blob/1dde4b1790f9c46b7122bb8225e6b48a5b22a615/src/werkzeug/http.py#L1213-L1217
Docs, while not explicitly clear, here: https://werkzeug.palletsprojects.com/en/1.0.x/http/?highlight=dump_cookie#werkzeug.http.dump_cookie
2021-05-12 16:30:44 +01:00
Gina Häußge
718f89fdbd
Merge branch 'maintenance' into devel
2020-10-23 16:59:02 +02:00
Gina Häußge
dbc012fa4c
🎨 Fix some left over set calls
2020-10-23 16:42:32 +02:00
Gina Häußge
100764b03e
🎨 Remove some left-over pragma headers & future imports
2020-10-07 21:37:22 +02:00
Gina Häußge
c715751bc6
Merge branch 'maintenance' into devel
2020-10-07 21:19:05 +02:00
Gina Häußge
d3cf2a8e35
🎨 Some additional pre-commit checks
2020-10-07 21:16:48 +02:00
Gina Häußge
18e6bfc7f8
Merge branch 'maintenance' into devel
...
# Conflicts:
# .github/workflows/build.yml
# docs/conf.py
# docs/development/environment.rst
# docs/sphinxext/codeblockext.py
# docs/sphinxext/onlineinclude.py
# setup.py
# src/octoprint/access/groups.py
# src/octoprint/access/permissions.py
# src/octoprint/access/users.py
# src/octoprint/cli/__init__.py
# src/octoprint/cli/analysis.py
# src/octoprint/cli/client.py
# src/octoprint/cli/config.py
# src/octoprint/cli/plugins.py
# src/octoprint/cli/server.py
# src/octoprint/cli/user.py
# src/octoprint/environment.py
# src/octoprint/events.py
# src/octoprint/filemanager/__init__.py
# src/octoprint/filemanager/analysis.py
# src/octoprint/filemanager/destinations.py
# src/octoprint/filemanager/storage.py
# src/octoprint/filemanager/util.py
# src/octoprint/logging/__init__.py
# src/octoprint/logging/handlers.py
# src/octoprint/plugin/__init__.py
# src/octoprint/plugin/core.py
# src/octoprint/plugins/action_command_notification/__init__.py
# src/octoprint/plugins/action_command_prompt/__init__.py
# src/octoprint/plugins/appkeys/__init__.py
# src/octoprint/plugins/backup/__init__.py
# src/octoprint/plugins/corewizard/__init__.py
# src/octoprint/plugins/corewizard/subwizards.py
# src/octoprint/plugins/discovery/__init__.py
# src/octoprint/plugins/errortracking/__init__.py
# src/octoprint/plugins/gcodeviewer/__init__.py
# src/octoprint/plugins/logging/__init__.py
# src/octoprint/plugins/pi_support/__init__.py
# src/octoprint/plugins/softwareupdate/cli.py
# src/octoprint/plugins/softwareupdate/updaters/single_file_plugin.py
# src/octoprint/plugins/softwareupdate/updaters/sleep_a_bit.py
# src/octoprint/plugins/softwareupdate/version_checks/always_current.py
# src/octoprint/plugins/softwareupdate/version_checks/bitbucket_commit.py
# src/octoprint/plugins/softwareupdate/version_checks/github_release.py
# src/octoprint/plugins/softwareupdate/version_checks/httpheader.py
# src/octoprint/plugins/softwareupdate/version_checks/jsondata.py
# src/octoprint/plugins/softwareupdate/version_checks/never_current.py
# src/octoprint/plugins/softwareupdate/version_checks/pypi_release.py
# src/octoprint/plugins/tracking/__init__.py
# src/octoprint/plugins/virtual_printer/virtual.py
# src/octoprint/printer/__init__.py
# src/octoprint/printer/estimation.py
# src/octoprint/printer/profile.py
# src/octoprint/printer/standard.py
# src/octoprint/server/__init__.py
# src/octoprint/server/api/__init__.py
# src/octoprint/server/api/system.py
# src/octoprint/server/api/users.py
# src/octoprint/server/util/flask.py
# src/octoprint/server/util/tornado.py
# src/octoprint/server/util/webassets.py
# src/octoprint/settings.py
# src/octoprint/slicing/__init__.py
# src/octoprint/timelapse.py
# src/octoprint/util/__init__.py
# src/octoprint/util/comm.py
# src/octoprint/util/commandline.py
# src/octoprint/util/connectivity.py
# src/octoprint/util/fixes.py
# src/octoprint/util/gcodeInterpreter.py
# src/octoprint/util/jinja.py
# src/octoprint/util/json/__init__.py
# src/octoprint/util/net.py
# src/octoprint_client/__init__.py
# src/octoprint_setuptools/__init__.py
# tests/filemanager/test_filemanager.py
# tests/filemanager/test_localstorage.py
# tests/plugin/test_core.py
# tests/plugin/test_settings.py
# tests/plugin/test_types_blueprint.py
# tests/plugin/test_types_settings.py
# tests/server/api/test_system.py
# tests/server/util/test_flask.py
# tests/server/util/test_tornado.py
# tests/slicing/test_slicingmanager.py
# tests/test_daemon.py
# tests/timelapse/test_timelapse_helpers.py
# tests/util/test_comm.py
# tests/util/test_file_helpers.py
# tests/util/test_pip.py
# tests/util/test_repeated_timer.py
# tests/util/test_resettable_timer.py
# versioneer.py
2020-10-07 21:08:44 +02:00
Gina Häußge
b5be8f3eae
🎨 Add codemods to pre-commit, fix flake8
2020-10-07 16:27:11 +02:00
Gina Häußge
fbfb34df58
🎨 Switch to use of isort
2020-10-07 13:15:52 +02:00
Gina Häußge
1f93b2355a
🎨 Switch to black formatting
2020-10-07 13:13:06 +02:00
Gina Häußge
54b3d770e7
♻ mock => unittest.mock
2020-07-06 15:05:33 +02:00
Gina Häußge
09823115af
💚 Fix unit tests
2020-04-15 15:44:42 +02:00
Matthias Urlichs
6bf8384c35
Kill of u"" (visual clutter)
2019-02-03 14:25:41 +01:00
Matthias Urlichs
1dacbc35bf
Use unicode_literals __future__
2019-02-03 14:09:57 +01:00
Matthias Urlichs
a721256204
AssertEquals is deprecated
2019-01-31 20:10:30 +01:00
Matthias Urlichs
24d2efd3ce
Merge devel into py23
2019-01-31 20:08:40 +01:00
Gina Häußge
38eff3fe6f
Merge branch 'maintenance' into devel
...
# Conflicts:
# src/octoprint/server/api/system.py
2019-01-31 14:07:14 +01:00
Matthias Urlichs
f9916783e9
whitespace
2019-01-28 07:34:19 +01:00
Matthias Urlichs
c05b6572c5
Fix coding= headers
2019-01-27 17:36:16 +01:00
Gina Häußge
eb46815789
Slight refactoring for improved testability & fix tests
2019-01-22 15:40:08 +01:00
Kevin McCormack
449fa0c7ec
WIP Update test_system
2019-01-21 12:49:57 -05:00
Kevin McCormack
0489dfeaee
[WIP] Add disk usage API endpoint
2019-01-20 10:02:13 -05:00
MirceaDan
f243a52823
all files start now with same 2 lines
...
# coding=utf-8
from __future__ import absolute_import, division, print_function
2018-12-02 02:13:12 -08:00
tedder
7867052339
another 'set equality', this one to fix map/list mappings
2018-09-02 00:44:30 -07:00
tedder
660724741c
quick refactor for deprecated 'assertEquals'
...
It's been quietly allowed but was dropped in py3.
2018-09-01 22:31:33 -07:00
Gina Häußge
7fc0f48659
Adjust unit tests for script root in cookie suffix
2017-09-28 17:43:53 +02:00
Gina Häußge
832c27ed18
Filter source maps from bundled assets
...
At least for now. Might be re-evaluated in the future. URL rewrite
filter for such a case already in place.
2017-05-19 12:28:20 +02:00
Gina Häußge
7828ab0bf9
Fix tests for server.util.*
...
Weren't properly included in test suite, and those for the flask
utility also had some errors due to buggy test implementation.
2017-04-07 09:15:08 +02:00
Gina Häußge
2952b2622e
Do not hiccup on ipv6 addresses in the HTTP Host header
...
Fixed port extraction. Now supports hostname, hostname + port,
ipv4, ipv4 + port, ipv6, ipv6 + port
Fixes #1571
2016-11-07 16:17:16 +01:00
Gina Häußge
bbe6e44d44
Only use non-postfixed cookie if no postfixed one exists
...
Example:
* both "session" and "session_P5000" cookies available: "session" value from "session_P5000"
* only "session" cookie available: "session" value from "session"
* only "session_P5000" cookie available: "session" value from "session_P5000"
2016-09-08 15:42:51 +02:00
Gina Häußge
53b74f9caa
Only construct HTTP_HOST header from SERVER_NAME and _PORT if it's unset
...
If HTTP_HOST is set, following PEP333 it takes precedence over SERVER_NAME and
_PORT, so we set those from it.
2016-09-08 15:18:09 +02:00
Gina Häußge
2b22d26eac
Fixed a small issue with RFC 5987 headers arriving as unicode in parser
...
Also added API docs regarding header encoding, incl support for RFC 5987
for filename fields in Content-Disposition headers in multipart/form-data
parts, incl. an example of an upload request with a utf-8 encoded filename.
2016-09-07 18:44:46 +02:00
Gina Häußge
13728c231c
Also explicitely support ISO-8859-1 encoded multipart headers
...
Solves an issue with clients encoding filenames in multipart
headers in ISO-8859-1, causing an HTTP 500 response code.
This change makes ISO-8859-1 encoded headers work, sends
a 400 Bad Request instead of 500 Internal Server Error if the
request multipart headers cannot be decoded as either UTF-8
or ISO-8859-1, defines UTF-8 content type for multipart text
fields in rebuilt body and also adds support for RFC 5987 for the
multipart file upload "filename" header component.
2016-09-07 17:03:59 +02:00
Gina Häußge
9d9eb3390d
Cookie names are now port specific, based on the request associated with a response
...
* make sure server_port headers are properly set in reverse proxied scenarios
* overwrite request and response classes to
* always apply reverse proxy environment changes (so far missing for tornado
context)
* strip cookie name suffixes from cookie names on requests and
* be sure to set cookie name suffixes for cookie names on responses
* include script root in path used for cookies
* some minor refactoring in octoprint.server setup routines
* removed ReverseProxied class (didn't work for tornado context)
* add unit tests for the whole reverse proxy, request and response customization
2016-09-05 12:06:56 +02:00