> I don't understand how the fossil web server is interacting with the child
> processes that it launches. I see the code in cgi.c that does the
> launching, but I don't see how the child processes actually know what it
> is they should be doing.
>
> if( select( listener+1, &readfds, 0, 0, &delay) ){
> lenaddr = sizeof(inaddr);
> connection = accept(listener, (struct sockaddr*)&inaddr,
> (socklen_t*) &lenaddr);
> if( connection>=0 ){
> child = fork();
> if( child!=0 ){
> if( child>0 ) nchildren++;
> close(connection);
> }else{
> close(0);
> dup(connection);
> close(1);
> dup(connection);
> if( !g.fHttpTrace && !g.fSqlTrace ){
> close(2);
> dup(connection);
> }
> close(connection);
> return 0;
> }
> }
> }
>
> Furthermore, I am trying to debug some web functions that I have written
> using ddd, but that is monitoring only the server process. Does anyone
> have some advice on how I might debug my web functions?
>
> Thanks.
>
The code you have included is all the interaction there is! It shows the
child process getting the connection it has been given and attaching it to
stdin and stdout (and maybe stderr). The code then just returns from the
function cgi_http_server which contains it (the server never returns, it
is in an infinite loop just listening). This means that you have to look
just after where cgi_http_server is called in main.c . There you will see
that it finds its repository, enters the chroot jail (if appropriate),
uses cgi_handle_http_request to parse the incoming HTTP request (which it
gets from stdin, i.e. the connection socket), then calls
process_one_web_page to do whatever the global variables resulting from
the parse tell it to do.
I don't know the answer to your debugging question, but you might benefit
from fossil's approach - there is a way to run pretty much any code
without being in server mode!
HTH
Eric
--
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users