hgrc and hgwebdir.cgi on linux related questions
J.S. van Bethlehem
jakobb at astro.rug.nl
Fri Oct 3 12:49:24 UTC 2008
Patrick Waugh wrote:
>
> I am not doing any redirection on the local server, and this occurs if
> I go to the local server directly, so has nothing to do with
> redirection.
Then I really haven't got a clue. It must have something to do with the
internals of the apache server.... which isn't all that simple to understand
> No, this is exactly why I didn't do this... because when I put:
>
> /home/patrick/hg/cbl-dev = /home/patrick/hg/cbl-dev
>
> as that directory is outside the public_html directory root, it cannot
> be served.
Well.... I have precisely the same setup as you have, and I CAN serve
this directory outside the public_html! Actually, when I read your next
comment:
>> So all you need to do in hgweb.cgi is:
>> application = hgweb("/home/patrick/hg", "Patrick's HG repository")
>> and it should work, without all the hassle of redirections.
>
> I'm using hgwebdir.cgi, but have renamed it to index.cgi for convienence.
> Currently, it has this:
>
> application = hgwebdir('hgweb.config')
>
> so I'm not sure at all what replacing or adding the above would do.
> I'll have to get out my CGI book I guess.
I'm convinced by now you have exactly the same setup I have. I use the
hgwebdir.cgi script as well, renamed it to index.cgi as well. So forget
my remarks about the application = hgwed() dir, that's just for the
hgweb.cgi script. If you use the hgwebdir.cgi script, you CAN make it
work by just putting in a [path] section:
[path]
/home/patrick/hg/cbl-dev = /home/patrick/hg/cbl-dev
However, you have to set the allow_push in the [web] section (see the
online manual)
And maybe you have to make sure as well that the connection is
authenticated. I'm not sure about that. But if that is needed as well,
you can do that easily by creating an .htaccess file (in the webfolder
where the script resides).
I'm on a system that even has a certificate, so I set up the connection
over https. But over http should work as well. This is the stuff you
need to add in the .htaccess file.
# Request the credentials
AuthName "HG Code Repositories" # this will show in the user/pswd screen
AuthType Basic
AuthUserFile /path/to/passwordfile
AuthGroupFile /dev/null
Require valid-user
<Files .htaccess> # make sure that the .htaccess file can not
order allow,deny # be read in a browser
deny from all
</Files>
The /path/to/passwordfile is a passwordfile that saves the encrypted
passwords of users that are allowed to log in. You can use the utility
htpasswd to edit the file, or use this online utility:
http://www.tools.dynamicdrive.com/password/
Note that the credentials are sent in plain format though. This can be
improved upon by forcing a connection over https. If your system has a
certificate you can do that (or you can use the Digest authentication
system instead of Basic.... I'm not sure hg knows about that though) If
your system happens to have a certificate, I can show you some nice
additions to the .htaccess file to force a connection over https
More information about the Mercurial
mailing list