Commit Graph

2326 Commits

Author SHA1 Message Date
Adam Hopkins
efa0aaf2c2 Add asyncio markers to tox.ini 2020-09-27 10:46:51 +03:00
Adam Hopkins
bd4e1cdc1e squash 2020-09-27 10:27:12 +03:00
Adam Hopkins
eb8df1fc18 Upgrade httpx 2020-09-27 02:58:36 +03:00
tomaszdrozdz
9a8e49751d Adding --strict-markers for pytest 2020-09-08 13:08:49 +02:00
raphaelauv
58e15134fd
Add explicit ASGI compliance to the README (#1922) 2020-09-02 23:22:02 +03:00
Adam Hopkins
875be11ae5
Update README.rst (#1917) 2020-08-27 10:28:56 +03:00
Andrew Scott
3f7c9ea3f5
feat: fixes exception due to unread bytes in stream (#1897)
* feat: fixes exception due to unread bytes in stream

* feat: additonal unit tests to cover changes

* fix: automated changes by `make fix-import`

* fix: additonal changes by `make fix-import`

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-08-27 10:22:02 +03:00
brook
33aa4daac8 fixed the problem that the websocket ping_timeout and ping_interval parameter settings did not take effect 2020-08-13 14:39:55 +08:00
Shawn Hill
58e4087d4b
Add websocket ping variables (#1906)
* Add config params for websocket ping_timeout & ping_interval

* Include changelog

* Pass websocket config values to WebSocketProtocol init, test

* Linting

* Improve docs

Co-authored-by: shawnhill <shawn.hill@equipmentshare.com>
2020-08-07 06:37:59 +03:00
Ashley Sommer
0072fd1573
Add an additional component to the request_data context test. This checks if items stored a request.ctx are able to be accessed from a response-middleware after a response is issued. (#1888)
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-07-29 14:25:31 +03:00
Lee Tat Wai David
5d5ed10a45
Websocket subprotocol (#1887)
* Added fix to include subprotocols from scope

* Added unit test to validate fix

* Changes by black

* Made changes to WebsocketConnection protocol

* Linter changes

* Added unit tests

* Fixing bugs in linting due to isort import checks

* Reverting compat import changes

* Fixing linter errors in compat.py

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-07-29 14:09:26 +03:00
Ashley Sommer
5ee8ee7b04
Merge pull request #1894 from huge-success/test_mode
add a test_mode boolean variable to sanic `app` which is set to True when using Sanic TestClient or ASGIClient, and False all other times.
2020-07-15 22:46:23 +10:00
Adam Hopkins
521ae7f60e squash 2020-07-14 10:41:28 +03:00
Adam Hopkins
27c8c12420 squash 2020-07-14 10:30:48 +03:00
Adam Hopkins
3d1f100781 squash 2020-07-14 10:30:01 +03:00
Adam Hopkins
16d36fc17f squash 2020-07-14 10:25:56 +03:00
Adam Hopkins
eddb5bad91 squash 2020-07-14 10:25:30 +03:00
Adam Hopkins
23e1b5ee3f squash 2020-07-14 10:23:31 +03:00
Adam Hopkins
9e053bef19 squash 2020-07-14 10:13:30 +03:00
Adam Hopkins
cf234fca15 squash this 2020-07-13 23:59:45 +03:00
Adam Hopkins
050a563e1d Add documentation on test mode 2020-07-09 14:57:42 +03:00
Adam Hopkins
c347ff742e Add app.test_mode which is set on testing calls 2020-07-09 14:52:58 +03:00
Adam Hopkins
db1c819fe1 Merge branch 'master' of github.com:huge-success/sanic 2020-07-09 14:24:06 +03:00
Egor
9f2818ee29
Remove version section (#1893) 2020-07-09 07:17:50 +03:00
Adam Hopkins
26aa6d23c7
Fix imports and isort to remove from Makefile deprecated options (#1891)
* Version

* Version 20.6.1

* Fix imports and isort to remove from Makefile deprecated options

* duplicate the mypy ignore hint across both lines

after splitting the `from trio import ...` statement onto two lines, need to duplicate the mypy ignore hint across both lines to keep mypy from complaining

Co-authored-by: Ashley Sommer <ashleysommer@gmail.com>
2020-07-07 16:13:03 +03:00
Adam Hopkins
ec7e894eb3 Merge branch 'master' of github.com:huge-success/sanic 2020-07-07 08:46:01 +03:00
Ashley Sommer
71a08382d6
Adjust isort options and invocation to work on isort 5.0.0 (#1890)
isort 5.0.0 removed command line option `recursive` and removed config option `not_skip`.
2020-07-07 08:43:33 +03:00
Adam Hopkins
09224f8676 Merge branch 'master' of github.com:huge-success/sanic 2020-06-29 15:19:32 +03:00
Adam Hopkins
008b8ac394
V2.6.3 changelog (#1886)
* Version

* Version 20.6.1

* v2.6.3 changelog and version
2020-06-29 15:16:06 +03:00
Adam Hopkins
a357add14e Merge branch 'master' of github.com:huge-success/sanic 2020-06-29 14:55:52 +03:00
Adam Hopkins
0cfd7b528b
V20.6.2 changelog (#1885)
* Version

* Version 20.6.1

* CHANGELOG for v20.6.2
2020-06-29 14:54:44 +03:00
Adam Hopkins
9ba4fe05df Merge branch 'master' of github.com:huge-success/sanic 2020-06-29 14:54:02 +03:00
Ashley Sommer
35786b4b74
Revert change to multiprocessing mode (#1884)
Revert change to multiprocessing mode accidentally included in https://github.com/huge-success/sanic/pull/1853

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-29 14:51:30 +03:00
Ashley Sommer
c7430d805a
Revert change to multiprocessing mode (#1884)
Revert change to multiprocessing mode accidentally included in https://github.com/huge-success/sanic/pull/1853

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-29 13:51:55 +03:00
Adam Hopkins
8a3fbb555f Merge branch 'master' of github.com:huge-success/sanic 2020-06-29 08:56:20 +03:00
L. Kärkkäinen
a62c84a954
Socket binding implemented properly for IPv6 and UNIX sockets. (#1641)
* Socket binding implemented properly for IPv6 and UNIX sockets.

- app.run("::1") for IPv6
- app.run("unix:/tmp/server.sock") for UNIX sockets
- app.run("localhost") retains old functionality (randomly either IPv4 or IPv6)

Do note that IPv6 and UNIX sockets are not fully supported by other Sanic facilities.
In particular, request.server_name and request.server_port are currently unreliable.

* Fix Windows compatibility by not referring to socket.AF_UNIX unless needed.

* Compatibility fix.

* Fix test of existing unix socket.

* Cleaner unix socket removal.

* Remove unix socket on exit also with workers=1.

* More pedantic UNIX socket implementation.

* Refactor app to take unix= argument instead of unix:-prefixed host. Goin' fast @ unix-socket fixed.

* Linter

* Proxy properties cleanup. Slight changes of semantics. SERVER_NAME now overrides everything.

* Have server fill in connection info instead of request asking the socket.

- Would be a good idea to remove request.transport entirely but I didn't dare to touch it yet.

* Linter 💣🌟💀

* Fix typing issues. request.server_name returns empty string if host header is missing.

* Fix tests

* Tests were failing, fix connection info.

* Linter nazi says you need that empty line.

* Rename a to addr, leave client empty for unix sockets.

* Add --unix support when sanic is run as module.

* Remove remove_route, deprecated in 19.6.

* Improved unix socket binding.

* More robust creating and unlinking of sockets. Show proper and not temporary name in conn_info.

* Add comprehensive tests for unix socket mode.

* Hide some imports inside functions to avoid Windows failure.

* Mention unix socket mode in deployment docs.

* Fix merge commit.

* Make test_unix_connection_multiple_workers pickleable for spawn mode multiprocessing.

Co-authored-by: L. Kärkkäinen <tronic@users.noreply.github.com>
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-29 08:55:32 +03:00
Adam Hopkins
4aba74d050
V20.6 version (#1882)
* Version

* Version 20.6.1

Co-authored-by: 7 <yunxu1992@gmail.com>
2020-06-29 00:17:24 +03:00
Adam Hopkins
ab2cb88cf4
CHANGELOG for v 20.6 and documentation change for sanic command (#1881)
* CHANGELOG for v 20.6 and documentation change for sanic command

* Update CHANGELOG.rst

20.6.0 and 20.6.1 are the same release. One change from `blueprints` had not made it in by accident, therefore the second subsequent release.
2020-06-28 11:42:12 -07:00
Adam Hopkins
e79ec7d7e0 Version 20.6.1 2020-06-28 17:21:48 +03:00
Adam Hopkins
ccdb74a9a7 Merge branch 'master' of github.com:huge-success/sanic 2020-06-28 17:21:12 +03:00
Adam Hopkins
7b96d633db Version 2020-06-28 17:19:57 +03:00
Adam Hopkins
938c49b899
Add handler names for websockets for url_for usage (#1880) 2020-06-28 14:45:52 +03:00
Ashley Sommer
761eef7d96
Fix pickle error when attempting to pickle an application which contains websocket routes. (#1853)
Moves the websocket_handler subfunction out to a class-level method, which can be more easily pickled by the built-in python Pickler.
Also includes a similar fix for the add_task deferred task scheduler subfunction.

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-28 11:05:06 +03:00
David Bordeynik
83511a0ba7
fix-#1851: correct step name (#1852)
* fix-#1851: correct step name

* fix-#1851: correct step name elsewhere as well

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-28 10:52:43 +03:00
Damian Jimenez
cf9ccdae47
Bug fix for host parameter issue with lists (#1776)
* Bug fix for host parameter issue with lists

As explained in #1772 there is an issue when using a list as an argument for the host parameter in the Blueprint.route() decorator. I've traced the issue back to this line, and the if conditional should ensure that the name attribute isn't accessed when route is None.

* Unit tests for blueprint.route host paramter set to list.

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-28 09:42:18 +03:00
Kiril Yershov
d81096fdc0
Clarified response middleware execution order in the documentation (#1846)
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-28 09:29:48 +03:00
Adam Hopkins
6c8e20a859
Add version parameter to websocket routes (#1760)
* Add version parameter to websockets

* Run black and cleanup code
2020-06-28 09:17:18 +03:00
Liran Nuna
6239fa4f56
Deprecate body_bytes to merge into body (#1739)
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2020-06-28 08:59:23 +03:00
David Bordeynik
1b324ae981
fix-#1856: adjust websockets version to setup.py and make nightly (py39) tests pass (#1857)
* fix-#1856: adjust websockets version to setup.py and make nightly (py39) tests pass

* fix-#1856: set min websockets version to 8.1

* fix-#1856: suppress timeout for CI to pass

* fix-#1856: timeout -> close_timeout due to deprecation warning

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
Co-authored-by: 7 <yunxu1992@gmail.com>
2020-06-28 08:43:12 +03:00
Linus Groh
bedf68a9b2
Wrap run()'s "protocol" type annotation in Optional[] (#1869)
As the default is None and the function will determine a sane value
in that case, the correct annotation is "Optional[Type[Protocol]]".
2020-06-11 11:40:12 -07:00