23 Commits

Author SHA1 Message Date
Brett Randall
879651bb6f Header values are encoded using latin-1, not ascii.
This commit reverts one aspect changed by 5f4ebd2eb2b08783a5fbefe79d09fcb3fc1fbc73 (#1151);
header-values are again encoded as latin-1 and not ascii. Test is restored but uses
a latin-1-mappable test-character, not a general utf8 character.

Fixed #1778.

Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-04-18 04:23:19 +03:00
Benoit Chesneau
fe7632fe37 make sure all examples work on python 3
fix #1961
2019-01-24 23:19:38 +01:00
benoitc
5f4ebd2eb2 don't return utf8 header in example
Since the updated RFC 7230 implys that new Headers Key and Value should be
sent as USASCII only don't try to test utf8 headers in examples.

We now only encode them to ascii. Gunicorn will fail if it's unable to encode
them letting the responsability to the application to correctly encode the
response. (we are just a gateway).

While i'm here simplify the code to not create an extra function only used at
one place.

NOTE: if anyone come to a better solution, i am happy to revisit it on the
next release.

fix #1151
2015-11-25 13:29:46 +01:00
Berker Peksag
b5d188422e Tweak some examples.
* Return bytes in Python 3
* Activate wsgiref.validate.validator
* Remove unused imports
2015-07-08 13:53:19 +03:00
Collin Anderson
0d3045bb41 cleaned some code 2014-09-10 20:34:22 -04:00
benoitc
6aa99e4441 fix keepalive 2014-05-13 12:30:57 +02:00
benoitc
03a6136083 add a quick test to make sure we get the sys.stderr 2014-01-01 15:52:44 +01:00
benoitc
3452379108 remove useless lines in example 2013-08-27 15:32:01 +02:00
benoitc
4e3428af0e add -e/--env command line argunment
This command line argunment allows someone to pass an environement variable to
gunicorn:

	$ gunicorn --env FOO=1 test:app

With the command line above the application will be able to use the FOO
environment vatriable.
2013-08-27 13:21:53 +02:00
benoitc
5e08c27495 improve STDOUT/STDERR logging redirection.
Instead of faking STDIN/STDERR to a fake object that we close on reopen,
simply redirect them to a file and reopen this one when need.

Should fix most of the issues on #309
2013-04-21 11:31:58 +02:00
benoitc
91e7d138dc fix header encoding 2012-11-16 10:05:26 +01:00
benoitc
003c474fe2 handle bytes & native strings
This patch makes sure that we now handle correctly bytes and native
strings on python 3:

- In python 3, sockets are now taking and returning bytes.
- according to PEP3333, headers should be native strings and body in
  bytes.
2012-10-24 13:51:35 +02:00
benoitc
53ce50bc7b obvious syntax fixes preparing python3 support 2012-10-24 12:11:15 +02:00
Benoit Chesneau
5f11713678 log HTTP errors in access log. close #317 2012-04-26 18:17:55 +02:00
benoitc
961eabb332 simplify the code 2012-03-16 21:10:44 +01:00
benoitc
1319543448 use the cached app. 2012-03-01 08:02:15 +01:00
benoitc
5a7c756a98 close #304 .
Intoduce a change in log access format:

- request headers are now added to the log format using the
  {HeaderName}i variable
- response headers are now handled using the {HeaderName}o variables
- headers name are insensitive
- non existent keys in the log access format are replaced by '-'
2012-02-25 14:44:38 +01:00
benoitc
85c60c26b5 redirect stdout & stderr to logging error file when output is different
from '-' . Useful to collect some errors.
2012-02-19 16:07:51 +01:00
benoitc
c1aec22097 fix response 2010-03-23 21:09:15 +01:00
benoitc
49e57d36bb remove useless examples 2010-03-17 01:06:17 +01:00
benoitc
d92364af71 new read_partial function. We also now use buffer in parser. 2010-02-28 22:46:35 +01:00
Paul J. Davis
b20a0ace1e Added wsgiref validator to the example. 2010-02-22 11:17:00 -05:00
Benoit Chesneau
045b3127cc add setup file, fixx license 2009-12-21 19:47:07 +01:00