On Sun, Sep 5, 2010 at 9:34 PM, Nolan Darilek <[email protected]>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Please pardon the newbie questions, and I realize that it isn't strictly
> Fossil-related, but I hope that can be forgiven as I'm trying to
> contribute to the ecosystem.
>
> I'm trying to create a server front-end that proxies requests to any
> number of repositories, running the CGI based on URL parameters.
> Unfortunately, the web servers I want to use don't directly support
> CGIs, so I'm trying this as a suitable alternative to avoid running a
> whole bunch of "fossil server"s.
>
> The challenge, though, is that I didn't really know much about CGIs
> until today. I'm trying to write a somewhat generalized CGI interface
> for Node.js that accepts a request and proxies that to a CGI script,
> with Fossil being my testbed.
>

Have you considered using the "fossil http" command instead of using CGI.
The "fossil http" command takes a single ordinary HTTP request on standard
input and issues a suitable reply on standard output.  No CGI to mess with.

If for some reason that won't work for you, you might at least want to look
at the implementation of the "fossil http" command (especially the
cgi_handle_http_request() function) since the way "fossil http" works is to
convert the HTTP request into CGI then call the CGI handler.  You don't need
a fully general CGI handler to run Fossil - just a very limited subset.  Let
the implementation of cgi_handle_http_request() be your guide.


>
> Currently I have GETs mostly working (though I don't correctly handle
> queries yet) and POSTs partially working. I'm having a particularly
> tough time with this because there are lots of lists of environment
> variables, I'm not sure what needs to be set to have a meaningful CGI
> interaction, and the NCSA page most tutorials from circa 2003 like to
> link to is no longer present. :) I only just now realized that I should
> be passing CONTENT_TYPE, which I didn't find documented anywhere. And
> now I actually seem to get bytes back from the CGI, albeit not in a
> format that is meaningful to Fossil on the receiving end.
>
> So my first question, is there any documentation on the lower-level
> aspects of the CGI interface? What commands are exchanged, what
> format/encoding they take, etc.?
>
> Also, what format/encoding is the data exchanged between Fossil and the
> CGI expected to use? Binary, base64 or something else?
>
> Finally, I'm noticing that while my framework is somewhat respecting my
> content-type setting on the data I pass to the CGI, it is appending
> "charset=utf-8". Will this negatively impact Fossil?
>
> Not sure if this will help, but here are some sample logs of Fossil
> attempting to pass through my proxy.
>
> POST from Fossil headers: { host: 'localhost:3000'
> , 'user-agent': 'Fossil/[8474ca6747]'
> , 'content-type': 'application/x-fossil'
> , 'content-length': '59'
> }
> Sending from CGI through proxy: Body:
> '\u0000\u0000\u0000\u0000x\ufffd\u0003\u0000\u0000\u0000\u0000\u0001'
> with headers { Status: '200 OK'
> , 'Cache-control': 'no-cache, no-store'
> , 'Content-Type': 'application/x-fossil; charset=utf-8'
> , 'Content-Length': '12'
> }
>
> And from Fossil I get:
>
> 1fossil: unknown command:
>
> Thanks.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkyERR4ACgkQIaMjFWMehWJCmgCcD2fjKgsFHmnNK1I8/WrqOTvc
> pK0An3DzhB92N1SjkTfMmX4coyirnmGL
> =IiPY
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>



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

Reply via email to