1625 Commits

Author SHA1 Message Date
benoitc
5d0c778300 bump to 20.0.4 2019-11-26 20:38:04 +01:00
benoitc
67cb62099c remove socketfromfd module
socket.fromfd using socket.AF_UNIX as type should be enough to be
cross-platform since the address is larger than for others family.
This should allow the code to work cross-platform.
2019-11-26 20:27:21 +01:00
Benoit Chesneau
c58337731a Revert "socketfromfd: remove python 2 compatibility"
This reverts commit 404a7120234e2b1119f4e8a3662c542e4d8700c8.
2019-11-26 20:27:21 +01:00
Benoit Chesneau
ab25bae7eb Revert "socketfromfd: fix cross platform usage"
This reverts commit e69e8020539989d1b5d4846f5329843c6150767d.
2019-11-26 20:27:21 +01:00
Benoit Chesneau
8c759dd2e3 Revert "fix linting on python 3.8"
This reverts commit d38f6e47ea03a4c0121036a4300fe2d0155e85c6.
2019-11-26 20:27:21 +01:00
Benoit Chesneau
d530e673c3 Revert "refactor module"
This reverts commit 9419d660960869438c1a19838e09b63e6dbfbac6.
2019-11-26 20:27:21 +01:00
benoitc
2dae3ea165 bump to 20.0.3 2019-11-25 23:06:01 +01:00
benoitc
9a3e008eca put back configuration file without py extension and deprecate it
this change put back (and fix it) support of configuration files without
ython extension and warn about its usage.
2019-11-25 22:44:25 +01:00
benoitc
9419d66096 refactor module
use appropriate naming for function, make _getsockname more generic and
doc more useful
2019-11-25 17:45:35 +01:00
benoitc
d38f6e47ea fix linting on python 3.8 2019-11-25 17:45:35 +01:00
benoitc
e69e802053 socketfromfd: fix cross platform usage
on osx and maybe some other systems, SO_PROTOCOL is not set, also
the socket family is not detected correctly.

This patch remove default values in socketfromfd and do the following:
* detect proper family using getsockname instead of getsocktopt
* if no type is given, default to SOCK_STREAM (we don't have any other type)
* if no protocol is given, default to 0 and let the system take care of it.
2019-11-25 17:45:35 +01:00
benoitc
404a712023 socketfromfd: remove python 2 compatibility 2019-11-25 17:45:35 +01:00
benoitc
911f7057ef bump to 20.0.2
fix changelog
2019-11-23 11:40:42 +01:00
benoitc
455767b96a remove useless import in app.base 2019-11-22 23:03:30 +01:00
benoitc
ad4ff8cb3c modernize the way the config module is loaded
This change load the module  as suggested in the Python docs : https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly which add the `__file__` attribute back and others possibly missing.

This change remove the support of python 3.4
2019-11-22 23:03:30 +01:00
benoitc
441977f57c only support python >= 3.5
python 3.4 is unsupported and we should focus on offering stable
features than backporting some code to this version
2019-11-22 23:03:30 +01:00
ThePrez
4d3ec28046 fix IBM i 'missing libc' failure (#2195)
allow gunicorn on IBM i (and AIX) platform with Python 3.6 and earlier
2019-11-22 22:14:35 +01:00
Aaron Wilson
291483dd39 Add a __repr__ to config to include its value (#2076)
It's sometimes helpful to be able to trivially dump all the config values
for debugging purposes. This commit defines a repr for that.
2019-11-22 21:39:45 +01:00
benoitc
b01fe34e56 use hight protocol version of openssl by default 2019-11-22 15:34:07 +01:00
benoitc
f9ade3af34 unblock select loop during reload of a sync worker
When reloading the worker canbe in the select loop and it will wait until timeout before handling any change. So make sure to wake up the loop before going further.
2019-11-22 14:10:49 +01:00
benoitc
8a270c9329 wsgi.input_terminated is always true
As spotted by @tilgovi Gunicorn always ensure the reader terminate. So set wsgi.input_terminated to true to signal it to the application.
2019-11-21 18:13:55 +01:00
benoitc
0d8a022791 Revert "fix wsgi.input_terminated"
This reverts commit 265e58f9e82f64e003015fb25823f5a983be8c27.
2019-11-21 18:11:17 +01:00
Benoit Chesneau
e150ca4ff8
add "*.so.*" case to util.find_lib
The actual libc name in musl is: libc.musl-x86_64.so.1 this case should handle it.
2019-11-21 11:53:13 +01:00
Benoit Chesneau
56e4a6cd7f
Merge pull request #2187 from benoitc/fix-2160
fix gunicorn when used with musl libc
2019-11-21 09:52:09 +01:00
benoitc
265e58f9e8 fix wsgi.input_terminated
Sometimes both TRANSFER-ENCODING=chunked and CONTENT_LENGTH are set. Since gunicorn prioritise (following the HTTP1.1 spec) chunked encoding we should make sure in this case to signal to th application that the input is terminated by the server.

Without the change gunicorn were always setting wsg.input_terminated to False when a CONTENT_LENGTH header was present ignoring that Gunicorn was afaik handling the termination.
2019-11-20 23:07:14 +01:00
Benoit Chesneau
8d854ba8cd
Merge pull request #2134 from talham7391/2133-delay-reload
Start the reloader after the wsgi app has been loaded.
2019-11-20 22:30:05 +01:00
benoitc
d55c7cb015 fix lib discovery
LD_LIBRARY_PATH is sometimes empty, this change fix it.
Also test suffix with the "." as it seems to be an issue
2019-11-20 21:41:05 +01:00
benoitc
b8860ef615 fix gunicorn when used with musl libc
find_library('c') doesn't work in Alpine Linux. This happen because musl has a simpler implementation of libc.

This patch fix it by extending ctypes.util.find_library to search the libs using LD_LIBRARY_PATH.

Patch is based on e3f67780aa

See also https://bugs.python.org/issue21622

fix #2160
2019-11-20 21:40:58 +01:00
Benoit Chesneau
c5be1bae5c
Merge pull request #2181 from Sytten/fix/http-desync
Fix/http desync
2019-11-20 21:28:18 +01:00
Emile Fugulin
ddf5e66ac8 Remove strict check of Transfer-Encoding 2019-11-20 12:25:39 -05:00
Gaige B Paulsen
4264e09c6f fix fromfd on solaris
This patches the fromfd code in socketfromfd by grabbing the correct symbol under SmartOS (SunOS).

The patch is pretty straightforward, basically switching on the OS to determine what the symbol is likely to be. If need be, I could put a try block around the original libc.getsockopt and then fall back to looking for _so_getsockopt, if that's preferred in this codebase

fix #2184
2019-11-20 07:09:43 +01:00
David Lord
19cb68f4c3 load application from factory function (#2178)
* load application from factory function

Use `ast.parse` to validate that the string passed to the CLI is either
an attribute name or a function call. Use `ast.literal_eval` to parse
any positional and keyword arguments to the function. Call the function
to get the real application.

Co-authored-by: Connor Brinton <connor.brinton@gmail.com>

* test coverage for util.import_app

* document app factory pattern
2019-11-19 23:09:53 +01:00
Emile Fugulin
f74324bd75 Handle multiple transfer-encoding 2019-11-18 22:29:02 -05:00
Emile Fugulin
bd8670b4db Handle duplicate content-length 2019-11-18 21:16:12 -05:00
Emile Fugulin
b798412444 Remove default strip of header name 2019-11-18 19:44:01 -05:00
Jason Madden
902d9c89ab
Capture os.sendfile before patching in gevent and eventlet workers.
Fixes #1925 and fixes #2170.
2019-11-13 07:08:26 -06:00
Jun
21d6287e15 Fix fdopen RuntimeWarning in 3.8 (#2146) 2019-10-30 09:16:07 +01:00
Talha Malik
51a4afd7ef Remove locking in polling reloader 2019-10-29 15:17:42 -04:00
Talha Malik
a4b6b1385a Fixes #2133 2019-10-29 15:17:42 -04:00
Hasan Ramezani
e7890d8d1b
Fix lint errors (#2123) 2019-10-27 11:57:16 +01:00
Jeff Brooks
ad6ed3f4c8 Implement check and exception for str type on value in Response process_headers method. 2019-10-15 09:03:44 -05:00
Jeff Brooks
54c820feb3 Ensure header value is string before conducting regex search on it. 2019-10-10 10:41:22 -05:00
Benoit Chesneau
e6a88dbfcd bump to 20.0.0 2019-09-27 01:47:03 +02:00
Benoit Chesneau
ce03c192f4 fix formatting 2019-09-27 01:45:03 +02:00
장준영
d765f0d123 Group exceptions with same body together in Arbiter.run() (#2081) 2019-08-20 03:34:18 +03:00
Randall Leeds
40802904eb Avoid unnecessary chown of temporary files
When Gunicorn is configured to change the effective user or group of the
worker processes, it changes the owner and group fo the the temporary
files used for interprocess communication.

With this change, Gunicorn does not change the owner or group of the
files if the worker processes will run as the current effective user and
gorup. This change avoids calling chown when it is not necessary, which
may allow Gunicorn to be used in environments that restrict use of the
chown syscall.

Relates to #2059.
2019-08-19 11:22:58 -07:00
Martin Bašti
7e640f804c Logging: Handle auth type case insensitively
According RFC-7617 (inherited from RFC-2978) schema and parameter names are handled
case insensitively:
```
Note that both scheme and parameter names are matched case-
insensitively.
```

Signed-off-by: Martin Bašti <mbasti@redhat.com>
2019-07-17 18:56:18 +03:00
Marwan Rabbâa
dc7b5d5c48 Fix compatility with tornado 6 (#2001) 2019-06-04 14:17:01 -07:00
c-bata
6df58a99b5 Remove util.import_module 2019-05-28 16:07:31 +03:00
Masashi SHIBATA
a13a2096ed Use SourceFileLoader instead instead of execfile_ (#2046) 2019-05-26 22:09:52 +03:00