>> Well, I'll try to review your patch next weekend and see where the
>> Windows issues might be.

I've had an early chance to look at your patch and to learn the SCGI
protocol. Please find my remarks below.

[1] Perhaps I'm thick as a brick, but my understanding of the SCGI
protocol is that it does not support interleaving and does not support
keep-alive. So, philosophically, I'm back to my original position that
http
proxying is the most elegant solution. That being said, your patch is
quite
small, so I am less concerned. However, I think it can be improved.

[2] The windows server doesn't use fork(). It reads the socket into a
file, and then exec's a "fossil http" command, with input and output
redirected to files. Once the child finishes, the output file is read and
written to the socket. The reason for this is that on windows "read()" is
not acting as "recv()" when the file descriptor is a socket. Other
solutions exist, but none as simple as this solution. "fossil http" does
some prelim work, but ends up calling "cgi_handle_http_request()".

[3] So, the cleanest solution may be the following. If you have
"cgi_handle_http_request()" recognise whether it is reading a http or an
scgi request (which is easy: an http request starts with an ascii letter
and an scgi request starts with an ascii decimal digit) and make it handle
both forms, you will have added SCGI support for all platforms.

[4] This has the added advantage that no new command is needed: "fossil
server" will do both http and scgi at the same time. You can add the unix
domain socket code to the fossil server command if needed. The name of the
"fossil http" command becomes a bit of a misnomer as it does more, but I
don't think that this is a problem.

[5] Your improvement to the Posix server code does not harm the Windows
server code and to me it looks like it should run on all Posix systems
(but
I have not tested this).

[6] Your patch was a quick project and it shows. Commenting could be
better, if accept() fails for another reason than EINTR the server hangs,
etc.

[7] In the odd case that I actually convinced you that http proxying is a
better solution than SCGI for integrating a fossil repo into a larger
website, adding support for "X-Forwarded-For" is just a few extra lines of
code in "cgi_init()":

  z = (char*)P("REMOTE_ADDR");
  if( z ) g.zIpAddr = mprintf("%s", z);
+ z = (char*)P("X_FORWARDED_FOR");
+ if( z ) g.zIpAddr = mprintf("%s", z);

Hope the above has been of help. For the avoidance of doubt: you will have
to convince DRH to accept your patch, not me; I'm just a user.

Paul
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to