Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket binding implemented properly for IPv6 and UNIX sockets. #1641

Merged
merged 36 commits into from
Jun 29, 2020
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5431afd
Socket binding implemented properly for IPv6 and UNIX sockets.
Tronic Jul 23, 2019
e2efd46
Fix Windows compatibility by not referring to socket.AF_UNIX unless n…
Tronic Jul 23, 2019
a58d64e
Compatibility fix.
Tronic Jul 23, 2019
8f57610
Fix test of existing unix socket.
Tronic Aug 24, 2019
52451ad
Cleaner unix socket removal.
Tronic Aug 24, 2019
7cb05d8
Remove unix socket on exit also with workers=1.
Tronic Aug 24, 2019
67bdf4c
More pedantic UNIX socket implementation.
Tronic Aug 28, 2019
b45f879
Refactor app to take unix= argument instead of unix:-prefixed host. G…
Tronic Aug 28, 2019
c7c1a74
Linter
Tronic Aug 28, 2019
ff78e47
Merge remote-tracking branch 'upstream/master' into bind_unix_and_ipv6
Tronic Sep 2, 2019
dcffda2
Proxy properties cleanup. Slight changes of semantics. SERVER_NAME no…
Tronic Sep 5, 2019
e21e2ae
Have server fill in connection info instead of request asking the soc…
Tronic Sep 5, 2019
69ddbca
Linter 💣🌟✊💀
Tronic Sep 5, 2019
8214bcb
Merge remote-tracking branch 'upstream/master' into bind_unix_and_ipv6
Tronic Dec 15, 2019
e039fef
Fix typing issues. request.server_name returns empty string if host h…
Tronic Dec 15, 2019
0730c7e
Fix tests
Tronic Dec 15, 2019
055ad6b
Merge branch 'master' into bind_unix_and_ipv6
Tronic Jan 15, 2020
27301b8
Tests were failing, fix connection info.
Tronic Jan 15, 2020
1bacaa2
Linter nazi says you need that empty line.
Tronic Jan 15, 2020
c0e0999
Rename a to addr, leave client empty for unix sockets.
Tronic Feb 5, 2020
ecd16e6
Add --unix support when sanic is run as module.
Tronic Feb 5, 2020
bafa658
Remove remove_route, deprecated in 19.6.
Tronic Mar 26, 2020
7c3d9fb
Merge branch 'master' into bind_unix_and_ipv6
Tronic Mar 26, 2020
c776101
Improved unix socket binding.
Tronic Mar 26, 2020
d610260
More robust creating and unlinking of sockets. Show proper and not te…
Tronic Mar 27, 2020
0422b10
Add comprehensive tests for unix socket mode.
Tronic Mar 27, 2020
39b9263
Hide some imports inside functions to avoid Windows failure.
Tronic Mar 27, 2020
7327b8c
Mention unix socket mode in deployment docs.
Tronic Mar 27, 2020
026ee97
Merge branch 'master' into bind_unix_and_ipv6
Tronic Apr 7, 2020
93f8ed3
Merge branch 'master' into bind_unix_and_ipv6
Tronic Apr 9, 2020
34e8084
Merge branch 'master' into bind_unix_and_ipv6
Tronic Jun 4, 2020
8a8f0b6
Fix merge commit.
Tronic Jun 4, 2020
5f18c79
Merge branch 'master' into bind_unix_and_ipv6
ahopkins Jun 28, 2020
7ba0a5f
Make test_unix_connection_multiple_workers pickleable for spawn mode …
Tronic Jun 28, 2020
efa0c6b
Merge branch 'master' into bind_unix_and_ipv6
ahopkins Jun 28, 2020
19898d0
Merge branch 'master' into bind_unix_and_ipv6
ahopkins Jun 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hide some imports inside functions to avoid Windows failure.
  • Loading branch information
Tronic committed Mar 27, 2020
commit 39b92631d8d05267b397869ea6e8a7347e07859d
11 changes: 7 additions & 4 deletions tests/test_unix_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import subprocess
import sys

from signal import SIGINT
from socket import AF_UNIX, socket
from time import monotonic as current_time

import httpx
import pytest

Expand Down Expand Up @@ -43,6 +39,8 @@ def socket_cleanup():


def test_unix_socket_creation(caplog):
from socket import AF_UNIX, socket

with socket(AF_UNIX) as sock:
sock.bind(SOCKPATH)
assert os.path.exists(SOCKPATH)
Expand Down Expand Up @@ -92,6 +90,8 @@ def stop(app, loop):


def test_dont_follow_symlink():
from socket import AF_UNIX, socket

with socket(AF_UNIX) as sock:
sock.bind(SOCKPATH2)
os.symlink(SOCKPATH2, SOCKPATH)
Expand Down Expand Up @@ -172,6 +172,9 @@ async def client(app, loop):

async def test_zero_downtime():
"""Graceful server termination and socket replacement on restarts"""
from signal import SIGINT
from time import monotonic as current_time

async def client():
for _ in range(40):
async with httpx.AsyncClient(uds=SOCKPATH) as client:
Expand Down