This is driving me nuts......

I created a CGI file for my repository on the server:

Test.cgi:

!#\Program Files\Fossil\Fossil.exe
repository: C:\Projects\Test\Test.fossil

I configured IIS to send *.cgi requests to Fossil.exe then pointed my browser 
to:

http://myserver/Projects/Test/Test.cgi

I get an unformatted web page (no logo, no css). Snooping with Wireshark shows 
this exchange:

Request:

GET /Projects/Test/Test.cgi HTTP/1.1
Host: myserver
Connection: keep-alive
Cache-Control: max-age=0
Accept: 
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 
(KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Reponse:

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Length: 1360
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/6.0
Date: Tue, 29 Mar 2011 14:49:39 GMT

<!DOCTYPE html><html>
<head>
<title>Unnamed Fossil Project: Home</title>
<link rel="stylesheet" href="/Projects/Test/Test.cgi/style.css?default" 
type="text/css" media="screen" />
.......
</head>
<body>
<div class="header">
  <div class="logo">
    <img src="/Projects/Test/Test.cgi/logo" alt="logo" />
  </div>
  <div class="title"><small>Unnamed Fossil Project</small><br />Home</div>
  <div class="status">Not logged in</div>
</div>
.....
</html>

Request:

GET /Projects/Test/Test.cgi/style.css?default HTTP/1.1
Host: myserver
Connection: keep-alive
Referer: http://myserver/Projects/Test/Test.cgi
Cache-Control: max-age=0
Accept: text/css,*/*;q=0.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 
(KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Reponse:

HTTP/1.1 200 OK
....
<head>
<title>Unnamed Fossil Project: Home</title>
.......
</html>

Request:

GET / Projects/Test/Test.cgi/logo HTTP/1.1
Host: myserver
Connection: keep-alive
Referer: http://myserver/Projects/Test/Test.cgi
Cache-Control: max-age=0
Accept: text/css,*/*;q=0.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 
(KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Reponse:

HTTP/1.1 200 OK
....
<head>
<title>Unnamed Fossil Project: Home</title>
.......
</html>

Yeah, that's right; I got the home page again and again. By trial and error I 
found that the requests should be:

GET /style.css?default HTTP/1.1
GET /logo HTTP/1.1

It seems that Fossil uses the PATH_INFO to construct its reply in CGI mode. I 
achieved the correct results by writing a Perl script that strips the 
SCRIPT_NAME portion from the PATH_INFO environment variable before invoking 
Fossil:

$path = $ENV{"PATH_INFO"};
$script = $ENV{"SCRIPT_NAME"};

if ($path =~ m/^$script/) { # PATH_INFO starts with SCRIPT_NAME?
$ENV{"PATH_INFO"} = substr($path, length($script));
}

All Fossil / CGI requests must be processed through this Perl script. Thus, I 
concluded, Fossil/CGI cannot possibly work on Windows/IIS without scripting.

Q: Is this correct? Am I missing something?

In fact, given the above analysis, it shouldn't work in Linux either, yet, (I 
assume) it does.

Q: Can somebody please explain what is or isn't happening in Linux that is or 
isn't happening in Windows/IIS?

Tony Perovic
Compumation, Inc.
________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Tony Perovic
Sent: Tuesday, March 01, 2011 3:58 PM
To: '[email protected]'
Subject: [fossil-users] Fossil on IIS

Anybody get Fossil working as a "CGI script" on Microsoft Server 2003 / IIS?

I'm trying to access multiple repositories with one script as described at:
http://www.fossil-scm.org/index.html/doc/trunk/www/server.wiki

Learned more than I ever wanted to know about IIS/CGI/Scripting.

[cid:[email protected]]

TONY PEROVIC

[email protected]<mailto:[email protected]>
www.compumation.com

205 W. Grand Ave., Ste. 121
Bensenville, IL  60106
630-860-1921  Phone
630-860-1928  Fax


<<inline: image001.jpg>>

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

Reply via email to