Adam Hopkins
ccd4c9615c
Create requests-async based TestClient, remove aiohttp dependency, drop Python 3.5
...
Update all tests to be compatible with requests-async
Cleanup testing client changes with black and isort
Remove Python 3.5 and other meta doc cleanup
rename pyproject and fix pep517 error
Add black config to tox.ini
Cleanup tests and remove aiohttp
tox.ini change for easier development commands
Remove aiohttp from changelog and requirements
Cleanup imports and Makefile
2019-04-30 15:26:06 +03:00
andreymal
7d6e60ab7d
Never use chunked transfer encoding for HTTP/1.0
2019-04-22 10:53:13 +03:00
andreymal
9f07109616
Allow to disable Transfer-Encoding: chunked
2019-04-20 22:26:30 +03:00
andreymal
99e56ef74b
Fix broken bail_out when HttpProtocol is closed
2019-04-19 16:14:27 +03:00
andreymal
df23692802
Fix graceful shutdown (the connections set was always empty in serve function)
2019-04-19 15:58:17 +03:00
andreymal
5c9ba189bc
Add options to control the behavior of Request.remote_addr ( #1539 )
...
* Add options to control the behavior of Request.remote_addr
* Update tests for Request.remote_addr
* Update documentation for Request.remote_addr
2019-04-16 08:30:28 -05:00
7
53f45810ff
Fix #1528 ( #1549 )
...
* assign app before handle_request so that request.app could be used in case of connection timeout
* gitignore pip-wheel-metadata/
* remove default app for request class and fix lint issue
2019-04-12 07:48:32 -05:00
Nikita Antonenkov
de582d2fc7
Refactor the app.route decorator
2019-04-06 22:26:56 +03:00
Nikita Antonenkov
653ac7ee14
Fix app.patch decorator docstring typo
2019-04-06 22:23:50 +03:00
Zaar Hai
0b4769289a
Drop dependency on disutils ( #1544 )
...
* Drop dependency on distutils
While distutils is part of stdlib, it feels odd to use distutils in main application code.
I personally use a (lean)[https://hub.docker.com/r/haizaar/python-minimal/tags ] Python distribution for running my applications that does not include distutils.
* Flake8 fixes
* "black" fixes
* strtobool should actually return bool
2019-04-02 08:22:26 -05:00
cakemanny
b2e82685b4
stop number route accepting excess '.'s
...
We stop getting:
ValueError: could not convert string to float: '12.34.56'
when passing 12.34.56 as a number route parameter argument.
By accepting ".12" and "12.", this is a non-breaking change. All valid
floats described by [0-9\.]+ are still accepted, just invalid ones are
now rejected.
2019-03-27 02:49:05 +00:00
Eli Uriegas
7bca95205d
Bump version to 19.03.1
...
Couldn't delete the release on github so we go with the next best thing
which is to just bump the patch version
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
2019-03-22 16:44:28 -07:00
Eli Uriegas
6ed0d3def7
Bump version to 19.03.0
...
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
2019-03-21 16:24:57 -07:00
Harsha Narayana
269100eac1
format: fix linter issue causing travis build failures ( fix #1514 ) ( #1515 )
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2019-03-14 12:18:47 -05:00
Serge Fedoruk
2a15583b87
add Request.not_grouped_args, deprecation warning Request.raw_args ( #1476 )
...
* add Request.not_grouped_args, deprecation warning Request.raw_args
* add 1 more test for coverage
* custom parser for Request.args and Request.query_args, some additional tests
* add docs for custom queryset parsing
* fix import sorting
* docstrings for get_query_args and get_args methods
* lost import
2019-03-14 09:04:05 -05:00
Jotagê Sales
734730640a
added param package to relative imports
2019-03-05 01:40:17 -03:00
Jotagê Sales
bee7cfa6aa
Merge branch 'master' of github.com:huge-success/sanic into config_from_object_string
2019-03-05 01:10:09 -03:00
Daniel Thorn
d5813152ab
Allow sanic test client to bind to a random port ( #1376 )
2019-03-04 15:23:03 -06:00
Jotagê Sales
eacf78b83c
Merge branch 'master' of github.com:huge-success/sanic into config_from_object_string
2019-03-04 00:37:59 -03:00
Harsha Narayana
348964fe12
Enable Middleware Support for Blueprint Groups ( #1399 )
...
* enable blueprint group middleware support
This commit will enable the users to implement a middleware at the
blueprint group level whereby enforcing the middleware automatically to
each of the available Blueprints that are part of the group.
This will eanble a simple way in which a certain set of common features
and criteria can be enforced on a Blueprint group. i.e. authentication
and authorization
This commit will address the feature request raised as part of Issue #1386
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* enable indexing of BlueprintGroup object
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* rename blueprint group file to fix spelling error
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* add documentation and additional unit tests
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* cleanup and optimize headers in unit test file
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* fix Bluprint Group iteratable method
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* add additional unit test to check StopIteration condition
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* cleanup iter protocol implemenation for blueprint group and add slots
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* fix blueprint group middleware invocation identification
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
* feat: enable list behavior on blueprint group object and use append instead of properly to add blueprint to group
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2019-03-03 16:26:05 -06:00
Markus Lång
e5c7589fc0
Remove update_current_time refresh ( #1502 )
2019-03-03 11:22:26 -06:00
Ashley Sommer
4260528645
Fix the auto_reloader to work when the executable was launched with a module, rather than a script. ( #1501 )
2019-03-03 11:03:26 -06:00
PWZER
8a59907319
Recognizes non-ASCII filenames in RFC 2231, and suport filename length is zero for multipart/form-data. ( #1497 )
...
* suport filename length is 0
* 1. suport filename length is zero for multipart/form-data.
2. Now recognizes non-ASCII filenames in RFC 2231, "filename*" format
3. Add some test cases in tests/test_requests.py::test_request_multipart_files.
* reformat sanic/request.py
2019-02-28 08:55:32 -06:00
Leonardo Teixeira Menezes
08794ae1cf
Enforce Datetime Type for Expires on Set-Cookie ( #1484 )
...
* Enforce Datetime Type for Expires on Set-Cookie
* Fix lint issues
* Format code and improve error type
* Fix import order
2019-02-06 12:29:33 -06:00
Enda Farrell
b926a2c9b0
sanic#1480 Allow negative int/number in path ( #1481 )
...
* sanic#1480 Allow negative int/number
* Rerun ``make beautify`` on this change.
2019-02-05 07:54:48 -06:00
Jacob
52bdd1d5a2
Add stream support for bp.add_route() ( #1482 )
...
* Fix #1454
* Update doc
* Fix F632 in response.py
2019-02-05 07:47:46 -06:00
7
2758a3ade6
Merge pull request #1472 from xxNB/dev
...
Remove unwanted None check for __repr__ in `Request` class
2019-01-20 14:21:57 -08:00
7
9cf2e1b519
Merge pull request #1470 from denismakogon/create-server
...
make Sanic.create_server return an asyncio.Server
2019-01-20 14:21:11 -08:00
Tom Christie
95526a82de
ASGI refactoring attempt
2019-01-18 14:50:42 +00:00
章昕
af7ad0a621
Remove unwanted None check for __repr__ in class
2019-01-17 00:24:11 +08:00
Denis Makogon
1473753d43
linter fix
2019-01-15 17:48:26 +02:00
Denis Makogon
391639210e
make Sanic.create_server return an asyncio.Server
...
- adding 2 new parameters to Sanic.create_server:
* return_asyncio_server=False - defines whether there's
a need to return an asyncio.Server or run it right away
* asyncio_server_kwargs=None - for python 3.7 uvloop doesn't
support all necessary features like "start_serving",
so, in order to make sanic work well with asyncio from 3.7
there's a need to introduce generic way for passing
kwargs for "loop.create_server"
Closes : #1469
2019-01-15 13:38:47 +02:00
Raphael Deem
d418cc9950
formatting
2019-01-12 20:41:35 -08:00
Raphael Deem
7067295e67
enforce integer for max-age cookie
2019-01-12 20:41:35 -08:00
Eli Uriegas
2af229eb1a
Merge pull request #1445 from huge-success/r0fls-977
...
add handler name to request as endpoint
2019-01-08 16:12:25 -08:00
Jotagê Sales
62420e0f40
resolve conflict
2019-01-02 21:19:40 -02:00
Sergey Fedoruk
102e651741
refactor typing imports
2019-01-02 23:28:06 +01:00
Sergey Fedoruk
65daaaf64b
linteger fix and delete old tests
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
b7a6f36e95
add type annotations in run and create_server
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
a86a10b128
add control of access_log argument type
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
0b728ade3a
change Config.__init__
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
0c5c6dff8f
fix linting
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
391fcdc83d
fix access_log in run server and fix bool in env variables
2019-01-02 23:28:05 +01:00
Sergey Fedoruk
d76d5e2c5f
add an option to change access_log using gunicorn
2019-01-02 23:28:05 +01:00
Adam Hopkins
4d527035ae
Add dotted endpoint notation and additional tests
2018-12-31 13:40:07 +02:00
Adam Hopkins
05dd3b2e9d
Run linter
2018-12-30 13:18:06 +02:00
Adam Hopkins
040468755c
Change ASCII Logo
...
Update logo text
Reformat app.py
2018-12-30 12:49:23 +02:00
Jotagê Sales
b36dc22b45
resolve conflict in setup.py
2018-12-28 12:08:10 -02:00
Harsha Narayana
efa77cf5ec
add api documentation for router and server
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-12-28 10:22:28 +05:30
Harsha Narayana
e3dfce88ff
fix linter issues
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-12-28 10:22:28 +05:30
Harsha Narayana
e6fba01682
add documentation for cookies, exception, blueprint and handlers
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-12-28 10:22:28 +05:30
Harsha Narayana
09678d601d
add sanic app module documentations
...
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-12-28 10:22:27 +05:30
7
67d51f7e1b
Merge pull request #1423 from yunstanford/request-streaming-support
...
basic request streaming support with flow control
2018-12-27 18:06:02 -08:00
7
aa7f2759a6
Merge pull request #1438 from yunstanford/master
...
18.12 Release
2018-12-27 11:15:07 -08:00
Yun Xu
9b9dd67797
adopt CalVer: MM.YY.MICRO, 18.12.0 release
2018-12-27 11:00:38 -08:00
Jotagê Sales
f2a55d01ea
fix error in import_string
2018-12-27 15:20:58 -02:00
Yun Xu
56989a017b
18.12 release
2018-12-27 08:55:17 -08:00
Jotagê Sales
bf029c1b9d
added docstring to helper function import_string
2018-12-27 14:35:04 -02:00
Jotagê Sales
a33ebbaf11
remove dependence and implmented import_string
2018-12-26 21:19:54 -02:00
Jotagê Sales
e978121d58
configure app from object by path string
2018-12-26 16:23:16 -02:00
Jacob
4efd450b32
Add tests ( #1433 )
...
* Add tests for remove_route()
* Add tests for sanic/router.py
* Add tests for sanic/cookies.py
* Disable reset logging in test_logging.py
* Add tests for sanic/request.py
* Add tests for ContentRangeHandler
* Add tests for exception at response middleware
* Fix cached_handlers for ErrorHandler.lookup()
* Add test for websocket request timeout
* Add tests for getting cookies of StreamResponse, Remove some unused variables in tests/test_cookies.py
* Add tests for nested error handle
2018-12-22 09:21:45 -06:00
Yun Xu
956793e066
address review feedback, small code refactoring
2018-12-09 15:18:33 -08:00
Yun Xu
1bfbc67c62
expose request_buffer_queue_size to be configurable and update documentation
...
fix StreamBuffer buffer_size
2018-12-04 20:21:00 -08:00
Yun Xu
b5287184e9
fix lint
...
fix isort
2018-12-03 23:25:41 -08:00
Yun Xu
268d254d85
fix unit tests
2018-12-03 22:28:22 -08:00
Yun Xu
181adebf82
add StreamBuffer for request flow control
2018-12-03 22:19:26 -08:00
Ashley Sommer
06297a1918
Add in some server.py __slots__ property names that are missing.
2018-12-03 11:22:17 +10:00
7
822ced6294
Merge pull request #1416 from chenjr0719/add_tests_for_static
...
Add tests for static and update document
2018-11-21 23:01:37 +08:00
jacob
f2d528e52a
Add tests for static
2018-11-20 12:28:00 +08:00
Hasan Ramezani
f7adc5f84c
Fix remove_entity_headers
helper function ( #1415 )
...
* Fix `remove_entity_headers` helper function
* Add test for `remove_entity_headers` helper function
2018-11-19 09:30:53 -06:00
Nir Galon
efb9a42045
Change deprecated verify_ssl to ssl ( #1155 )
2018-11-14 07:16:14 -06:00
Richard K
c8b0e7f2a7
Created methods to append and finish body content on Request ( #1379 )
...
* created methods to append and finish body content on request.py so the underlying body instance can have certain flexibility; modified server.py to reflect these changes
* - made some adjustments (including the Request.body_init method) as requested by @ahopkins;
- created a new test with a custom Request class implementation of the flexibility provided by the new methods;
2018-11-12 09:11:41 -06:00
Harsha Narayana
d4d1df03c9
fix content length mismatch in windows and other platform
...
The current implementation of `sanic` attempts to make use of `ujson` if
it's available in the system and if not, it will default to the inbuilt
`json` module provided by python.
The current implementation of `ujson` does not provide a mechanism to
provide a custom `seperators` parameter as part of the `dumps` method
invocation and the default behavior of the module is to strip all the
spaces around seperators such as `:` and `,`. This leads to an
inconsistency in the response length when the response is generated
using the `ujson` and in built `json` module provided by python.
To maintain the consistency, this commit overrides the default behavior
of the `dumps` method provided by the `json` module to add a `seperators`
argument that will strip the white spaces around these character like
the default behavior of `ujson`
This addresses the issue referenced in #1398
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-11-07 21:38:32 +05:30
Harsha Narayana
92b73a6f4f
fix Range header handling for static files ( #1402 )
...
This commit fixes the issue in the `Range` header handling that was done
while serving the file contents.
As per the HTTP response standards, a status code of 206 will be used in
case if the Range is returning a partial value and default of 200 in
other cases.
Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
2018-11-07 07:36:56 -06:00
Meng Wang
b63c06c75a
fix the logger and make it work ( #1397 )
...
* fix the logger and make it work
* modify test_logging parameters and add a new unit test
2018-11-06 08:39:38 -06:00
Stephen Sadowski
e3a27c2cc4
Merge pull request #1391 from AndresSan6/loop_exception
...
Handle "loop" exception in app.py
2018-11-05 08:19:01 -06:00
Ashley Sommer
5cf2144b3f
Fix pickling blueprints
...
Change the string passed in the "name" section of the namedtuples in Blueprint to match the name of the Blueprint module attribute name.
This allows blueprints to be pickled and unpickled, without errors, which is a requirment of running Sanic in multiprocessing mode in Windows.
Added a test for pickling and unpickling blueprints
Added a test for pickling and unpickling sanic itself
Added a test for enabling multiprocessing on an app with a blueprint (only useful to catch this bug if the tests are run on Windows).
2018-11-04 15:04:12 +10:00
Andres Sanchez
7c182f63c8
Indentation fix
2018-11-01 10:59:45 -06:00
Andres Sanchez
056180782c
Removed unnecessary changes to request and router files, changes to fix lint test
2018-11-01 10:53:53 -06:00
Andres Sanchez
ff0d5870e9
Merge branch 'lintfix' into loop_exception
...
Made changes unnecesarry changes in request and router files, went back to previous commit and made correct changes to fix lint
2018-11-01 10:40:47 -06:00
Andres Sanchez
b70176f8c7
Fixed character limit per line in requested changes for app.py
2018-11-01 10:36:34 -06:00
Andres Sanchez
e3655b525d
Modifications to ruequest and router files to fix linting issues.
2018-11-01 10:04:40 -06:00
Andres Sanchez
e63d0091af
Assert was chnaged for an if and updated error messages
2018-10-31 15:23:29 -06:00
Andres Sanchez
7b0af2d80d
Handle loop exception in app.py
2018-10-31 13:35:03 -06:00
Adam Hopkins
c708e8425f
Fix documentation build errors
2018-10-26 11:57:28 +03:00
Eli Uriegas
905c51bef0
Merge pull request #1371 from yunstanford/integrate-isort
...
codestyle: Integrate isort
2018-10-23 16:05:36 -07:00
Yun Xu
0505aa2dda
refactor import
2018-10-23 14:53:39 -07:00
Yun Xu
8ef7bf8e7b
integrate with isort
2018-10-17 21:20:16 -07:00
Yun Xu
277c2ce2d2
fix redirect with quoted param
2018-10-15 21:53:11 -07:00
Yun Xu
aa9bf04dfe
run black against sanic module
2018-10-13 17:55:33 -07:00
7
619bb79a2f
Merge pull request #1336 from untitaker/logging-refactor
...
Try not to stringify exception in logging messages
2018-10-13 16:54:57 -07:00
Yun Xu
f15a7fb588
fix flake8
2018-10-12 23:06:43 -07:00
Yun Xu
c8c370b784
raise exception when param conflicts in route
2018-10-12 22:57:56 -07:00
Yun Xu
36032cc26e
cancel task when connection_lost
2018-10-11 22:38:26 -07:00
Stephen Sadowski
6778f4d9e0
Merge pull request #1342 from hramezani/load_config_file_syntax_error
...
Handle syntax error in load config file.
2018-10-11 08:56:48 -05:00
Stephen Sadowski
fd61b9e3e2
Merge pull request #1327 from hatarist/fix-1323
...
Rename the `http` module to `helpers`
2018-10-11 07:56:51 -05:00
Stephen Sadowski
298d5cdf24
Merge pull request #1334 from chenjr0719/master
...
Fix TypeError when use Blueprint.group() to group blueprint with defa…
2018-10-11 07:28:10 -05:00
jacob
801258c46a
Merge branch 'master' of github.com:chenjr0719/sanic
2018-10-10 14:04:45 +08:00
jacob
32a1db3622
Remove normpath
2018-10-10 14:04:21 +08:00
Arun Babu Neelicattu
c3b31a6fb0
Simplify request ip and port retrieval logic
...
This change also ensures that cases where transport stream is
already closed is handled gracefully.
2018-10-08 21:25:47 +02:00
Hasan Ramezani
f4c55bbc07
Handle config error in load config file.
2018-10-08 19:17:06 +02:00
Hasan Ramezani
1fe7306af8
Add missed documentation for config section.
2018-10-07 01:32:36 +02:00
Markus Unterwaditzer
eb93f884f3
fix: Missing import
2018-10-05 16:47:12 +02:00
Markus Unterwaditzer
3673feb256
fix: typo
2018-10-05 16:33:46 +02:00
Markus Unterwaditzer
7c9c783e9d
deprecate Handler.log
2018-10-05 16:31:01 +02:00
Stephen Sadowski
4466e8cce1
Merge pull request #1304 from ignatenkobrain/fedora
...
Switch to websockets 6.0
2018-10-04 18:45:22 -05:00
Stephen Sadowski
76e9859cf8
Merge branch 'master' into master
2018-10-03 09:56:29 -05:00
Stephen Sadowski
add9d363c5
Merge branch 'master' into logging-refactor
2018-10-03 09:55:01 -05:00
Ashley Sommer
790047e450
Fixes #1340
2018-10-03 10:59:24 +10:00
Stephen Sadowski
d534acb79d
Merge branch 'master' into logging-refactor
2018-10-01 15:41:07 -05:00
Colin Caine
bcc11fa7fe
Fix whitespace in error message
2018-09-30 09:36:55 +01:00
Markus Unterwaditzer
7d0c0fdf7c
fix: Namespacing of sanic logger
2018-09-29 22:40:05 +02:00
Markus Unterwaditzer
0e33d46ead
Try not to stringify exception in logging messages
...
This just fixes the worst offenders that trip up error reporting tools
like Sentry.io
2018-09-29 22:32:51 +02:00
jacob
bd6dbd9090
Fix TypeError when use Blueprint.group() to group blueprint with default url_prefix, Use os.path.normpath to avoid invalid url_prefix like api//v1
2018-09-29 18:23:16 +08:00
Igor Hatarist
f8a6af1e28
Rename the http
module to helpers
to prevent conflicts with the built-in Python http library ( fixes #1323 )
2018-09-25 20:46:40 +03:00
Channel Cat
d8f9986089
Re-releasing with updated credentials
2018-09-13 02:24:31 -07:00
Channel Cat
d38fc17191
Update version to test pypi
2018-09-13 01:50:32 -07:00
Channel Cat
9082eb56a7
Update version to circumvent pypi upload errors
2018-09-06 13:51:31 -07:00
Igor Gnatenko
c578974246
Switch to websockets 6.0
...
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-09-02 09:23:30 +02:00
Ashley Sommer
30e6a310f1
Pausable response streams ( #1179 )
...
* This commit adds handlers for the asyncio/uvloop protocol callbacks for pause_writing and resume_writing.
These are needed for the correct functioning of built-in tcp flow-control provided by uvloop and asyncio.
This is somewhat of a breaking change, because the `write` function in user streaming callbacks now must be `await`ed.
This is necessary because it is possible now that the http protocol may be paused, and any calls to write may need to wait on an async event to be called to become unpaused.
Updated examples and tests to reflect this change.
This change does not apply to websocket connections. A change to websocket connections may be required to match this change.
* Fix a couple of PEP8 errors caused by previous rebase.
* update docs
add await syntax to response.write in response-streaming docs.
* remove commented out code from a test file
2018-08-18 18:12:13 -07:00
Eli Uriegas
b398c1fe72
Increment to 0.8.0
...
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
2018-08-17 11:43:15 -07:00
Eli Uriegas
6f813f940e
Merge pull request #1278 from ashleysommer/graceful_cancel
...
Gracefully handle when the request_handler_task is cancelled.
2018-08-17 11:41:39 -07:00
Ashley Sommer
79e35bbdf6
Fix auto_reload in Linux ( #1286 )
...
* Fix two problems with the auto_reloader in Linux.
1) Change 'posix' to 'linux' in sys.plaform check, because 'posix' is an invalid value and 'linux' is the correct value to use here.
2) In kill_process_children, don't just kill the 2nd level procs, also kill the 1st level procs.
Also in kill_process_children, catch and ignore errors in the case that the child proc is already killed.
* Fix flake8 formatting on PR
2018-08-16 23:30:03 -07:00
hqy
6abdf9f9c1
fixed #1143 ( #1276 )
...
* fixed #1143
* fixed build failed with create_serve call _helper failed
2018-08-15 10:23:04 -07:00
abuckenheimer
212da1029e
disabled auto_reload by default in windows ( #1280 )
2018-08-07 11:48:18 -07:00
Ashley Sommer
39ff02b6e4
Modifications the handle_request
function to detect and gracefully handle the case that the request_handler Task is canceled by the sanic server while it is handling the request. One common occurrence of this is when the server issues a ResponseTimeout error, it also cancels the response_handler Task.
...
The Canceled exception handler purposely sets `response` to `None` to drop references to the handler coroutine, in an attempt to preemptively release resources.
This commit also fixes a possible reference-before-assignment of the `response` variable in the `handle_request` function.
Finally, another byproduct of this change is that ResponseMiddleware will no longer run if the `response` is `None`.
2018-08-06 14:12:30 +10:00
Cosmo Borsky
b238be54a4
Add content_type flag to Sanic.static ( #1267 )
...
* Add content_type flag to Sanic.static
Fixes #1266
* Fix flake8 error in travis
Add line to document `content_type` arg
* Fix content_type for file streams
Update tests
herp derp
* Remove content_type as an arg to HTTPResponse
`response.HTTPResponse` will default to `headers['Content-Type']` instead of `content_type`
https://github.com/channelcat/sanic/pull/1267#discussion_r204190913
2018-07-20 22:31:15 -07:00
Cosmo Borsky
377c9890a3
Support status code for file reponse ( #1269 )
...
Fixes #1268
2018-07-20 13:39:10 -07:00
ciscorn
599834b0e1
Add subprotocols param to add_websocket_route ( #1261 )
2018-07-16 12:20:26 -07:00
John Doe
a39a7ca9d5
Add url_bytes to Request ( #1258 )
...
We need to have access to the raw unparsed URL.
2018-07-16 12:13:27 -07:00
Ave
cd22745e6b
Sanitize the URL before redirecting ( #1260 )
...
* URL Quote the URL before redirecting
* Use safe url instead of unsafe one
* Fix query params
* fix build
* Whitelist all reserved characters from rfc3986
* Add tests for redirect url sanitizing
* Remove check for resulting URL on header injection test
The thing the tests are testing for can be implemented in other
ways that don't redirect to 100% the same address, but they'll all have
to match the remaining parts of the test to succeed.
2018-07-12 21:31:33 -07:00
7
334649dfd4
Fix response ci header ( #1244 )
...
* add unit tests, which should fail
* fix CIDict
* moving CIDict to avoid circular imports
* fix unit tests
* use multidict for headers
* fix cookie
* add version constraint for multidict
* omit test coverage for __main__.py
* make flake8 happy
* consolidate check in for loop
* travisci retry build
2018-07-11 01:44:21 -07:00
7
f9b29fd7e7
py37 ( #1256 )
...
* add py37 to travisci
* use dist:xenial for py37
* sudo: true in .travici
* bump websockets version for py37 support and fix unit tests
2018-07-03 22:07:08 -07:00
Arnulfo Solís
9092ee9f0e
HTTP Entity Headers ( #1127 )
...
* introduced basic entity and hopbyhop header identification
* removed entity headers
* coding style fixes
* remove unneeded header check
* moved from bytes to unicode in headers
* changed list to tuple in empty response statuses
2018-06-26 22:25:25 -07:00
GaryO
01257f65a6
Make auto reloader work on Mac ( #1249 )
2018-06-18 15:16:10 -07:00
Volodymyr Maksymiv
5ff481952d
add UUID support ( #1241 )
2018-06-09 01:16:17 -07:00
Philip Xu
2f30f4f69f
Fixed #1231 - release resource no matter what ( #1232 )
2018-06-06 14:43:57 -07:00
Raphael Deem
202a4c6525
make request truthy if has transport ( #1222 )
2018-05-16 14:12:12 -07:00
Raphael Deem
8f2d543d9f
default to auto_reload in debug mode ( #1159 )
...
* default to auto_reload in debug mode
* disable auto-reload in testing client
2018-04-01 20:52:56 -07:00
Панков Василий
6454ac0944
Add __weakref__ to Request slots
2018-03-14 13:37:15 +03:00
Kinware
915d2732a1
Allow streaming handlers in add_route
2018-03-12 20:21:59 +01:00
Raphael Deem
3619b07843
Merge pull request #1146 from yunstanford/upgrade-test-client
...
Upgrade test client
2018-03-01 23:18:20 -08:00
Yun Xu
d1a8e8b042
fixed unit tests
2018-02-27 22:25:38 -08:00
Yun Xu
c39ddd00d3
workaround fix for an issue in aiohttp.Client
2018-02-27 21:42:41 -08:00
Yun Xu
d55e453bd5
cleaning up
2018-02-27 20:26:49 -08:00
Yun Xu
46ed2c5270
upgrade aiohttp for test_client
2018-02-26 22:08:05 -08:00
Julien00859
9c75ad3de1
close #1136
2018-02-21 00:50:27 +01:00
Raphael Deem
7e4a9e3bc2
Merge pull request #1047 from Yaser-Amiri/master
...
Add auto reloading.
2018-02-16 11:11:49 -08:00
Raphael Deem
36f12c822f
Merge pull request #1122 from knowsuchagency/master
...
add app.register_listener method
2018-02-15 16:58:27 -08:00
Stephan Fitzpatrick
1d75f6c2be
changed docstring spacing
2018-02-13 10:15:16 -08:00
Raphael Deem
ad8a168469
Merge pull request #1121 from tandalf/issue-1120
...
Fixed bug when passing a list into route decorator's host argument #1120
2018-02-12 12:48:13 -08:00
Yun Xu
745a1d6e94
document websocket args
2018-02-09 21:03:21 -08:00
Yun Xu
0fe0796870
expose websocket protocol arguments
2018-02-09 20:44:02 -08:00
Stephan Fitzpatrick
571b5b544d
added app.register_listener method w/test
2018-02-09 14:01:17 -08:00
Timothy Ebiuwhe
60774c5a49
Fixed bug that occurs on calling @app.route or any of it's variants
...
causes a route to be added twice. One without the slash, the other with the
Setting strict_slashes to false when a route does not end with slashes
slash. This is ok if the Router._add method runs linearly, but problematic
when it runs recursively. Unfortunately recursion is triggered when
the host param to the Router._add function is a list of hosts.
2018-02-09 22:27:20 +01:00
Raphael Deem
6d37ef7256
Merge pull request #1109 from DirkGuijt/master
...
fixed bug in multipart/form-data parser
2018-02-08 00:11:20 -08:00
Dirk Guijt
e083224df1
changed bewline formatting
2018-02-07 09:29:44 +01:00
Raphael Deem
ea2521f430
Merge pull request #1112 from boboldehampsink/extend_websocketprotocol_arguments
...
Extend WebSocketProtocol arguments
2018-02-06 15:05:58 -08:00
Raphael Deem
3fe31ff551
Merge pull request #1104 from arnulfojr/minor/keep-alive-timeout-log-level
...
KeepAlive Timeout log level change to debug
2018-02-02 18:54:24 -08:00
Dirk Guijt
48d45f1ca4
sorry, style issue again
2018-02-03 03:14:04 +01:00
Dirk Guijt
ddf2a604d1
changed 'file' variable to 'form_file' to prevent overwriting the reserved word
2018-02-03 03:07:07 +01:00
Arnulfo Solis
f2c0489452
replaced comparison for in operator
2018-02-02 20:19:15 +01:00
Arnulfo Solis
7ca3ad5d4c
no body and content length to 0 when 304 response is returned
2018-02-02 13:24:51 +01:00
Dirk Guijt
1eecffce97
fixed minor flake8 style problem
2018-02-02 09:57:06 +01:00
Dirk Guijt
5c341a2b00
made field name mandatory in multipart/form-data headers
...
A field name in the Content-Disposition header is required by the multipart/form-data spec. If one field/part does not have it, it will be omitted from the request. When this happens, we log it to DEBUG.
2018-02-02 09:43:42 +01:00
Arnulfo Solis
0ab64e9803
simplified logic when handling the body
2018-02-02 09:29:54 +01:00
Dirk Guijt
27108334f1
Merge branch 'master' of https://github.com/DirkGuijt/sanic
2018-02-02 00:55:58 +01:00
Dirk Guijt
788253cbe8
changes based on discussion on PR #1109
2018-02-02 00:55:51 +01:00
Arnulfo Solis
68fd1b66b5
Response model now handles the 204 no content
2018-02-01 17:51:51 +01:00
Bob Olde Hampsink
5806666949
Extend WebSocketProtocol arguments to accept all arguments of websockets.protocol.WebSocketCommonProtocol
2018-02-01 16:23:10 +01:00
DirkGuijt
a76d8108fe
small code style change
...
changed double quotes to single quotes to match the coding style
2018-02-01 11:55:30 +01:00
Arnulfo Solis
2135294e2e
changed None to return empty string instead of null string
2018-02-01 11:52:55 +01:00
Dirk Guijt
ed1c563d1f
fixed bug in multipart/form-data parser
...
Sanic automatically assumes that a form field is a file if it has a content-type header, even though the header is text/plain or application/json. This is a fix for it, I took into account the RFC7578 specification regarding the defaults.
2018-02-01 11:30:24 +01:00
Arnulfo Solis
cabcf50fbe
KeepAlive Timeout log level change to debug
2018-01-30 11:26:15 +01:00
NyanKiyoshi
285ad9bdc1
No longer raising a missing parameter when value is null
...
When passing a null value as parameter (ex.: 0, None or False), Sanic said "Error: Required parameter `param` was not passed to url_for"
Example:
```
@app.route("/<idx>")
def route(rq, idx):
pass
```
```
url_for("route", idx=0)
```
No longer raises: `Error: Required parameter `idx` was not passed to url_for`
2018-01-26 21:13:43 +01:00
howie6879
6c0fbef843
Add parameter check
2018-01-24 08:17:55 +08:00
howie6879
040c85a43b
Add parameter check
2018-01-24 08:11:47 +08:00
howie6879
f20b854dd2
Add parameter check
2018-01-22 14:52:30 +08:00
howie6879
3844cec7a4
Add parameter check
2018-01-22 14:12:41 +08:00
Yaser Amiri
f8b1122467
Revert "Change parsing cookies mechanism. (like Django instade of http.cookies.SimpleCookie)"
...
This reverts commit ba1dbacd35
.
2018-01-21 09:10:15 +03:30
Raphael Deem
f3bf5e9a5c
Merge pull request #1090 from yunstanford/patch-signal-handling
...
Patch signal handling
2018-01-20 14:03:23 -08:00
Yaser Amiri
ba1dbacd35
Change parsing cookies mechanism. (like Django instade of http.cookies.SimpleCookie)
2018-01-20 12:49:16 +03:30
Raphael Deem
22ad697d1f
Merge pull request #1078 from eltrhn/master
...
Add support for blueprint groups and nesting
2018-01-18 17:26:52 -08:00
Eli
a10d7469cd
Add blueprint groups + nesting
2018-01-18 17:20:51 -08:00
Yun Xu
7daebc6aea
fix Router.check_dynamic_route_exists
2018-01-15 17:53:37 -08:00
Yun Xu
09d6452475
fixed unit test
2018-01-15 15:15:08 -08:00
Yun Xu
6a61fce84e
worker process should ignore SIGINT when run_multiple
2018-01-15 11:53:15 -08:00
Yun Xu
11017902be
signal handling
2018-01-15 11:23:49 -08:00
Raphael Deem
ab97018c78
Merge pull request #1082 from channelcat/1042
...
fix exception handling
2018-01-13 17:06:46 -08:00
Dmitry Dygalo
c5c10cfb50
Fix typo
2018-01-13 17:56:29 +01:00
bow
4f8633375d
Fix log_response to correctly output request ip and port
2018-01-09 13:47:01 +01:00
howie6879
5f329f72ee
Update test_routes.py
2018-01-08 08:38:54 +08:00
howie6879
7303a06f83
Fix: the Chinese URI
2018-01-07 12:07:18 +08:00
howie6879
e34de96b24
Fix: the Chinese URI
2018-01-07 12:06:21 +08:00
howie6879
42cd424274
Fix: the Chinese URI
2018-01-07 10:59:12 +08:00
r0fls
7a1dab3319
fix exception handling
2018-01-05 14:12:22 -08:00
r0fls
46521240a9
fix timeout bug when self.transport is None
2018-01-03 23:33:22 -08:00
r0fls
8c28ce7d79
fix strict_slashes bug when route has slash
2018-01-01 02:24:48 -08:00
Raphael Deem
a1ffc6d55b
try to inject the app in add_task method
2017-12-27 01:06:43 -08:00
Yaser Amiri
81494453b0
Remove dependency on requests library.
...
Change auto reloader enviroment varible name to SANIC_SERVER_RUNNING
Fix some typo mistakes, flake uncompatibilities and such problems.
Raise NotImplementedError for operating systems except posix systems for auto reloading.
2017-12-26 19:17:13 +03:30
Raphael Deem
008cbe5ce7
Merge pull request #1069 from r0fls/1050
...
add samesite cookie to cookie keys
2017-12-24 02:50:37 -08:00
Raphael Deem
5ee35e7eeb
add samesite cookie to cookie keys
2017-12-24 02:33:52 -08:00
Raphael Deem
8e3f3977bd
allow add_task after server starts
2017-12-21 23:37:42 -08:00
Raphael Deem
9c02cdbad9
double quotes in unauthorized exception per rfc7230
2017-12-21 18:05:05 -08:00
Jeong YunWon
d54b406cba
Cancel request tasks when response timeout is triggered
...
Before: Even after raising ResponseTimeout, server still processes
remaining tasks until it is done
After: Before raising ResponseTimeout, server stops working task.
2017-12-14 18:43:52 +09:00
Raphael Deem
72254a7af9
Merge pull request #1054 from r0fls/rfc7231
...
fix issues with method not allowed response
2017-12-13 23:42:37 -08:00
Raphael Deem
52feff266e
fix edge case with methods as None
2017-12-13 23:23:04 -08:00
Raphael Deem
2c3f50e34a
fix stream handling
2017-12-13 23:06:18 -08:00
Raphael Deem
2b0258c13a
fix issues with method not allowed response
2017-12-11 20:12:26 -08:00
Dan Palmer
48c2dcb110
Fix ip and socket data format on V6
2017-12-11 22:16:03 +00:00
Yaser Amiri
3fe3c2c79f
Add test for auto reloading.
2017-12-07 20:19:40 +03:30
Yaser Amiri
52c2a8484e
Add auto reloader.
2017-12-07 16:30:54 +03:30
Eli Uriegas
1ea3ab7fe8
Increment to 0.7.0
...
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
2017-12-05 19:13:16 -08:00
Raphael Deem
1b0ad2c3cd
Merge pull request #1035 from yunstanford/patch-N
...
Adopt new websockets interface
2017-12-02 01:27:09 -08:00
lixxu
283762224c
clean codes
2017-11-28 14:47:43 +08:00
lixxu
f50a37fc88
ignore error if request.ip is None
2017-11-28 14:44:32 +08:00
Yun Xu
076f0515ca
Fix flake8
2017-11-25 21:14:18 -08:00
Yun Xu
f09c0393ba
adopt new websockets interface
2017-11-25 21:01:22 -08:00
Nikita Koshelev
76511d61e0
Added removing duplicate 'v' for Router.add()
version parameter
...
Fix sanic/router.py:123:80: E501 line too long (80 > 79 characters)
2017-11-18 01:39:00 +03:00
Nikita Koshelev
8e7475ccf6
Added regex escaping for Router.add()
version parameter
2017-11-18 01:22:42 +03:00
Edward Betts
cfc75b4f1a
Correct spelling mistakes.
2017-11-15 15:46:39 +00:00
Raphael Deem
98567fe5a8
Merge pull request #1008 from youknowone/pytest-xdist
...
Let SanicTestClient has its own port
2017-11-10 10:50:01 -08:00
Raphael Deem
979b5a52d3
Merge pull request #1005 from joar/feature/static-strict-slashes
...
Add strict_slashes to {app, blueprint}.static()
2017-11-07 07:49:32 -08:00
Joar Wandborg
e70535e8d7
Use .get instead of .pop
2017-11-07 10:34:17 +01:00
Jeong YunWon
ed8725bf6c
Let SanicTestClient has its own port
...
For parallel test running, the servers must have different ports.
See examples/pytest_xdist.py for example.
2017-11-06 17:29:32 +09:00
Raphael Deem
098cd70e82
Merge pull request #1007 from furious-luke/master
...
Call connection_open after websocket handshake
2017-11-05 14:26:19 -08:00
Raphael Deem
969dac2033
Merge pull request #1004 from Stibbons/optionalize_log_config
...
Optionalize app.run dictConfig (fix #1000 )
2017-11-04 12:35:38 -07:00
Gaetan Semet
49b1d667f1
Optionalize app.run dictConfig ( fix #1000 )
...
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
2017-11-04 15:58:27 +01:00
Luke Hodkinson
bca1e08411
Call connection_open after websocket handshake
...
It seems that due to (recent?) changes in the websocket library, we
now need to call "connection_open" to flag that the websocket is now
ready to use. I've added that call just after the call to
"connection_made".
2017-11-04 22:04:59 +11:00
Raphael Deem
bb8e9c6438
check if method is added in strict slash logic
2017-11-03 18:36:06 -07:00
Joar Wandborg
f128ed5b1f
Set threshold to 1MiB instead of 0.97MiB
...
Reference: https://en.wikipedia.org/wiki/Mebibyte#Definition
2017-11-03 14:37:01 +01:00
Joar Wandborg
ff5786d61b
pep8
2017-11-03 14:33:24 +01:00
Joar Wandborg
ca596c8ecd
Add strict_slashes to {Sanic, Blueprint}().static()
2017-11-02 15:44:36 +01:00
Raphael Deem
63bbcb5152
Merge branch 'master' into 977
2017-10-25 22:18:25 -07:00
Raphael Deem
5bf722c7ae
remove bare exceptions
2017-10-25 21:58:31 -07:00
Raphael Deem
c2191153cf
remove port from ip
2017-10-23 21:37:59 -07:00
davidtgq
5bcbc5a337
Replaced COMMON_STATUS_CODES with a simple 200 check for more fast ( #982 )
...
* Replaced COMMON_STATUS_CODES with a simple 200 check for more fast
* Added IPware algorithm
* Remove HTTP prefix from Django-style headers
Remove right_most_proxy because it's outside spec
* Remove obvious docstrings
* Revert "Replaced COMMON_STATUS_CODES with a simple 200 check for more fast"
This reverts commit 15b6980
* Revert "Added IPware algorithm"
This reverts commit bdf66cb
WTF HOW DO I GIT
* Revert "Revert "Replaced COMMON_STATUS_CODES with a simple 200 check for more fast""
This reverts commit d8df095
* Revert "Added IPware algorithm"
This reverts commit bdf66cb
* Delete ip.py
2017-10-19 16:43:07 -07:00
Eli Uriegas
0e92d8ce2c
Merge branch 'master' into worker-protocol
2017-10-19 16:21:18 -07:00
Eli Uriegas
727d6a1b61
Merge pull request #972 from lanfon72/patch-2
...
to fix condition error that used in `log_response`
2017-10-19 16:16:57 -07:00
Raphael Deem
666c0847b7
Merge pull request #976 from ashleysommer/fix_websocket_timeout
...
Fix Websocket protocol timeouts after #939
2017-10-18 21:20:52 -07:00
Raphael Deem
9150767574
add blueprint name to request.endpoint
2017-10-16 23:25:37 -07:00
Raphael Deem
75f2180cb1
add handler name to request as endpoint
2017-10-16 22:43:40 -07:00
Ashley Sommer
ea5b07f636
Update websocket protocol to accomodate changes in HTTP protocol from https://github.com/channelcat/sanic/pull/939
...
Fixes https://github.com/channelcat/sanic/issues/969
2017-10-16 11:06:33 +10:00
Ashley Sommer
477e6b8663
Add documentation for REQUEST_TIMEOUT, RESPONSE_TIMEOUT and KEEP_ALIVE_TIMEOUT config values.
...
Fixed some inconsistent default values.
2017-10-16 10:53:45 +10:00
Raphael Deem
a0d8418b40
Merge pull request #965 from samael500/master
...
fix issue #959
2017-10-13 14:58:46 -07:00
Raphael Deem
006fb08024
Merge pull request #966 from yunstanford/patch-M
...
Sanic routes should not pass angled params with empty names
2017-10-13 02:18:20 -07:00
lanf0n
4578f6016b
to fix condition error that used in log_response
...
`request` class is derived from `dict`, so it will never be `True`.
2017-10-13 16:48:02 +08:00
Raphael Deem
5b06bcc57d
Merge pull request #967 from samael500/custom_filename
...
Custom filename
2017-10-13 01:35:11 -07:00
pcinkh
6d2f5da506
Speedup websocket disconnects.
2017-10-11 14:02:26 +03:00
Yun Xu
c96df86111
make flake8 happy
2017-10-09 07:58:04 -07:00
Maks Skorokhod
86f87cf4ac
🔧 no use f'string'
2017-10-09 17:55:35 +03:00
Yun Xu
770a8fb288
raise exception for invalid param syntax
2017-10-09 07:54:39 -07:00
Maks Skorokhod
07e95dba4f
🔁 customize filename in file response
2017-10-09 17:45:22 +03:00
Maks Skorokhod
7610c0fb2e
🔧 log Connection lost only if debug
2017-10-09 15:50:36 +03:00
Raphael Deem
0189e4ed59
Merge pull request #962 from ProstoMaxim/fix_logs
...
Fix logs
2017-10-08 20:16:11 -07:00
Max Murashov
4b3920daba
Fix logs
2017-10-06 16:53:30 +03:00
Raphael Deem
d876e3ed5c
fix false cookie encoding and output
2017-10-05 22:20:50 -07:00
Piotr Buliński
4b877e3f6b
Update server.py
2017-10-05 09:28:13 +02:00
Piotr Buliński
8ce749e339
Update server.py
2017-10-05 09:27:18 +02:00
Piotr Buliński
752ddfa7fc
Merge branch 'master' into refactor_server_access_log
2017-10-05 09:26:19 +02:00
Piotr Bulinski
e3852ceeca
Refactor access log for server
2017-10-04 12:50:57 +02:00
Yun Xu
225ea49b6f
resolve conflicts again
2017-10-01 01:22:27 -07:00
Raphael Deem
15fd49037f
Merge pull request #939 from ashleysommer/keepalive_timeout
...
Split RequestTimeout, ResponseTimeout, and KeepAliveTimeout into different timeouts
2017-09-30 22:15:50 -07:00
Raphael Deem
9aec5febb8
support vhosts in static routes
2017-09-27 01:24:49 -07:00
lixxu
f96ab02767
set scheme to http if not provided
2017-09-27 09:59:49 +08:00
Raphael Deem
4ce699e57f
Merge pull request #944 from blazehu/master
...
add __repr__ for sanic request
2017-09-25 13:58:09 -07:00
Raphael Deem
4ee042c330
Merge pull request #948 from chiuczek/json-dependency-injection
...
Use dependency injection to allow alternative json parser or encoder
2017-09-24 21:05:39 -07:00
Yun Xu
0b23f4ff81
resolve conflicts
2017-09-23 06:19:09 -07:00
Hugh McNamara
5cef1634ed
use json_loads function in json property of request
2017-09-22 10:19:15 +01:00
Hugh McNamara
a8f764c161
make method instead of property for alternative json decoding of request
2017-09-19 18:12:53 +01:00
Hugh McNamara
1d719252cb
use dependency injection to allow alternative json parser or encoder
2017-09-19 14:58:49 +01:00
lanf0n
d8cebe1188
to fix if platform is windows.
2017-09-19 18:14:25 +08:00
huyuhan
074d36eeba
add __repr__ for sanic request
2017-09-15 21:15:05 +08:00
huyuhan
f6eb35f67d
add __repr__ for sanic request
2017-09-15 21:05:25 +08:00
huyuhan
77f70a0792
add __repr__ for sanic request
2017-09-15 20:56:44 +08:00
huyuhan
12dafd07b8
add __repr__ for sanic request
2017-09-15 18:34:56 +08:00
Wèi Cōngruì
eb1146c6b6
fix #763 , sanic can't decode latin1 encoded header value
2017-09-14 19:23:02 +08:00
Yun Xu
5ee7b6caeb
fixing small issue
2017-09-13 10:35:34 -07:00
Yun Xu
9c4b0f7b15
fix flake8
2017-09-13 07:40:42 -07:00
aiosin
2e5d1ddff9
add status codes and teapot example
2017-09-13 14:08:29 +02:00
Yun Xu
24bdb1ce98
add unit tests/refactoring
2017-09-12 23:42:42 -07:00
Ashley Sommer
8eb59ad4dc
Fixed error where the RequestTimeout test wasn't actually testing the correct behaviour
...
Fixed error where KeepAliveTimeout wasn't being triggered in the test suite, when using uvloop
Fixed test cases when using other asyncio loops such as uvloop
Fixed Flake8 linting errors
2017-09-13 10:18:36 +10:00
Raphael Deem
d8c8ccd180
Merge pull request #932 from lixxu/master
...
static files url building using url_for
2017-09-12 12:59:04 -07:00
Yun Xu
a46e004f07
apply new loggers
2017-09-11 22:12:49 -07:00
Ashley Sommer
2979e03148
WIP - Split RequestTimeout, ResponseTimout, and KeepAliveTimeout into different timeouts, with different callbacks.
2017-09-11 17:17:33 +10:00
Yun Xu
4bdb9a2c8e
prototype
2017-09-10 23:19:09 -07:00
Yun Xu
986135ff76
remove DefaultFilter
2017-09-10 18:39:42 -07:00
Yun Xu
c9cbc00e36
use access_log as param
2017-09-10 18:38:52 -07:00
Yun Xu
c9a40c180a
remove some logging stuff
2017-09-10 11:11:16 -07:00
Yun Xu
c4417b399b
fixing debug logging
2017-09-08 17:47:05 -07:00
lixxu
bc20dc5c62
use url_for for url building for static files
2017-09-06 19:17:52 +08:00
Tim Mundt
e2e25eb751
fixed flake convention
2017-09-05 11:05:31 +02:00
Tim Mundt
9572ecc5ea
test for env var prefix
2017-09-05 10:58:48 +02:00
Tim Mundt
97d8b9e908
documentation for env var prefix; allow passing in the prefix through the app constructor
2017-09-05 10:41:55 +02:00
Tim Mundt
c59a8a60eb
make the prefix for environment variables alterable
2017-09-05 09:53:33 +02:00
Raphael Deem
158da0927a
Merge pull request #901 from lixxu/master
...
add name option for route building
2017-08-31 15:29:03 -07:00
Darren
6038813d03
fix #914 , change arguments of Unauthorized.__init__
2017-08-24 22:59:25 +08:00
lixxu
762b2782ee
use name to define route name for different methods on same url
2017-08-22 14:02:38 +08:00
lixxu
eab809d410
add name option for route building
2017-08-21 18:05:34 +08:00
Yun Xu
63babae63d
add doc
2017-08-21 00:28:01 -07:00
Yun Xu
ef81a9f547
make strict_slashes default value configurable
2017-08-20 23:11:38 -07:00
Raphael Deem
df4a149cd0
Merge pull request #885 from yunstanford/master
...
add triggers events when async create_server
2017-08-09 15:59:44 -07:00
Yun Xu
80f27b1db9
add unit tests and make flake8 happy
2017-08-08 22:21:40 -07:00
Yun Xu
d5d1d3b45a
add trigger before_start events in create_server
2017-08-08 21:58:10 -07:00
Miguel Grinberg
375ed23216
Weboscket subprotocol negotiation
...
Fixes #874
2017-08-08 11:40:44 -07:00
MichaelYusko
7216bf7835
merge master into local branch
2017-08-03 12:11:47 +03:00
Eli Uriegas
f80a6ae228
Increment to 0.6.0
2017-08-02 19:11:53 -07:00
Eli Uriegas
2228104bff
Merge pull request #862 from zyguan/revert-599fbce
...
revert 599fbce
2017-07-31 13:51:04 -07:00
Raphael Deem
402c3752c4
Merge pull request #871 from Frzk/unauthorized-exception
...
Simplified the Unauthorized exception __init__ signature.
2017-07-31 12:23:12 -07:00
François KUBLER
69a8bb5e1f
Fixed a trailing white space in the docstring.
2017-07-28 22:29:45 +02:00
François KUBLER
b65eb69d9f
Simplified the Unauthorized exception __init__ signature.
...
(again).
Use of **kwargs makes it more straight forward and easier to use.
2017-07-27 23:00:27 +02:00
MichaelYusko
429f7377cb
Did the small changes for better readable
2017-07-26 19:32:23 +03:00
zyguan
918e2ba8d0
Revert "fix #752 "
...
This reverts commit 599fbcee6e
.
2017-07-24 11:53:11 +08:00
zyguan
f50dc83829
handle keep-alive timeout gracefully
2017-07-24 01:37:36 +08:00
Raphael Deem
173c62acb6
Merge branch 'master' into unauthorized-exception
2017-07-21 01:54:45 -07:00
Mohamed Akram
32be1a6496
Fix FreeBSD syslog path
2017-07-20 03:02:40 +04:00
Yun Xu
198bf55b7b
flake8 fix
2017-07-14 17:23:18 -07:00
Yun Xu
75378d3567
add remote_addr property for proxy fix
2017-07-14 09:29:16 -07:00
zenix
426e00b6f4
dont let dictConfig influence already exists configs
2017-07-13 15:09:04 +09:00
Raphael Deem
4265ad5f23
add versioning
2017-07-12 22:19:42 -07:00
Raphael Deem
8aafd72ef0
Merge branch 'auto-doc' of https://github.com/yunstanford/sanic
2017-07-12 20:19:30 -07:00
Jeong YunWon
47abf83960
Protocol configurable gunicorn worker
2017-07-12 22:30:13 +09:00
Jeong YunWon
be0f3731b4
ensure loop.close() and sys.exit() in gunicorn worker
2017-07-12 22:26:58 +09:00
Yun Xu
235687d983
should call lower just once
2017-07-10 12:37:21 -07:00
Yun Xu
3d75e6ed95
case-insensitive check for header fields
2017-07-10 12:29:47 -07:00
Raphael Deem
f0a956467c
Merge pull request #815 from yunstanford/master
...
add graceful timeout when shutdown
2017-07-08 11:31:37 -07:00
Yun Xu
e48bd08095
make flake8 happy
2017-07-02 10:05:33 -07:00
Yun Xu
5d00717f39
improve doc and remove warnings
2017-07-02 10:02:04 -07:00
Yun Xu
3fff685c44
add auto-doc support
2017-07-01 23:46:34 -07:00
Raphael Deem
1e75265eed
Merge pull request #756 from qwesda/master
...
fixes #755 fragmented headers
2017-06-30 18:24:51 -07:00
Raphael Deem
421f78f3e6
Merge pull request #814 from Frzk/forbidden-exception
...
Added a Forbidden exception
2017-06-30 18:11:23 -07:00
Raphael Deem
00d4533022
Merge pull request #821 from Frzk/bearer-support
...
Inverted the order of prefixes in Request.token property.
2017-06-29 09:43:34 -07:00
François KUBLER
e427e38da8
Simplified the Unauthorized.__init__
signature.
...
It doesn't really make sense to have a `realm` parameter in the method signature.
Instead, one can simply set the realm in the `challenge` dict if necessary.
Also fixed the tests accordingly (and added a new one for "Bearer" auth-scheme).
2017-06-29 12:34:52 +02:00
François KUBLER
1f24abc3d2
Fixed support for "Bearer" and "Token" auth-schemes.
...
Removed the test for "Authentication: Bearer Token <TOKEN>" which was not supposed to exist (see https://github.com/channelcat/sanic/pull/821 )
Also added a call to `split` when retrieving the token value to handle cases where there are leading or trailing spaces.
2017-06-29 10:23:49 +02:00
François
76e62779ba
Merge branch 'master' into forbidden-exception
2017-06-28 17:25:40 +02:00
Daniel Schwarz
b141fec573
Merge remote-tracking branch 'upstream/master'
...
# Conflicts:
# sanic/server.py
2017-06-27 13:32:49 +02:00
François KUBLER
d2e14abfd5
Inverted the order of prefixes in Request.token property.
...
As suggested by @allan-simon
See: https://github.com/channelcat/sanic/pull/811#pullrequestreview-46144327
2017-06-27 12:57:47 +02:00
Raphael Deem
d4abca0480
Merge pull request #818 from youknowone/debug
...
Introduce debug mode for HTTP protocol
2017-06-26 22:02:37 -07:00
Raphael Deem
395d85a12f
use try/except
2017-06-26 21:35:01 -07:00
Raphael Deem
4379a4b067
float logic
2017-06-26 20:59:59 -07:00
Raphael Deem
ad8e1cbf62
convert environment vars to int if digits
2017-06-26 20:49:41 -07:00
Jeong YunWon
dc5a70b0de
Introduce debug mode for HTTP protocol
2017-06-26 21:13:13 +09:00
Yun Xu
b5d1f52ea4
make flake8 happy
2017-06-25 10:22:40 -07:00
Yun Xu
d812affef0
add graceful_shutdown_timeout to gunicorn worker
2017-06-25 00:51:14 -07:00
Yun Xu
5c19eb34bf
add graceful_shutdown_timeout
2017-06-24 19:00:33 -07:00
Eli Uriegas
dbcbf12456
Merge pull request #811 from Frzk/bearer-support
...
Added support for 'Authorization: Bearer <TOKEN>' header...
2017-06-23 10:32:21 -07:00
Eli Uriegas
c04b44057c
Merge pull request #813 from Frzk/unauthorized-exception
...
Added an Unauthorized exception
2017-06-23 10:30:51 -07:00
François KUBLER
2848d7c80e
Added a Forbidden exception
...
Also added a small test.
2017-06-23 16:44:57 +02:00
François KUBLER
9fcdacb624
Modified the name of an argument.
2017-06-23 16:29:04 +02:00
François KUBLER
cf1713b085
Added a Unauthorized exception.
...
Also added a few tests related to this new exception.
2017-06-23 16:12:15 +02:00
7
f049a4ca67
Recycling gunicorn worker ( #800 )
...
* add recycling feature to gunicorn worker
* add unit tests
* add more unit tests, and remove redundant trigger_events call
* fixed up unit tests
* make flake8 happy
* address feedbacks
* make flake8 happy
* add doc
2017-06-22 13:26:50 -07:00
François KUBLER
55f860da2f
Added support for 'Authorization: Bearer <TOKEN>' header in Request.token
property.
...
Also added a test case for that kind of header.
2017-06-22 18:11:23 +02:00
Nikola Kolevski
d865c5e2b6
Conform to pep8
2017-06-20 13:22:28 +02:00
Nikola Kolevski
9fac37588c
Allow textual responses when using test_client and aiohttp 2
2017-06-20 13:15:30 +02:00
Eli Uriegas
b37e6187d4
Merge pull request #802 from yunstanford/add-match-info
...
Add match_info property to request class
2017-06-18 10:15:46 -07:00
Yun Xu
20138ee85f
add match_info to request
2017-06-17 09:47:58 -07:00
Eran Kampf
77cf0b678a
Fix has_log value
2017-06-15 11:21:08 -07:00
Eran Kampf
2dfb061063
Prevent run
from overriding logging config set in constructor
...
When creating the `Sanic` instance I provide it with a customized `log_config`.
Calling `run` overrides these settings unless I provide it *again* with the same `log_config`.
This is confusing and error prone. `run` shouldnt override configurations set in the `Sanic` constructor...
2017-06-15 10:39:00 -07:00
Raphael Deem
599fbcee6e
fix #752
2017-06-11 23:20:04 -07:00
Eli Uriegas
38997c1b47
Merge pull request #786 from yunstanford/handle_stream_404
...
Handle stream 404
2017-06-10 10:03:54 -07:00
Yun Xu
cf30ed745c
also should handle InvalidUsage exception
2017-06-10 09:42:48 -07:00
Yun Xu
4942af27dc
handle NotFound
2017-06-09 08:33:34 -07:00
Jeong YunWon
29b4a2a08c
Gunicorn worker hints app weather it is being terminated
...
For now, `Sanic.is_running` is set when the worker is started but not
unset when it is about to stopped. Setting the flag for quit signal
will not affect working requests, but the `Sanic.is_running` flag still
can be used to support graceful termination.
2017-06-09 14:51:15 +09:00
Yun Xu
aac99c45c0
add content_type property in request
2017-06-07 20:46:48 -07:00
Miroslav Batchkarov
3f22b644b6
wrap call to json in try-except to make tests pass
2017-06-07 09:57:07 +01:00
Miroslav Batchkarov
199fa50a9d
also store json result in local request
2017-06-05 16:24:23 +01:00
Tue Topholm
3d97fd8d2a
Removed whitespace
2017-06-01 23:09:37 +02:00
Tue Topholm
c102e76146
Fixed line width
2017-06-01 23:01:27 +02:00
Tue Topholm
f47e571d92
Added content_type to be set for son response
2017-06-01 22:53:56 +02:00
Daniel Schwarz
30c2c89c6b
fix partial url parsing
2017-05-30 16:13:49 +02:00
Daniel Schwarz
aaef2fbd01
fix flake8 errors
2017-05-28 18:46:07 +02:00
Daniel Schwarz
0e5c7a62cb
remove debug messages
2017-05-27 22:36:08 +02:00
Daniel Schwarz
1b33e05f74
fix debug log messages
2017-05-27 16:32:39 +02:00
Daniel Schwarz
53a04309ff
add header_fragment handeling
2017-05-27 16:28:57 +02:00
Daniel Schwarz
dc411651b6
add check for header and value
2017-05-27 15:36:57 +02:00
Daniel Schwarz
514540b90b
add debug for header values
2017-05-27 15:32:37 +02:00
messense
0024edbbb9
Add websocket max_size and max_queue configuration
2017-05-26 11:15:28 +08:00
Eli Uriegas
48de321869
Merge pull request #697 from 38elements/stream
...
Add Request.stream
2017-05-24 16:22:52 -07:00
Raphael Deem
c6d68009d2
Merge pull request #745 from messense/feature/gunicorn-worker-test-case
...
Add a simple integration test for Gunicorn worker
2017-05-23 20:53:01 -07:00
Raphael Deem
2cab267405
Merge pull request #734 from ashleysommer/static_large_file_stream
...
Add option to static helper to use streaming for large files.
2017-05-23 20:52:12 -07:00
messense
6bdc0d2e5e
Fix Gunicorn worker
2017-05-23 11:28:12 +08:00
Raphael Deem
b447807b36
Merge pull request #742 from r0fls/700
...
changes required for unix socket support
2017-05-22 19:29:32 -07:00
Raphael Deem
52b0254ec6
unix socket support; fixes #700
2017-05-21 03:15:06 -07:00
Raphael Deem
49631542ce
Merge pull request #732 from jrocketfingers/feature/explicit-register-middleware
...
Extract register_middleware into a method.
2017-05-21 03:06:12 -07:00
Raphael Deem
4b80ffb9eb
Merge pull request #740 from r0fls/739
...
add abort function
2017-05-21 02:20:02 -07:00
Raphael Deem
9efa7c116d
remove redundant code; decode response
2017-05-20 23:27:00 -07:00
Raphael Deem
1a60201f68
flake8 spacing
2017-05-20 10:44:09 -07:00
Raphael Deem
f3186abf09
SANIC_EXCEPTIONS -> _sanic_exceptions
2017-05-20 10:29:00 -07:00
Raphael Deem
588b4712bf
add exception decorator
2017-05-20 01:24:34 -07:00
Raphael Deem
d3b6208057
add abort function
2017-05-19 18:52:19 -07:00
Ashley Sommer
ef80953b1b
Fix flake8 line length error.
2017-05-20 09:56:05 +10:00
ashleysommer
72db1188c7
Add an option to the static() helper to switch on streaming for large files.
...
By default uses a 1M threshold.
ie. if the static file to serve is >= 1M it will stream the file.
This threshold value is configurable by passing an int instead of a bool to `stream_large_files` parameter of `static()`.
2017-05-20 09:56:05 +10:00
Raphael Deem
58a9c92d75
fix 739
2017-05-19 13:35:04 -07:00
Ashley Sommer
ff2ae11ac8
Remove exception print(e) statement.
2017-05-19 13:00:01 +10:00
Johnny Rocketfingers
3f841f3b21
Switch to non-hardcoded register_middleware.
2017-05-18 22:08:44 +02:00
ashleysommer
e155fe403d
Add file_stream response handler
...
For streaming large static files
Like `file()` but breaks the file into chunks and sends it with a `StreamingHTTPResponse`
Chunk size is configurable, but defaults to 4k, this seemed to be the sweet spot in my testing.
Also supports ContentRange same as `file()` does.
2017-05-18 18:04:28 +10:00
Johnny Rocketfingers
bf5438d573
Extract register_middleware into a method.
2017-05-18 06:36:11 +02:00
Raphael Deem
0e4aaf8856
Merge pull request #731 from jrocketfingers/fix/token-missing-auth-headers
...
Check that the Authorization headers are actually provided.
2017-05-17 13:10:12 -07:00
Raphael Deem
5c44ce1637
Merge pull request #719 from messense/feature/worker-uvloop
...
Gunicorn worker should not require uvloop
2017-05-17 12:47:19 -07:00
Raphael Deem
974fe25a11
Merge pull request #722 from messense/feature/ci-without-ext
...
Add py3*-no-ext test env
2017-05-17 12:47:05 -07:00
Johnny
5d309af86f
Check that the headers are actually provided.
2017-05-17 11:08:50 +02:00
messense
2f84cdd708
Fix websocket handler bug on Python3.5 with no uvloop
2017-05-17 12:12:25 +08:00
messense
7cc02e84ed
Fix json loads bug on Python 3.5
2017-05-17 12:12:25 +08:00
messense
05d0ddc281
Gunicorn worker should not require uvloop
2017-05-15 00:01:51 +08:00
Johnny Rocketfingers
b1890f50b6
Conform to pep8
2017-05-14 10:15:11 +02:00
Johnny Rocketfingers
b44c707e94
Prevent incorrect tuple size on get_extra_info errors
...
According to https://docs.python.org/3/library/asyncio-protocol.html#asyncio.BaseTransport.get_extra_info ,
get_extra_info fails by returning None. This is an attempt in
normalization of the response in cases of AF_INET, AF_INET6 and
erroneous return values.
2017-05-14 09:56:56 +02:00
Johnny
4c7675939a
Fix "TypeError: not all arguments converted during string formatting"
...
socket.getpeername() returns AF_INET6 address family four-tuple, with
flowid and scopeid.
In server's write_response, an exception is raised when an IPv6 client
connects due to four-tuple elements having two unused elements (flowid
and scopeid).
This makes sure that only the first two (host and port) are used in log
string formatting.
2017-05-13 17:35:04 +02:00
Eli Uriegas
fa1b7de52a
Merge pull request #706 from messense/feature/remove-log-file
...
Remove timedRotatingFile log config
2017-05-12 10:56:19 -07:00
Jeremy Zimmerman
f39512aa63
double if statement ( #707 )
...
* Migrated `%` string formating
* double if statement
combined double 'if' to a single 'if' with 'and'
* Revert "Fix "Prefer `format()` over string interpolation operator" issue"
2017-05-11 11:49:32 -07:00
messense
c3683662c2
Remove timedRotatingFile log config
2017-05-11 11:18:59 +08:00
38elements
6a14e49479
Replace stream decorator to stream parameter
2017-05-09 22:31:15 +09:00
Eli Uriegas
ac5e1a6ebd
Fix import
2017-05-08 20:47:20 -07:00
Eli Uriegas
bfcd499cc2
Remove default_filter module, put into logging
2017-05-08 20:41:34 -07:00
Eli Uriegas
3e88ec18e2
Actually add file >.>
2017-05-08 20:37:44 -07:00
Eli Uriegas
1fb640c313
Fix camel case module
2017-05-08 20:36:57 -07:00
Eli Uriegas
307d866bb6
Increment to 0.5.4
2017-05-08 17:44:23 -07:00
Eli Uriegas
768be433d6
Increment to 0.5.3
2017-05-08 17:42:26 -07:00
38elements
4d4f38fb35
is_request_stream for CompositionView and HTTPMethodView
2017-05-09 01:04:03 +09:00
38elements
0b53c413a7
Add stream decorator for HTTPMethodView
2017-05-07 21:33:15 +09:00
38elements
931397c7e1
Add stream for CompositionView
2017-05-07 18:38:48 +09:00
38elements
ef2cc7ebf5
Add Request.stream
2017-05-07 18:38:48 +09:00
38elements
25037006bf
Remove utils.py
2017-05-04 15:52:18 +09:00
38elements
e12c10b087
Remove loop argument in run() and create_server()
2017-05-03 17:52:19 +09:00
38elements
0a2c95cc10
Remove before_start, before_stop, after_start and after_stop
2017-05-02 23:07:09 +09:00
Eli Uriegas
c35721abbd
Merge pull request #670 from ticosax/set-exit-code-on-error
...
In case of error when starting sanic
2017-05-01 15:16:02 -07:00
Alec Buckenheimer
69511c2783
added exception chain rendering in debug #675
2017-05-01 12:56:33 -04:00
banteg
7754bb995b
expose matched request uri template
2017-04-29 02:39:56 +07:00
Nicolas Delaby
d1fefce61c
fixup! In case of error when starting sanic
2017-04-28 20:06:44 +02:00
Nicolas Delaby
c3abdab9c4
The main process that spawn sub processes doesn't run any loop.
...
let's not try to stop one
2017-04-28 19:57:49 +02:00
Nicolas Delaby
8b13e103fd
In case of error when starting sanic
...
Don't exit with code 0
2017-04-28 19:08:51 +02:00
Eli Uriegas
436d37c079
Add the killing of children
...
Kills children processes when parent process receives a signal to
shutdown.
Solves for #594
2017-04-27 17:47:08 -07:00
Eli Uriegas
ed0081fcf7
Merge pull request #625 from zenixls2/master
...
based on issue #608 , create access log
2017-04-27 14:31:53 -07:00
Eli Uriegas
140062f8a3
Merge pull request #662 from rsrdesarrollo/master
...
invariant: body after request is processed must be binary
2017-04-27 14:31:28 -07:00
Philip Xu
9152a1a266
Improved on wording
2017-04-27 03:16:38 -04:00
Philip Xu
ade89ab795
Fix #665 - ImportError not preserved in __main__.py
2017-04-26 22:57:19 -04:00
Raúl Sampedro
85acddddba
invariant: body after request is processed must be binary
2017-04-25 12:00:27 +02:00
zenix
c9d747d97f
fix merge error
2017-04-25 11:46:13 +09:00
zenix
0bba267808
Merge branch 'master' of https://github.com/channelcat/sanic
2017-04-25 11:07:40 +09:00
Eli Uriegas
5fd62098bd
Increment to 0.5.2
2017-04-24 11:37:04 -07:00
Raphael Deem
74cc7be922
Merge branch 'master' into master
2017-04-24 00:47:01 -07:00
Raphael Deem
b3814ca89a
Merge pull request #646 from r0fls/637
...
allow disabling keep alive
2017-04-24 00:43:16 -07:00
Raphael Deem
9caa4fec4a
Merge pull request #656 from r0fls/token-rework
...
update token attribute
2017-04-21 22:44:42 -07:00
Raphael Deem
a0cba1aee1
accept token directly in auth header
2017-04-21 22:36:45 -07:00
Eli Uriegas
a7d17fae44
Fix duplicate signal settings for gunicorn worker
2017-04-21 17:06:52 -05:00
38elements
bc035fca78
Remove unnecessary variables
2017-04-20 18:27:28 +09:00
38elements
df914a92e4
Fix this.signal.stopped
is True
#639
2017-04-19 11:19:01 +09:00
Raphael Deem
81b6d988ec
NO_KEEP_ALIVE -> KEEP_ALIVE
2017-04-16 22:43:49 -07:00
Raphael Deem
5ddb0488f2
allow disabling keep alive
2017-04-16 22:03:20 -07:00
Raphael Deem
3e87314adf
use absolute path in static root
2017-04-16 21:58:10 -07:00
Raphael Deem
f6d4a06661
Merge pull request #643 from aryeh/allow_unknown_status_codes
...
Allow unknown status codes
2017-04-16 18:42:59 -07:00
Raphael Deem
ff17fc95e6
Merge pull request #632 from messense/feature/path-route
...
Add path type for router
2017-04-16 18:39:10 -07:00
aryeh
ff0632001c
prevent crash for unknown response codes
...
set text for unknown status code, otherwise when None is used exception occurs.
2017-04-16 10:07:29 -04:00
lazydog
ae09dec05e
fixed UnboundLocalError
2017-04-14 03:38:55 +08:00
lazydog
afd51e0823
fix directory traversal flaw
2017-04-14 02:55:39 +08:00
zenix
0bbf826b21
fix typo
2017-04-13 16:52:40 +09:00
zenix
02d1900e2f
try to fix container error
2017-04-13 16:49:36 +09:00
zenix
73da11b04c
switch to use streaming for access log and error log
2017-04-13 16:26:13 +09:00
zenix
4af07e3731
change naming of default log config
2017-04-13 13:49:45 +09:00
zenix
7f60f85cd4
Merge branch 'master' of https://github.com/channelcat/sanic
2017-04-13 13:35:37 +09:00
messense
4c66cb1854
Fix static files router
2017-04-13 12:11:38 +08:00
messense
35b92e1511
Add path type for router
2017-04-13 11:34:35 +08:00
Raphael Deem
e5d3fe52c5
Merge pull request #630 from 38elements/keep_alive
...
Refactor keep_alive
2017-04-12 19:46:33 -07:00
zenix
c5f137c715
fix original code logic
2017-04-12 18:52:01 +09:00
zenix
66923bc0e3
remove unused param
2017-04-12 18:48:16 +09:00
zenix
36d4d85849
change to use default python config code
2017-04-12 18:44:47 +09:00
zenix
5f0e05f3bf
fix flake8
2017-04-12 18:08:06 +09:00
adam.serafini
235e5511eb
Bump version
2017-04-12 11:02:13 +02:00
zenix
6fb60ae0b1
Merge branch 'master' of https://github.com/channelcat/sanic
2017-04-12 18:01:12 +09:00
38elements
7fe418d1b7
Refactor keep_alive
2017-04-12 17:55:22 +09:00
zenix
f872ceb0d9
fix bug in access logging when error happens
2017-04-12 17:39:17 +09:00
Eli Uriegas
015c87b5e1
Add traceback for better debugging
2017-04-11 16:02:57 -05:00
Eli Uriegas
084f0d27a3
Increment to 0.5.0
2017-04-11 15:19:00 -05:00
Eli Uriegas
522a0beec0
Merge pull request #622 from aryeh/provide_request_object
...
Allow a custom Request class to be passed in to Sanic
2017-04-11 15:13:05 -05:00
zenix
bf46bcf376
Merge branch 'logging'
2017-04-11 19:03:35 +09:00
zenix
f330c3f8c5
add logging based on issue #608 , add default config
2017-04-11 18:59:07 +09:00
ivan
09885534c6
fixed #615
2017-04-10 18:31:28 +08:00
aryeh
b9dfec38c2
Break long line (> 80 chars) into 2 lines
2017-04-09 13:38:36 -04:00
aryeh
2ef8120073
Allow a custom Request class to be passed in to Sonic
...
Allowing a custom Request class to be defined would enable either a different Request class or a subclass of Request to be used, providing more flexibility.
2017-04-09 13:29:21 -04:00
Raphael Deem
8cf7dce33f
fix python -m method of running
2017-04-08 13:31:17 -07:00
Raphael Deem
7e3496f8aa
Merge pull request #614 from dkruchinin/middleware
...
Response middleware should be called even if server replies with an error
2017-04-06 11:49:44 -07:00
Raphael Deem
1854ad133c
use socket.set_inheritable instead of os version
2017-04-04 13:13:52 -07:00
Dan Kruchinin
f0a59fccf8
flake8-related fixes
2017-04-04 17:19:45 +01:00
Dan Kruchinin
46dbaf95a6
Response middleware should be called even if server replies with error
2017-04-04 15:55:43 +01:00
Jeong YunWon
429e90183b
Add #379 again and make related test rework
...
Original PR: https://github.com/channelcat/sanic/pull/379
2017-04-03 18:56:39 +09:00
monobot
e148b50d6a
Merge remote-tracking branch 'upstream/master'
2017-04-02 00:02:49 +01:00
Raphael Deem
06d46d56cd
Merge pull request #602 from jkbbwr/fix/env-install
...
Flake8 cleanup. Setup environmental variables.
2017-03-31 10:42:21 -07:00
Jakob Bowyer
daedda8547
Checked out original tests
2017-03-31 08:51:12 +01:00
monobot
6c003f71f4
Merge remote-tracking branch 'upstream/master'
2017-03-29 23:54:11 +01:00
monobot
5b704478d9
raw_args for request objects
2017-03-29 22:06:54 +01:00
Eli Uriegas
60eb528d68
Merge pull request #491 from r0fls/remove-stop-event
...
remove stop_event
2017-03-29 07:08:55 -05:00
Eli Uriegas
18405b3908
There was a line missing here?
2017-03-28 22:57:58 -05:00
Eli Uriegas
f0a55b5cbb
Fix line length again...
2017-03-28 22:51:23 -05:00
Eli Uriegas
04a0774ee5
Fix line length
2017-03-28 22:51:23 -05:00
Eli Uriegas
511998d8e1
Merge pull request #573 from r0fls/env-config
...
allow setting config from individual env variables
2017-03-28 22:24:37 -05:00
Jakob Bowyer
42ba5298a7
Flake8 cleanup. Setup environmental variables.
...
Skipping broken tests unrelated.
2017-03-28 10:50:09 +01:00
Raphael Deem
fc69678206
Merge remote-tracking branch 'upstream/master' into remove-stop-event
2017-03-26 15:59:31 -07:00
Raphael Deem
aebd717039
fix merge conflict
2017-03-26 15:49:58 -07:00
Raphael Deem
1ddb01ac44
remove stop_event
2017-03-26 15:48:41 -07:00
Raphael Deem
c5b50fe3cf
allow setting config from individual env variables
2017-03-25 17:45:55 -07:00
Raphael Deem
df9884de3c
Merge pull request #576 from matuusu/master
...
fix http status code not propagating in response
2017-03-24 19:23:20 -07:00
Raphael Deem
179606feb1
Merge pull request #590 from r0fls/blueprint-strict-slash
...
add blueprint strict_slashes
2017-03-23 18:42:21 -07:00
Raphael Deem
5d293df64b
add blueprint strict_slashes
2017-03-23 18:37:06 -07:00
skytoup
fdbf452ced
1. try...catch aiohttp encode response body to text in test_client
...
2. add tests static binary file
2017-03-23 15:22:00 +08:00
Raphael Deem
1456b128d2
Merge pull request #572 from sourcepirate/master
...
Removed raw string in cookies documentation
2017-03-22 14:55:20 -07:00
matuusu
9c15982299
Update response.py
...
fix status code not propagating from response.stream to response.StreamingHTTPResponse
2017-03-22 12:40:40 +01:00
sourcepirate
63c24122db
Removed raw string in cookies documentation
2017-03-22 06:39:23 +05:30
messense
1396ca903d
Fix before_stop event
2017-03-20 14:27:02 +08:00
messense
d1fb5bdc30
Fix async before_server_start hook bug
2017-03-20 14:25:32 +08:00
messense
e27812bf3e
Set signal.stopped = True
on closing
2017-03-20 14:25:32 +08:00
messense
11a3cf9b99
Add signal handling
2017-03-20 14:25:32 +08:00
messense
a90d70feae
Check connections is not None
2017-03-20 14:25:32 +08:00
messense
466b34735c
Set app.is_running to True
2017-03-20 14:25:32 +08:00
messense
7ca9116e37
Trigger before_stop before closing server, after_stop before closing
...
loop
2017-03-20 14:25:31 +08:00
messense
decd3e737c
Flake8 fix
2017-03-20 14:25:31 +08:00
messense
f35442ad1b
Fix RuntimeError: this event loop is already running
2017-03-20 14:25:31 +08:00
messense
2b296435b3
Trigger events
2017-03-20 14:25:31 +08:00
messense
19ee1dfecc
Gunicorn worker
2017-03-20 14:25:31 +08:00
Raphael Deem
43c4fc8e33
Merge pull request #559 from r0fls/557
...
accept strict_slash routes
2017-03-17 13:10:26 -07:00
Raphael Deem
46677e69ce
accept strict_slash routes
2017-03-16 11:46:07 -07:00
Eli Uriegas
5fbca5b823
Merge pull request #561 from kdelwat/master
...
Fix ReadTheDocs build errors
2017-03-16 09:02:39 -05:00
Cadel Watson
d713533d26
Fix docstring formatting errors
2017-03-16 16:52:18 +11:00
Miguel Grinberg
fd823c63ab
cancel websocket tasks if server is stopped
2017-03-15 22:45:19 -07:00
Jing Su
250bb7e29d
add websocket secure scheme in request @messense
2017-03-13 18:34:43 +08:00
Jing Su
3af26540ec
add websocket scheme in request
2017-03-13 13:28:35 +08:00
Raphael Deem
01a770cbca
windows setup
2017-03-11 19:32:38 -08:00
Raphael Deem
0eedde445c
remove default host attribute in router
2017-03-11 15:39:48 -08:00
Raphael Deem
88bf78213f
Merge pull request #512 from subyraman/fix-url-building
...
Fix `request.url` and other url properties
2017-03-10 00:38:16 -08:00
Raphael Deem
dffaaf8751
Merge pull request #533 from 38elements/patch-1
...
Fix bail_out()
2017-03-10 00:35:54 -08:00
Raphael Deem
313edadf47
Merge pull request #528 from r0fls/523
...
allow running with SSL via commandline
2017-03-10 00:35:46 -08:00
Raphael Deem
c9ce33dfe6
Merge pull request #524 from r0fls/exception-list
...
allow exceptions to be a list
2017-03-10 00:35:38 -08:00
Raphael Deem
0f50ac7205
Merge pull request #517 from r0fls/empty-json
...
return valid json in request.json
2017-03-10 00:35:26 -08:00
38elements
313535c599
Fix bail_out()
2017-03-09 13:36:01 +09:00
Raphael Deem
2ba30f2022
allow running with SSL via commandline
2017-03-07 19:57:10 -08:00
Raphael Deem
90138c4bae
return valid json in request.json
2017-03-07 18:03:45 -08:00
Raphael Deem
58a833e987
rename TestClient
2017-03-07 17:13:23 -08:00
Raphael Deem
86c5a569d5
allow exceptions to be a list
2017-03-07 16:22:23 -08:00
Eli Uriegas
19592e8eea
Merge pull request #473 from subyraman/explore-streams-v2
...
Add `stream` method for streaming content, add docs and examples
2017-03-05 17:51:44 -08:00
Eli Uriegas
8e6678d526
Merge pull request #469 from miguelgrinberg/websocket-support
...
websocket support
2017-03-05 17:42:49 -08:00
Suby Raman
e792a1e030
add host test
2017-03-03 14:51:13 -05:00
Suby Raman
b40f30f2e5
fix tests
2017-03-03 11:49:35 -05:00
Suby Raman
1fbde87ec2
initial commit
2017-03-03 11:44:50 -05:00
(Zenix) Han-Sheng Huang
62bf213a6e
pass flake8
2017-03-02 13:42:55 +09:00
(Zenix) Han-Sheng Huang
e5c32e9b48
special handling when sock is provided and number of workers > 1
2017-03-02 13:27:52 +09:00
Raphael Deem
002d4cb37c
Revert "add reuse_port to create_server"
...
This reverts commit c3386dec84
.
2017-02-28 19:27:42 -08:00
Raphael Deem
c3386dec84
add reuse_port to create_server
2017-02-28 19:21:53 -08:00
Eli Uriegas
9fcf725061
Increment version to 0.4.1
2017-02-28 08:55:04 -06:00
Eli Uriegas
601e015f00
Merge pull request #495 from r0fls/494
...
fix routing issue with slashes
2017-02-28 08:54:15 -06:00
James Stidard
104a7c7d05
Added app to websocket request ( #1 )
2017-02-27 22:35:28 -08:00
Miguel Grinberg
7560660ec7
handle timeouts and disconnects properly
2017-02-27 22:35:28 -08:00
Miguel Grinberg
f90288f5dc
websocket routes in blueprints
2017-02-27 22:35:28 -08:00