1633 Commits

Author SHA1 Message Date
Kevin Michel
287916a5d4 Remove dead code: find_library and _findWalk_ldpath 2020-01-29 16:14:33 +01:00
Benoit Chesneau
f74f926f36 remove trailing new line 2020-01-10 13:58:29 +01:00
Benoit Chesneau
dcfd0f04e8 fix SERVER_SOFTWARE property
WSGI spec requires the SERVER_SOFTWARE property containing the name and version. This change fix it and separate the version header from SERVER_SOFTWARE property. We expose the SERVER variable so custom installations can change it in one place without looking much when needed.
2020-01-10 13:50:53 +01:00
Benoit Chesneau
2f944c9bea remove version from the Server header
while we still want to know which server is running to ease operation, the version was giving too much information on the installation, so let's remove it.
2020-01-10 11:00:00 +01:00
Jason Madden
2d40e6dace
Use socket.sendfile() instead of os.sendfile().
Fixes #2223.

Unfortunately, eventlet doesn't implement GreenSocket.sendfile, so we have to do it for it.

Add gevent and eventlet to tox.ini and add tests to make sure we can at least import the workers. Some tests that this actually functions would be nice...

Update the gevent and eventlet setup extras to require the versions that are enforced in their worker modules.
2020-01-04 06:31:25 -06:00
Randall Leeds
57fbbce554
Merge pull request #2227 from mikaeldusenne/hotfix/empty-dirname-inotify
add os.path.abspath() in dirname generation of the reloader
2019-12-30 12:59:54 -08:00
Mikaël Dusenne
e5310d15e9 add os.path.abspath() in dirname generation of the reloader
Otherwise adding a watcher for a file located in the working directory generates an empty dirname, resulting in the following error:
inotify.calls.InotifyError: Call failed (should not be -1): (-1) ERRNO=(0)

Caused by the fact that we call inotify with an empty path
2019-12-30 08:39:03 -05:00
Takuya Noguchi
ed901637ff Enable pycodestyle 2019-11-28 19:30:38 +09:00
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