John Hampton wrote:

I have tried to locate where/how trac itself handles this case. As best as I can tell, it is handled in [http://projects.edgewall.com/trac/browser/trunk/trac/web/_fcgi.py#L971 trac.web._fcgi.py line 971]. The {{{_setupSocket}}} function appears to create a socket from a file. However, it creates an {{{AF_INET}}} socket. I don't understand how this works if the server is creating a UNIX socket.

So I have been doing a bit more code spelunking and asking around. Unfortunately, I still don't understand the process fully. However, I have figured out a bit.

Trac doesn't actually get FCGI_LISTENSOCK_FILENO from the environment. It is hardcoded to 0. If an address is not specified (which it isn't without hacking the code), then trac issues the following call:

sock = socket.fromfd(FCGI_LISTENSOCK_FILENO, socket.AF_INET, socket.SOCK_STREAM)

So it simply tries to create an AF_INET socket from file descriptor 0. I don't understand how this would work if fd 0 is tied to a UNIX socket. However, it could be that it isn't. It could be that the UNIX socket specified in the lighttpd config is actually used for something else.

So, I think the right way to implement this is to accept a config similar to:

Handler fcgi {
  Server {
    Interpreter "/usr/bin/trac.fcgi"
  }
}

And have cherokee create it's own socket and then spawn and attach the trac.fcgi process to it.

Just some thoughts.  Thanks for all the hard work.

-John
_______________________________________________
Cherokee mailing list
[email protected]
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee

Reply via email to