At 03:16 AM 6/18/2010, Paul Ruizendaal wrote:
 >The CGI protocol specifies that all http headers of the request
 >are passed on to the cgi script as environment variables, 
using the
 >following rules....
 >.... the header value is left unchanged
 >So for a definition of HTTP_HOST you have to look at the spec 
for the
 >Host: header of the http protocol....
 >And yes, Richard is correct: the port number is obligatory in the
 >host header if different from "80".

Thanks, that connects the dots now.

Although I can see how it could be read otherwise, I wasn't 
actually doubting Richard. I was just surprised that a 
definitive answer wasn't immediately discoverable so that I 
could cite an authority if I wanted to try to push a bug report 
or patch back at the thttpd folks.

 >....
 >> There are also SERVER_NAME and SERVER_PORT. Thttpd does supply
 >> those, and they are named explicitly in every CGI document a
 >> quick search turned up just now. Perhaps the host name should be
 >> assembled from those two, omitting the port if it is 80 of 
course.
 >
 >This won't work: SERVER_NAME is not necessarily the same as the
 >host name of the request....

I knew after I posted it that that was too obvious to be right.

Keeping track of this kind of thing is why I went back to embedded
systems and stopped trying to keep up with web app development.
That and JavaScript. ;-)

 >...
 >However it is easy to patch thttpd to use the SERVER_PORT data to
 >fix up the HTTP_HOST information (same libthttpd.c file):

Thanks for the pointer to the right spot to patch. I had to tweak
it a bit because build_env() isn't variadic despite its printf()-like
appearance, but I got something that works for me.

All in all, this is an eminently practical answer in my case. I'm
certainly not going to do virtual hosting on a NAS box, and this
small fix enables thttpd to host fossil and work as I hoped.

Thanks again. Now I just need to automate web page with a usable
directory listing of repositories, and a cron job to synch them
once in a while...

Ross Berteig                               [email protected]
Cheshire Engineering Corp.           http://www.CheshireEng.com/

_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to