[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Woes executing SVN from CGI

From: David W. Wilson <wilson.d_at_anseri.com>
Date: 2007-10-10 19:23:00 CEST

I am tasked with setting up a web-based build server, which is to checkout
build sources from a remote SVN server, powered by CollabNet SVN Server (=
SVN + Apache). This is all being done on Windows with domain server
authentication (SSPI).

 

I installed CollabNet SVN Server on the build server, since it includes both
the Apache web server (for the build server web interface) and the SVN CLI
commands (for remote SVN server access). I disabled DAV on the build server,
since the build server would not be hosting SVN repositories.

 

Once I got ActivePerl CGI scripts configured on the build server, I wrote a
CGI script doit.cgi intended to display the contents of a source file
"test.txt" residing in a remote SVN repository:

 

--doit.cgi---------------------------------------------------------------

# Print HTTP header

print "Content-type: text/plain; charset=iso-8859-1\n\n";

 

# Command to get the contents of a SVN file on SVN server

my $command = '"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"';

 

# Run the command

my $output = `$command 2>&1`;

 

# Print the command and output

print "Command:\n$command\n\nOutput:\n$output\n";

 

# Finish happily

exit 0;

------------------------------------------------------------------------

 

When I run this script manual from the command line in a command prompt
window, it works correctly:

 

------------------------------------------------------------------------

> perl doit.cgi

Content-type: text/plain; charset=iso-8859-1

 

Command:

"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"

 

Output:

This is a test.

------------------------------------------------------------------------

 

This is the correct output, and confirms that the command syntax is correct.

 

But when I run the very same doit.cgi as a CGI script, I see the following
in the browser:

 

------------------------------------------------------------------------

> http://buildhost/cgi-bin/doit.cgi

Command:

"c:/Program Files/CollabNet Subversion Server/svn" "cat"
"http://subversion/svn/src/project/wilsond/test.txt"

 

Output:

svn: PROPFIND request failed on '/svn/src/project/wilsond/test.txt'

svn: PROPFIND of '/svn/src/project/wilsond/test.txt': 403 Forbidden
(http://subversion)

------------------------------------------------------------------------

 

The problem is clearly SVN server authentication. For the command line
(successful) run, the SVN server logs:

 

------------------------------------------------------------------------

123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 207 688

123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/!svn/vcc/default HTTP/1.1" 207 453

123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "PROPFIND
/svn/src/!svn/bc/209/project/wilsond/test.txt HTTP/1.1" 207 468

123.456.789.10 - anseri\\wilsond [10/Oct/2007:10:09:03 -0400] "GET
/svn/src/!svn/bc/209/project/wilsond/test.txt HTTP/1.1" 200 15

------------------------------------------------------------------------

 

while for the CGI (failed) run, it logs:

 

------------------------------------------------------------------------

123.456.789.10 - - [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 401 512

123.456.789.10 - - [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 401 512

123.456.789.10 - "" [10/Oct/2007:10:14:45 -0400] "PROPFIND
/svn/src/project/wilsond/test.txt HTTP/1.1" 403 345

------------------------------------------------------------------------

 

In the latter case, it appears that no credentials are passed to the SVN
server, which is almost certainly the reason for the 403. I tried the
obvious, adding --username and --password options to the "svn" command line,
but no luck, same behavior.

 

Because of this issue, I cannot rebuild the replicator entree templates, so
all it creates is raw wieners that we have to roast in the warp drive and
garnish with mustard packets stolen from Ten Forward, plus we're out of buns
until our next rendezvous with Rigel 5. You understand my predicament.

 

Has anyone run into this problem, and if so, how do credential SVN CLI
commands executed from CGI scripts?

 
Received on Wed Oct 10 19:27:12 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.