Skip to content

Commit

Permalink
allow_shared_sockets param of sockets.from_dns and such now allows F…
Browse files Browse the repository at this point in the history
…alse
  • Loading branch information
idlesign committed Oct 22, 2019
1 parent 78f503a commit 8916190
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ uwsgiconf changelog
===================


Unreleased
----------
+ 'allow_shared_sockets' param of 'sockets.from_dns' and such now allows 'False'.


v0.19.0 [2019-10-17]
--------------------
+ Added SocketHttps.get_certbot_paths() helper.
Expand Down
12 changes: 8 additions & 4 deletions uwsgiconf/options/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def from_dsn(cls, dsn, allow_shared_sockets=None):
socket_kwargs.update({key: val[0] for key, val in parse_qs(split.query).items()})
socket = sockets[split.scheme]

allow_shared_sockets = allow_shared_sockets or (geteuid() != 0)
if split.port and split.port < 1024 and allow_shared_sockets:
new_shared = cls.shared(socket_kwargs['address'])
socket_kwargs['address'] = new_shared
if split.port and split.port < 1024:

if allow_shared_sockets is None:
allow_shared_sockets = (geteuid() != 0)

if allow_shared_sockets:
new_shared = cls.shared(socket_kwargs['address'])
socket_kwargs['address'] = new_shared

try:
socket = socket(**socket_kwargs)
Expand Down

0 comments on commit 8916190

Please sign in to comment.