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.
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.
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.
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
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.
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.
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.
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.
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/issue21622fix#2160
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
* 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