Commit graph

101 commits

Author SHA1 Message Date
Gina Häußge
cc44c1a981 Make sure to properly handle unicode passwords
Fix & test for #1891
2017-05-02 09:35:02 +02:00
Gina Häußge
346f818707 PGMR: More general flexibility for os compat check
* Don't restrict the list of compatibility values to check against
    to only those we have mapped, also support unmapped more exotic
    ones.

  * Allow 1:1 check against sys.platform values (with startswith).
    Combined with the above that allows very granular compatibility
    modelling ("freebsd11", "freebsd12") if required.

  * Instead of only whitelisting ("linux", "freebsd") now also black
    listing is possible ("!windows").

    A detected os must match all provided whitelist elements (if the
    whitelist is empty that is considered always the case) and none of
    the backlist elements (if the blacklist is empty that is also
    considered always the case).

See the included unit tests for examples of how this works.
2017-04-07 09:18:37 +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
4d324c5239 Fix unit tests 2017-04-03 18:47:27 +02:00
Gina Häußge
61fbde4e51 Manual test plugin for parts of the update mechanism 2017-03-10 12:01:09 +01:00
Gina Häußge
559238ca3c More solid parsing of line number from resends
Matches:

  * Resend:23
  * Resend:N23
  * Resend:N:23
  * rs 23
  * rs N23
  * rs N:23
  * rs N23 Expected checksum 109

Based on issue reported via PR #300
2017-03-09 17:08:01 +01:00
Gina Häußge
fa16037e9a Unit test for M115 response parsing 2017-03-09 16:39:16 +01:00
Andy Werner
8a4934e6f8 Fix an issue in user settings
* UserSettings: crashed if overwrite an existing key with primitive value by same key with complex value. Also reduced number of calls to user.get_setting()

* Updated tests

(cherry picked from commit b75b53d)
2017-03-08 18:11:36 +01:00
Gina Häußge
01ebf8fba7 Fix for two timing sensitive unit tests 2017-03-06 11:54:03 +01:00
Gina Häußge
7beabf953c Fixed user unit tests 2017-02-17 13:43:47 +01:00
Gina Häußge
6bd788a83f Always define pixfmt for timelapse in video filter chain
Apparently having a chain AND the pix_fmt parameter
produces issues with higher resolutions.

Should fix #1317
2017-01-17 13:03:27 +01:00
Gina Häußge
e6dd37e26e Various analysis queue fixes
* Fix priority queue sorting (sorts ascending, not descending!)
  * Abort low priority jobs when a high priority job comes in
  * Utilize queue for tracking aborted jobs too
  * Abort analysis for items that are to be deleted/moved (also
    fixes issue under Windows where it was impossible to delete
    a file for which the analysis was still running).
2017-01-12 18:16:42 +01:00
Gina Häußge
d28e0988fb Merge branch 'maintenance' into devel 2016-11-07 16:18:26 +01: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
0d8fdfae26 Trust Tc over T when parsing temps from the firmware 2016-10-17 10:27:06 +02:00
Gina Häußge
aca3dfae49 Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
2016-09-23 14:35:31 +02:00
Gina Häußge
080a6e9ccd Extend atomic_write to allow setting & persisting file permissions 2016-09-23 14:26:33 +02:00
Gina Häußge
53c0ad0889 Fixed unit tests for octoprint.timelapse 2016-09-16 18:35:30 +02:00
Gina Häußge
b6fbbb353a Merge branch 'maintenance' into devel
# Conflicts:
#	CHANGELOG.md
#	src/octoprint/filemanager/storage.py
#	src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
2016-09-09 12:31:29 +02: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
64d484bd09 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/__init__.py
#	src/octoprint/util/jinja.py
2016-09-07 17:22:37 +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
Gina Häußge
cba742a94f Fix some more left-overs of py2<->py3 PRs
Related to #1411, #1414 and #1415
2016-07-15 12:46:53 +02:00
Gina Häußge
7ed1f4cb9e umask test also needs to use different octal syntax
Related to #1414
2016-07-15 12:37:11 +02:00
Gina Häußge
47b7acdfbc Merge branch 'dev/python3A' of https://github.com/ByReaL/OctoPrint into pr/ByReaL/dev/python3A
Conflicts:
	src/octoprint/plugins/virtual_printer/virtual.py
	src/octoprint/printer/standard.py
2016-07-15 12:28:19 +02:00
Gina Häußge
76a04cbe9d Merge branch 'dev/python3B' of https://github.com/ByReaL/OctoPrint into pr/ByReaL/dev/python3B 2016-07-15 11:28:55 +02:00
MirceaDan
c33a9f9aa2 from __future__ import absolute_import, division, print_function
changed the behavior to import division and print to be consistent
across all app and similar with python 3.x
2016-07-15 00:16:58 -07:00
MirceaDan
149cc8c7c5 python 3 changes exceptions, queue and asesrtEqual
1) import Queue is now lower caps

2) exceptions
except KeyError as e:

3) assertEquals is deprecated but assertEqual does exactly same thing
2016-07-14 23:53:39 -07:00
Gina Häußge
18243e49a6 Fix a failing unit test 2016-07-13 11:25:03 +02:00
Gina Häußge
015b99fa14 Fix plugin unit tests 2016-06-28 11:02:44 +02:00
Gina Häußge
3b2af5b7ed Fix settings unit tests 2016-06-28 10:57:51 +02:00
Gina Häußge
73ba5b05a9 Add unit tests for settings 2016-06-28 10:29:05 +02:00
Kyle Evans
75f8facb05 Make Server class octoprint_daemon-aware, make sure terminated() gets invoked on it upon SIGTERM and update respective test 2016-05-09 09:40:50 -05:00
Gina Häußge
e28ca60f21 Merge branch 'maintenance' into devel
Conflicts:
	CHANGELOG.md
2016-02-10 16:46:56 +01:00
Gina Häußge
3fb9248d2a More timelapse unit tests 2016-02-10 16:44:46 +01:00
Gina Häußge
99c65b8cf4 Unit test for unrendered timelapse cleanup 2016-02-10 14:40:10 +01:00
Gina Häußge
ae23f09edf Merge branch 'maintenance' into devel 2016-02-09 10:46:14 +01:00
Gina Häußge
4b7552e56e Fixed file manager unit tests, added tests for print recovery functionality 2016-02-09 10:45:54 +01:00
Gina Häußge
e4828450c9 Merge branch 'fix/slugifyFilenames' into devel
Conflicts:
	setup.py
2016-01-11 16:43:38 +01:00
Gina Häußge
7743372ee4 Slugify file names on local storage
Just stripping anything non-ASCII leads to errors with UTF-8 only
filenames.

Closes #1181
2016-01-11 16:42:05 +01:00
Gina Häußge
5fb1c2d7a0 Merge branch 'fix/useIsHiddenPath' into devel 2015-11-20 10:12:33 +01:00
Gina Häußge
454f16a7c3 Fixed a broken unit test (pro tip: test new tests before committing...) 2015-11-20 10:12:15 +01:00
Gina Häußge
73d8ff9991 Merge branch 'fix/useIsHiddenPath' into devel
Conflicts:
	tests/util/test_file_helpers.py
2015-11-20 10:07:46 +01:00
Gina Häußge
a731f748d9 Moved existing hidden file checks to utilize octoprint.util.is_hidden_path 2015-11-20 10:02:06 +01:00
Gina Häußge
1f90096a89 Merge branch 'fix/hiddenTemplatesListed' into devel
Conflicts:
	src/octoprint/util/__init__.py
	tests/util/test_file_helpers.py
2015-11-19 19:04:21 +01:00
Gina Häußge
83f66e133e Do not include hidden files in listed gcode scripts 2015-11-19 18:58:56 +01:00
Gina Häußge
ab97abf13e Some fixes and unit tests for octoprint.util.atomic_write, .bom_aware_open and .tempdir
(cherry picked from commit 4fcb853)
2015-11-19 15:15:35 +01:00