william-os4y / fapws3

Fast Asynchronous Python Web Server (based on libev)
GNU General Public License v2.0
341 stars 38 forks source link

Unix socket #28

Closed k3d3 closed 12 years ago

k3d3 commented 12 years ago

Implementation for listening on a unix socket

If you want to listen on a unix socket instead of a regular tcp socket, you can call

``` evwsgi.start("/srv/server.sock","unix") to listen at /srv/server.sock

Abstract unix sockets are also available via evwsgi.start("\0abstract_socket","unix") I've also added code to get the server's file descriptor via evwsgi.socket_fd() as well as for wsgi connections in environ['fapws.socket_fd']

All existing programs using fapws3 retain full compatibility, and no changes are needed for them.

william-os4y commented 12 years ago

Thanks K3d3. This is a great feature. I'll merge it. To assure this will remains valid across future releases, could you provide a small test script ? Before each release, I'll assure that it runs without errors.

jonashaag commented 12 years ago

There's a test script already

william-os4y commented 12 years ago

Ineed but not the client part. Look at unittest.

Regards. On Dec 17, 2011 1:03 PM, "Jonas Haag" < reply@reply.github.com> wrote:

There's a test script already


Reply to this email directly or view it on GitHub: https://github.com/william-os4y/fapws3/pull/28#issuecomment-3189070

k3d3 commented 12 years ago

I've added a server_unix.py and test_unix.py to the unittest directory, so that's a unit test for the unix stuff.

william-os4y commented 12 years ago

Great.

Many thanks for your contribution.

On Sat, Dec 17, 2011 at 5:54 PM, k3d3 reply@reply.github.com wrote:

I've added a server_unix.py and test_unix.py to the unittest directory, so that's a unit test for the unix stuff.


Reply to this email directly or view it on GitHub: https://github.com/william-os4y/fapws3/pull/28#issuecomment-3190234

william-os4y commented 12 years ago

Small feedback.

1) When stopping the server, the socket file remains. As consequence, I receive en arror when I want to restart it. Could we improve this ?

2) why post multipart is not working with sockets ?

Thanks

On Sat, Dec 17, 2011 at 7:03 PM, william opensource4you william.os4y@gmail.com wrote:

Great.

Many thanks for your contribution.

On Sat, Dec 17, 2011 at 5:54 PM, k3d3 reply@reply.github.com wrote:

I've added a server_unix.py and test_unix.py to the unittest directory, so that's a unit test for the unix stuff.


Reply to this email directly or view it on GitHub: https://github.com/william-os4y/fapws3/pull/28#issuecomment-3190234

k3d3 commented 12 years ago

The first one can be fixed by unlinking the socket on exit. That happens with any unix socket implementation, as I haven't seen any program out there that unlinks socket files after usage, hence why abstract sockets are preferred. I can patch something up later but I'm currently at work.

The post multipart I couldn't get working with unix sockets because cURL doesn't seem to support unix sockets. Instead of rewriting that specific test in httplib I just disabled it.

Hope this helps

William reply@reply.github.com wrote:

Small feedback.

1) When stopping the server, the socket file remains. As consequence, I receive en arror when I want to restart it. Could we improve this ?

2) why post multipart is not working with sockets ?

Thanks

On Sat, Dec 17, 2011 at 7:03 PM, william opensource4you william.os4y@gmail.com wrote:

Great.

Many thanks for your contribution.

On Sat, Dec 17, 2011 at 5:54 PM, k3d3 reply@reply.github.com wrote:

I've added a server_unix.py and test_unix.py to the unittest directory, so that's a unit test for the unix stuff.


Reply to this email directly or view it on GitHub: https://github.com/william-os4y/fapws3/pull/28#issuecomment-3190234


Reply to this email directly or view it on GitHub: https://github.com/william-os4y/fapws3/pull/28#issuecomment-3191078