Commit Graph

1462 Commits

Author SHA1 Message Date
38elements
2d05243c4a Refactor arguments of run function 2016-12-24 22:49:48 +09:00
38elements
39211f8fbd Refactor arguments of serve function 2016-12-24 11:40:07 +09:00
Raphael Deem
32ea45d403 allow overriding logging.basicConfig 2016-12-23 16:17:34 -08:00
cr0hn
5afae986a0 Apply response Middleware always
Response middleware are useful to apply some post-process information, just before send to the user. For example: Add some HTTP headers (security headers, for example), remove "Server" banner (for security reasons) or cookie management. 

The change is very very simple: although an "request" middleware has produced any response, we'll even apply the response middlewares.
2016-12-23 15:59:04 +01:00
cr0hn
f091d82bad Improvement
improvement: support fo binary data as a input. This do that the response process has more performance because not encoding needed.
2016-12-23 13:12:59 +01:00
Stefano Palazzo
a73a7d1e7b Make it possible to disable the logo by subclassing Config 2016-12-23 11:42:00 +01:00
38elements
c657c531b4 Customizable protocol 2016-12-23 00:13:38 +09:00
38elements
75fc9f91b9 Change HttpParserError process 2016-12-18 09:25:39 +09:00
Tim Mundt
ef9edfd160 added documentation for configuration 2016-12-17 20:20:07 +01:00
Tim Mundt
234a7925c6 restored accidentally degraded doc string 2016-12-17 19:24:41 +01:00
Tim Mundt
a550b5c112 added tests and small fixes for config 2016-12-16 18:46:07 +01:00
Tim Mundt
04798cbf5b added methods to load config from a file 2016-12-16 17:05:09 +01:00
Eli Uriegas
435d5585e9 Fix leftover blank line
flake8 build failed here: https://travis-ci.org/channelcat/sanic/builds/183991976
2016-12-14 11:29:09 -06:00
Eli Uriegas
ddfb7f2861 Merge branch 'master' into convert_dict_to_set 2016-12-14 11:26:31 -06:00
Paul Jongsma
2003eceba1 remove trailing space 2016-12-13 10:41:39 +01:00
Eli Uriegas
a3a14cdab2 Merge pull request #170 from jpiasetz/convert_lambda_to_partial
Convert server lambda to partial
2016-12-12 20:40:29 -06:00
Paul Jongsma
9ba2f99ea2 added a comment on why to decode the file_path 2016-12-13 01:10:24 +01:00
Paul Jongsma
0464d31a9c Find URL encoded filenames on the fs by decoding them first 2016-12-10 12:16:37 +01:00
Eli Uriegas
e3453553e1 Merge pull request #183 from 38elements/payload-too-large
Change Payload Too Large process
2016-12-08 10:27:55 -06:00
Raphael Deem
457507d8dc return 400 on invalid json post data 2016-12-07 20:40:31 -08:00
38elements
662e0c9965 Change Payload Too Large process
When Payload Too Large occurs, it uses error handler.
2016-12-04 10:50:32 +09:00
Jack Fischer
c34427690a Merge branch 'master' of git://github.com/channelcat/sanic 2016-12-03 15:08:07 -05:00
Eli Uriegas
d8a974bb4f Merge pull request #175 from Derrreks/master
Improving comments
2016-12-02 20:07:28 -06:00
Eli Uriegas
39f3a63ced Increment version to 0.1.8 2016-11-29 15:59:03 -06:00
Eli Uriegas
89e2084489 Merge pull request #172 from 38elements/timeout
Change request timeout process
2016-11-29 15:56:07 -06:00
Derek Schuster
70c56b7db3 fixing line length 2016-11-28 14:22:07 -05:00
Derek Schuster
209b763302 fix typo 2016-11-28 14:05:47 -05:00
Derek Schuster
190b7a6076 improving comments and examples 2016-11-28 14:00:39 -05:00
Eli Uriegas
cce47a633a Merge pull request #167 from AntonDnepr/class-based-views
Class based views
2016-11-27 21:33:46 -06:00
Jack Fischer
0c215685f2 refactoring cookies 2016-11-27 08:30:46 -05:00
Jack Fischer
d86ac5e3e0 fix for cookie header capitalization bug 2016-11-26 11:20:29 -05:00
38elements
ee89b6ad03 before process 2016-11-26 16:47:16 +09:00
38elements
a5e6d6d2e8 Use default error process 2016-11-26 16:02:44 +09:00
Anton Zhyrney
1eea1f5485 rename&remove redundant code 2016-11-26 08:45:08 +02:00
38elements
0bd61f6a57 Use write_response 2016-11-26 14:14:30 +09:00
38elements
c01cbb3a8c Change Request timeout process
This add a request timeout exception.
It cancels task, when request is timeout.
2016-11-26 13:55:45 +09:00
John Piasetzki
0ca5c4eeff Use explicit import for httptools
Explicit importing the parser and the exception to save a name lookup.
2016-11-25 15:14:44 -05:00
John Piasetzki
47927608b2 Convert connections dict to set
Connections don't need to be a dict since the value is never used
2016-11-25 15:14:19 -05:00
John Piasetzki
13808bf282 Convert server lambda to partial
Partials are faster then lambdas for repeated calls.
2016-11-25 15:13:58 -05:00
Anton Zhyrney
c3c7964e2e pep8 fixes 2016-11-25 09:29:25 +02:00
Anton Zhyrney
9f2d73e2f1 class based views implementation for sanic 2016-11-25 09:10:25 +02:00
Eli Uriegas
fc19f2ea34 Merge pull request #163 from channelcat/request-data-vars
Access Request like a dictionary

Closes #129 #132
2016-11-23 13:51:17 -06:00
Eli Uriegas
93f50b8ef7 Merge pull request #160 from jiajunhuang/log
fix the way using logging.exception
2016-11-21 10:37:10 -06:00
abhishek7
f7f578ed44 Fixed Exception error log on line 157 of server.py 2016-11-20 21:37:01 -05:00
Channel Cat
d02fffb6b8 Fixing import of CIMultiDict 2016-11-19 18:41:40 -08:00
Channel Cat
993627ec44 Merged with master 2016-11-19 18:21:44 -08:00
Channel Cat
3ce6434532 Fix flake8 2016-11-19 18:04:35 -08:00
Channel Cat
a97e554f8f Added shared request data 2016-11-19 17:48:28 -08:00
Raphael Deem
635921adc7 Update headers to use CIMultiDict instead of dict 2016-11-19 16:09:38 -08:00
jiajunhuang
9eb4cecbc1 fix the way using logging.exception 2016-11-19 15:19:38 +08:00
Raphael Deem
f16ea20de5 provide default app name 2016-11-18 17:16:48 -08:00
Eli Uriegas
edb12da154 Fix the flake8 error caused by new flake8 version 2016-11-16 12:55:13 -06:00
Eli Uriegas
b51af7f4bf Merge pull request #147 from webtic/master
Add the client address to the request header
2016-11-10 15:30:04 -06:00
Eli Uriegas
28ce2447ef Update variable name
Give `ra` a more explicit name
2016-11-10 15:28:16 -06:00
Paul Jongsma
8ebc92c236 pass flake8 tests 2016-11-10 13:09:37 +01:00
Paul Jongsma
b92e46df40 fix whitespace 2016-11-10 13:06:27 +01:00
Paul Jongsma
be5588d5d8 Add the client address to the request header 2016-11-10 12:53:00 +01:00
Pahaz Blinov
0d9fb2f927 docs(request): return value docstring 2016-11-09 18:04:15 +05:00
Pahaz Blinov
0e9819fba1 fix(request): parse_multipart_form should return RequestParameters
I have this code:

```
form = FileForm(request.files)
```

and it raise error because the `request.files` is `dict` but `RequestParameters` is expected =/
2016-11-09 00:36:37 +05:00
Pahaz Blinov
5efe51b661 fix(request.py): problem in case of request without content-type header (#142)
* fix(request.py): exception if access request.form on GET request

* fix(request): just make a unification (parsed_form and parsed_files) + RFC fixes

parsed_form and parsed_files must be a RequestParameters type in all cases!
2016-11-07 15:27:50 -06:00
Pahaz Blinov
1b65b2e0c6 fix(blueprints): @middleware IndexError (#139) 2016-11-06 10:08:55 -06:00
Eli Uriegas
1271c7d958 Merge pull request #128 from channelcat/keep-alive-timeout-fix
Keep alive timeout fix
2016-11-05 12:11:41 -06:00
Eli Uriegas
3a1ef6bef2 Merge pull request #125 from clenimar/fix-comments
Fix comments over-indentation
2016-11-03 08:27:39 -06:00
imbolc
3cd3b2d9b7 Fix upload without content-type 2016-11-03 12:34:55 +07:00
Marcin Baran
80fcacaf8b Add loop kwargs to sanic_endpoint_test 2016-11-02 12:27:58 +01:00
Channel Cat
707c55fbe7 Fix flake8 2016-10-28 03:35:30 -07:00
Channel Cat
c44b5551bc time.time faster than loop.time? 2016-10-28 03:13:03 -07:00
Channel Cat
bd28da0abc Keep-alive requests stay open if communicating 2016-10-28 02:56:32 -07:00
Clenimar Filemon
f3fc958a0c Fix comments over-indentation 2016-10-27 11:09:36 -03:00
Channel Cat
65950250d9 Merge pull request #111 from channelcat/reverse-static
Reverse static arguments
2016-10-25 02:52:21 -07:00
Channel Cat
74ae0007d3 Reverse static arguments 2016-10-25 02:45:28 -07:00
Channel Cat
977081f4af Merge pull request #110 from channelcat/cookies-lazy-creation
Lazy cookie creation
2016-10-25 01:50:33 -07:00
Channel Cat
ee70f1e55e Upped to version 0.1.6 2016-10-25 01:49:43 -07:00
Channel Cat
9c16f6dbea Fix flake8 issues 2016-10-25 01:36:12 -07:00
Channel Cat
c50aa34dd9 Lazy cookie creation 2016-10-25 01:27:54 -07:00
Channel Cat
0e479d53da Merge pull request #104 from channelcat/pr/101
Static file support
2016-10-24 22:42:01 -07:00
Channel Cat
53e00b2b4c Added blueprint order test and used deques to add blueprints 2016-10-24 02:09:07 -07:00
Channel Cat
bf6879e46f Made static file serving part of Sanic
Added sanic.static, blueprint.static, documentation, and testing
2016-10-24 01:21:06 -07:00
imbolc
d7fff12b71 Static middleware 2016-10-24 02:17:03 +07:00
pcdinh
5361c6f243 e is an unused variable. Safe to remove 2016-10-23 19:38:28 +07:00
pcdinh
963aef19e0 w is unused variable to it is safe to suppress Pylint warning using _
(underscore)
2016-10-23 19:36:08 +07:00
Channel Cat
47ec026536 Fix incomplete request body being read 2016-10-23 03:30:13 -07:00
Channel Cat
e70263d012 Merge pull request #87 from channelcat/blueprint-extras
Blueprint start/stop listeners + ordering
2016-10-23 02:04:55 -07:00
Channel Cat
41ea40fc35 increased server event handler type flexibility 2016-10-23 01:51:46 -07:00
Channel Cat
3802141007 Adding cookie capabilities for issue #74 2016-10-23 01:32:16 -07:00
Channel Cat
a5614f6880 Added server start/stop listeners and reverse ordering on response middleware to blueprints 2016-10-21 04:11:18 -07:00
Hyungtae Kim
c256825de6 Content Type of JSON response should not have a charset 2016-10-20 13:38:03 -07:00
Channel Cat
d4e2d94816 Added support for routes with / in custom regexes and updated lru to use url and method 2016-10-20 11:33:28 +00:00
John Piasetzki
f510550888 Fix flake8 2016-10-20 01:37:12 -04:00
John Piasetzki
fc4c192237 Add simple uri hash to lookup 2016-10-20 01:29:22 -04:00
John Piasetzki
f4b45deb7f Convert dict to set 2016-10-20 00:28:05 -04:00
John Piasetzki
d1beabfc8f Add lru_cache to get 2016-10-20 00:28:05 -04:00
John Piasetzki
baf1ce95b1 Refactor get 2016-10-20 00:28:05 -04:00
John Piasetzki
e25e1c0e4b Convert string formats 2016-10-20 00:28:05 -04:00
John Piasetzki
04a6cc9416 Refactor add parameter 2016-10-20 00:28:05 -04:00
John Piasetzki
50e4dd167e Extract constant 2016-10-19 23:43:31 -04:00
John Piasetzki
f2cc404d7f Remove simple router 2016-10-19 23:41:22 -04:00
Ludovic Gasc (GMLudo)
7dcdc6208d Enable after_start and before_stop callbacks for multiprocess 2016-10-20 01:01:51 +02:00
Ubuntu
3d00ca09b9 Added fast lookup dict for common response codes 2016-10-19 08:37:35 +00:00
Ubuntu
69345272cd Merge branch 'feature/statuscode' of https://github.com/mikoim/sanic into mikoim-feature/statuscode 2016-10-19 08:26:11 +00:00
Channel Cat
2903e7ee7c Merge pull request #65 from blakev/feature/expose-loop
Exposes `loop`in sanic `serve` and `run` functions (#64)
2016-10-19 01:21:15 -07:00
Channel Cat
71a783e7e1 Merge pull request #59 from yishibashi/comment-fix
comment fixed
2016-10-18 21:14:10 -07:00
Channel Cat
c58741fe7a Changed start failure to print exception 2016-10-18 16:50:14 -07:00
Eshin Kunishima
7b0f524fb3 Added HTTP status codes
Based on http.HTTPStatus
2016-10-19 01:53:11 +09:00
Blake VandeMerwe
5e459cb69d Exposes loopin sanic serve and run functions (#64) 2016-10-18 10:05:29 -06:00
yishibashi
7c3faea0dd comment fixed 2016-10-18 19:32:47 +09:00
Channel Cat
4ecb4d2cce Added newline to fix flake8 error 2016-10-18 01:38:50 -07:00
Channel Cat
c539933e38 Fixed unused import, added change log 2016-10-18 01:31:09 -07:00
Channel Cat
6f105a647e Added multiprocessing 2016-10-18 01:22:49 -07:00
Channel Cat
18aa937f29 Fix slowdown 2016-10-17 23:34:07 -07:00
Channel Cat
73ef816d89 Merge pull request #45 from mindflayer/master
Fix for string tokens
2016-10-16 14:23:29 -07:00
Channel Cat
031a95e4d9 Merge pull request #39 from seemethere/fix_flake8_errors
Fix flake8 errors
2016-10-16 13:54:36 -07:00
Giorgio Salluzzo
2ee4c0fc6a Merge branch 'master' of github.com:mindflayer/sanic 2016-10-16 22:42:06 +02:00
Giorgio Salluzzo
3e8b8fb46f Fix for issue #44. 2016-10-16 22:41:56 +02:00
abhishek7
3c7a8a5f45 Added some documentation to request.py, removed extra line in blueprints.py, and minor grammar enhancements to blueprints.md and middleware.md 2016-10-16 11:35:45 -04:00
Eli Uriegas
ea0a037248 Fix flake8 errors 2016-10-16 08:01:59 -05:00
Channel Cat
9d388e9933 Fixed flake8 errors 2016-10-16 02:21:24 -07:00
Channel Cat
d195db0fd3 merged 2016-10-16 09:01:39 +00:00
Channel Cat
40b1ec91f0 Added blueprint exception and middleware support, and tests 2016-10-16 01:48:51 -07:00
Channel Cat
9b716e97ee Merge branch 'feature_blueprints' of https://github.com/narzeja/sanic into narzeja-feature_blueprints 2016-10-16 08:21:35 +00:00
Channel Cat
8e07edb211 Merge pull request #33 from channelcat/middleware-unreachable
Middleware unreachable
2016-10-16 01:14:50 -07:00
Channel Cat
41a1a72a95 Merge pull request #26 from radarhere/master
Fixed typos
2016-10-16 00:53:59 -07:00
Channel Cat
516f661a38 Removed unreachable code and old middleware class 2016-10-16 00:52:39 -07:00
narzeja
b19452a1a7 assert warning clarification and adding blueprint containers to app object 2016-10-16 06:48:49 +02:00
narzeja
d761c34e8b basic blueprint functionality 2016-10-16 06:43:22 +02:00
narzeja
aaf571fae4 Blueprint support, with docs, example, and tests 2016-10-16 06:43:22 +02:00
Ubuntu
13ba8d7325 merged changes 2016-10-16 04:20:12 +00:00
Andrew Murray
e3a6262012 Fixed typos 2016-10-16 12:28:24 +11:00
b.khasanov
a464d1e0b2 fix double router initializing 2016-10-16 01:14:47 +03:00
Michael Lavers
9f824b048e Introduce end-of-line normalization 2016-10-15 12:59:00 -07:00
John Piasetzki
dd249ca665 Use printf-style String Formatting for output 2016-10-15 14:58:31 -04:00
John Piasetzki
6a1f706387 Remove unused imports 2016-10-15 14:58:22 -04:00
Channel Cat
254861bc37 Reformatted code to use spaces instead of tabs 2016-10-14 19:53:49 -07:00
channelcat
67db0bcbf3 Merge pull request #4 from n1ywb/master
add http:// to server info message so it's clickable
2016-10-14 19:40:40 -07:00
Jeff Laughlin
ba5363ef43 add http:// to server info message so it's clickable 2016-10-14 18:50:41 -04:00
Eli Uriegas
4684083f2f Move helpers from tests to sanic proper 2016-10-14 17:36:32 -05:00
Channel Cat
818826b4b0 Removed unnecessary log 2016-10-14 05:09:14 -07:00
Channel Cat
dbd11bf387 Reverting 2016-10-14 03:59:41 -07:00
Channel Cat
ec10d24ac6 Minor speed improvements 2016-10-14 03:57:48 -07:00
Channel Cat
62c1235f58 speed improvements 2016-10-14 03:52:21 -07:00
Channel Cat
33f712ef9b Proper errors when server cannot bind 2016-10-14 03:42:20 -07:00
Channel Cat
a74ab9bd18 Added tests and middleware, and improved documentation 2016-10-14 03:23:48 -07:00
Channel Cat
49c499f44d Added examples and form processing 2016-10-09 15:28:31 -07:00
Channel Cat
8fbc6c2c4e Moved request handling into sanic 2016-10-08 19:45:11 -07:00
Channel Cat
b0d38f8a04 Performance degraded - added in request too large and keep-alive timeout 2016-10-08 17:27:10 -07:00
Channel Cat
fa980b1445 Performance improvements to url parsing 2016-10-08 16:04:18 -07:00
Channel Cat
6041e7cfa6 Performance improvements to response and moved tests around 2016-10-08 15:21:40 -07:00
Channel Cat
e8287df3e5 Fixed POST request getting JSON 2016-10-06 01:23:52 -07:00
Channel Cat
d40e750ce6 added on_start on_stop 2016-10-05 05:30:36 +00:00
Channel Cat
4489f536da . 2016-10-03 00:45:59 -07:00
Channel Cat
fed5c01efb fix 4watt 2016-10-03 00:38:53 -07:00
Channel Cat
ffd521b67b derp 2016-10-03 00:35:20 -07:00
Channel Cat
ee98c8b42f . 2016-10-03 07:27:54 +00:00
Channel Cat
7cdeff63f6 Decode data by default 2016-10-02 23:55:46 -07:00
Channel Cat
2ad7014666 Args should be an empty dict if none exist 2016-10-02 22:31:31 -07:00
Channel Cat
7ec5432f64 Fixed coroutine checking 2016-10-02 22:03:14 -07:00
Channel Cat
af2cf771d4 Added better debug info 2016-10-02 21:11:38 -07:00
Channel Cat
b59dc2729f Added better error handling and coroutine checking 2016-10-02 20:47:15 -07:00
Channel Cat
e0b9260644 Sanic can now parse args and json 2016-10-02 18:45:44 -07:00
Channel Cat
0489526ac9 Fix crash 2016-10-02 17:32:27 -07:00
Channel Cat
8cc028764d Fixed keep-alive header and broken connection handling 2016-10-02 02:18:41 +00:00
Channel Cat
a75986e357 Initial Commit 2016-05-25 21:52:42 -07:00