Question

I have recently been struggling with setting up my webhost to be used for mercurial repos and also for hgweb. I use nearlyfreespeech.net (NFSN) for hosting.

By default, NFSN has a CGI realm of freebsd72 and restricts you to just CGI, no WGSI or the likes. Originally, NFSN had mercurial 1.6 installed but by following these instructions loosely I was able to get mercurial 2.6 setup. Python 2.6.6 is also installed by default on the host and I have left that as is.

My problem now is that I am not able to load the hgweb.cgi file in my browser. When I run it via SSH on my host it runs fine and output HTML, but in my browser I get a 500 internal server error. The file is executable and CGI is enabled. I am not sure what else there is to check... Does anybody have any advice or experience using hg and hgweb on NFSN?

As suggested in a comment, I have checked the error logs created and found that when I visit the site I get...

[Sun Jun 16 08:22:31 2013] [error] [client 172.17.0.141] CGI ERROR: A system problem prevented your request from being completed.
[Sun Jun 16 08:22:31 2013] [error] [client 172.17.0.141] Premature end of script headers: hgweb.cgi

A bit of searching on that error turns up that it means the script may not be generating the correct headers when run. If I save the output of the script to a file I get the following...

Status: 200 Script output follows
Content-Type: text/html; charset=US-ASCII

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<link rel="icon" href="/static/hgicon.png" type="image/png" />
<meta name="robots" content="index, nofollow" />
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" />

<title>Mercurial repositories index</title>
</head>
<body>

<div class="container">
<div class="menu">
<a href="http://mercurial.selenic.com/">
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
</div>
<div class="main">
<h2>Mercurial Repositories</h2>

<table class="bigtable">
    <tr>
        <th><a href="?sort=name">Name</a></th>
        <th><a href="?sort=description">Description</a></th>
        <th><a href="?sort=contact">Contact</a></th>
        <th><a href="?sort=lastchange">Last modified</a></th>
        <th>&nbsp;</th>
    </tr>

</table>
</div>
</div>

</body>
</html>
Was it helpful?

Solution

I was able to find that the hgweb.cgi script actually required to be set to 755 permissions, setting it to be executable was not enough.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top