2614 Commits

Author SHA1 Message Date
prryplatypus
0dbf1b2504
Added first tests 2021-11-01 19:29:58 +01:00
Néstor Pérez
471a42b66a
Merge branch 'main' into feat/optional-uvloop-use 2021-10-31 12:47:22 +01:00
Adam Hopkins
36e6a6c506
Increase join concat performance (#2291) 2021-10-29 12:55:09 +03:00
Stephen Sadowski
a361b345ad
Py310 loop fixup (#2294)
* Fixup for 3.8+; Sanic still supports 3.7 where loop is required

* Added branching statement to hanle asyncio.Event() loop parameter removal in 3.10, and optional supply in 3.9
2021-10-28 17:16:23 -05:00
Adam Hopkins
f5bd6e3b2f
Add Python 3.10 testing (and support) (#2257)
Administratively merging because @vltr and @ahopkins are the release managers, and @ahopkins is originator of the PR

* Add Python 3.10 testing (and support)

* fixed py310 tox environment for windows, quoted '3.10' in python-310 tests to avoid numeric compression

* updated tox.ini for py310

* quoted the rest of the bare 3.10 references in the workflows

* Issue with pytest requires version bump to 6.2.5 for python 3.10

Co-authored-by: Stephen Sadowski <stephen.sadowski@sjsadowski.com>
2021-10-28 13:41:57 -05:00
L. Kärkkäinen
6c7df68c7c
Vhost support using multiple TLS certificates (#2270)
* Initial support for using multiple SSL certificates.

* Also list IP address subjectAltNames on log.

* Use Python 3.7+ way of specifying TLSv1.2 as the minimum version. Linter fixes.

* isort

* Cleanup, store server name for later use. Add RSA ciphers. Log rejected SNIs.

* Cleanup, linter.

* Alter the order of initial log messages and handling. In particular, enable debug mode early so that debug messages during init can be shown.

* Store server name (SNI) to conn_info.

* Update test with new error message.

* Refactor for readability.

* Cleanup

* Replace old expired test cert with new ones and a script for regenerating them as needed.

* Refactor TLS tests to a separate file.

* Add cryptography to dev deps for rebuilding TLS certs.

* Minor adjustment to messages.

* Tests added for new TLS code.

* Find the correct log row before testing for message. The order was different on CI.

* More log message order fixup. The tests do not account for the logo being printed first.

* Another attempt at log message indexing fixup.

* Major TLS refactoring.

CertSelector now allows dicts and SSLContext within its list.
Server names are stored even when no list is used.
SSLContext.sanic now contains a dict with any setting passed and information extracted from cert.
That information is available on request.conn_info.cert.
Type annotations added.
More tests incl. a handler for faking hostname in tests.

* Remove a problematic logger test that apparently was not adding any coverage or value to anything.

* Revert accidental commit of uvloop disable.

* Typing fixes / refactoring.

* Additional test for cert selection. Certs recreated without DNS:localhost on sanic.example cert.

* Add tests for single certificate path shorthand and SNI information.

* Move TLS dict processing to CertSimple, make the names field optional and use names from the cert if absent.

* Sanic CLI options --tls and --tls-strict-host to use the new features.

* SSL argument typing updated

* Use ValueError for internal message passing to avoid CertificateError's odd message formatting.

* Linter

* Test CLI TLS options.

* Maybe the right codeclimate option now...

* Improved TLS argument help, removed support for combining --cert/--key with --tls.

* Removed support for strict checking without any certs, black forced fscked up formatting.

* Update CLI tests for stricter TLS options.

Co-authored-by: L. Karkkainen <tronic@users.noreply.github.com>
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2021-10-28 16:50:05 +03:00
Meysam
5b82884f8b
ci: fail on error 👷 (#2292)
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2021-10-27 11:55:34 +03:00
Néstor Pérez
f0f81ec458
Add ability to log all exceptions (#2262)
* Add ability to log all exceptions

* Fix linting 🙄

* Remove shorthand

* Make `ErrorHandler.log` backwards-compat

* Ignore mypy error

* Don't store `noisy_exceptions` attribute in app

* Added tests

* Store noisy exceptions setting in config

* Default to not-noisy if config key not available

* Add CLI tests for `noisy-exceptions`

* Remove debugging line I left in 😅

* Fix tests

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2021-10-27 10:43:58 +03:00
Cyril Nicodème
71cc30e5cd
Replacing assignation by typing for websocket_handshake (#2273)
* Replacing assignation by typing for `websocket_handshake`

Related to #2272

* Fix some type hinting issues

* Cleanup websocket handchake response concat

* Optimize concat encoding

Co-authored-by: Adam Hopkins <adam@amhopkins.com>
2021-10-27 10:00:04 +03:00
L. Kärkkäinen
645310cff6
Change codeclimate complexity threshold from 5 to 10. (#2286)
Co-authored-by: L. Karkkainen <tronic@users.noreply.github.com>
Co-authored-by: Stephen Sadowski <stephen.sadowski@sjsadowski.com>
2021-10-24 22:30:35 +03:00
prryplatypus
348c358d72
Merge branch 'main' of github.com:sanic-org/sanic into feat/optional-uvloop-use 2021-10-24 21:09:52 +02:00
prryplatypus
76492a7f88
Avoid unnecessary error log 2021-10-24 21:08:24 +02:00
prryplatypus
41454b2553
Fix linting errors 2021-10-24 20:51:05 +02:00
prryplatypus
6351753066
Fixes for gunicorn 2021-10-24 20:45:52 +02:00
Stephen Sadowski
2f30b5748a
Update host test function names so they are not overwritten (#2287)
Fix function name reuse in cli tests
2021-10-24 12:29:16 -05:00
prryplatypus
c008c343d9
Rename loop param 2021-10-24 19:27:43 +02:00
Stephen Sadowski
5e1ef96934
fix ipv6 display in startup info log (#2285)
* fix ipv6 display in startup info log

* refactored to oneliner by request

* Added test for passing ipv4 host

* Added test for passing ipv6 any host

* Added test for passing ipv6 loopback host
2021-10-24 11:14:00 -05:00
prryplatypus
0d1e591a9b
Fix logo tests? 2021-10-23 21:42:46 +02:00
prryplatypus
a1f36609b4
Fix logging 2021-10-23 21:40:57 +02:00
prryplatypus
6563ee28bf
Fix tests (hopefully?) 2021-10-23 21:16:49 +02:00
prryplatypus
250c5cf60d
Merge branch 'feat/optional-uvloop-use' of github.com:prryplatypus/sanic into tests/optional-uvloop-use 2021-10-23 21:02:20 +02:00
prryplatypus
1908eb5a02
Fix linting... *sigh* 2021-10-23 21:02:03 +02:00
prryplatypus
3e14dee8b4
Merge branch 'feat/optional-uvloop-use' of github.com:prryplatypus/sanic into tests/optional-uvloop-use 2021-10-23 20:50:33 +02:00
prryplatypus
2ff45ccfb1
Fix typing 2021-10-23 20:50:13 +02:00
prryplatypus
48b0158cd7
Merge changes into tests branch 2021-10-23 20:42:21 +02:00
prryplatypus
2e492f94e6
Create UVLOOP_INSTALLED constant 2021-10-23 20:39:57 +02:00
Ryu juheon
57e98b62b3
style: add some type hints (#2279)
* style: add some type hints

* fix: *args is a tuple, but overridden as a list

* fix: if touch this, it will be a maybe breaking change

* fix: remove unused import

* style(app): more correct type
2021-10-20 15:15:39 +03:00
prryplatypus
9a9a1ea5d6
Reattempt testing number 1 2021-10-18 21:33:05 +02:00
prryplatypus
eb2a264404
Remove failed tests 2021-10-11 20:57:26 +02:00
prryplatypus
cb791aa8b7
Fix error message 2021-10-11 20:34:34 +02:00
prryplatypus
0ab7f5ff6b
Attempt #2 at tests 2021-10-11 20:23:28 +02:00
prryplatypus
575837d5ef
Merge branch 'feat/optional-uvloop-use' of github.com:prryplatypus/sanic into feat/optional-uvloop-use 2021-10-11 20:23:10 +02:00
Néstor Pérez
cab4d59fef
First attempt tests (#1) 2021-10-11 20:02:00 +02:00
prryplatypus
4bfc09f3bd
Default USE_UVLOOP to True 2021-10-11 19:00:43 +02:00
Néstor Pérez
3262878ebd
Fix docs error (#2269) 2021-10-10 22:41:45 +03:00
prryplatypus
257b239cac
Configure event loop using ASGI mode too 2021-10-10 20:46:57 +02:00
prryplatypus
7f69e43743
Run event loop configuration on startup 2021-10-10 19:38:35 +02:00
prryplatypus
33eed1144e
Remove previous tests 2021-10-10 19:23:43 +02:00
prryplatypus
9576055b05
Added tests 2021-10-09 20:39:21 +02:00
prryplatypus
48a54f81e5
Better message 2021-10-09 19:51:50 +02:00
prryplatypus
d00b868b40
Fix linting 2021-10-09 19:48:09 +02:00
prryplatypus
93c814a32f
Tweaked warning message 2021-10-09 19:43:38 +02:00
prryplatypus
b3ff3926db
Added warning messages 2021-10-09 19:41:50 +02:00
prryplatypus
e6e0cd6528
Rename NO_UVLOOP to USE_UVLOOP in config 2021-10-04 20:20:57 +02:00
prryplatypus
6f776c1a2e
Fix linting 2021-10-03 20:56:14 +02:00
prryplatypus
1a034fc9c4
Replace USE_UVLOOP with NO_UVLOOP for consistency 2021-10-03 20:51:32 +02:00
prryplatypus
283911d0b2
Make use of uvloop optional 2021-10-03 20:42:04 +02:00
Adam Hopkins
5e12edbc38
Allow non-conforming ErrorHandlers (#2259)
* Allow non-conforming ErrorHandlers

* Rename to legacy lookup

* Updated depnotice

* Bump version

* Fix formatting

* Remove unused import

* Fix error messages
v21.9.1
2021-10-03 01:02:56 +03:00
Adam Hopkins
50a606adee
Merge pull request #2256 from sanic-org/current-release
Mergeback
2021-10-02 22:21:34 +03:00
Adam Hopkins
f995612073 Merge branch 'main' of github.com:sanic-org/sanic into current-release 2021-10-02 21:57:58 +03:00