Russell Yanofsky (rey4@sourceforge.net) obviuosly spend a lot of time

porting ViewCVS to windows and added ASP support.  His patch #526282
is quite huge and this first step only commits the newfiles.tgz to CVS,
because this shouldn't break anything.  I will not commit the actual
patches contained in diff.txt until I've spend some time testing it here
with Linux because Russell wrote he didn't has the possibility to test
with Unix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@497 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
pefu 2002-03-06 09:53:08 +00:00
parent fb897f7db8
commit c4942bf983
14 changed files with 499 additions and 0 deletions

59
cgi/query.asp Normal file
View File

@ -0,0 +1,59 @@
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# query.cgi: View CVS commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
#########################################################################
import sapi
import query
sapi.AspServer(Server, Request, Response, Application)
query.main()
%>

64
cgi/viewcvs.asp Normal file
View File

@ -0,0 +1,64 @@
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# viewcvs: View CVS repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
#########################################################################
### add code for checking the load average
#########################################################################
# go do the work
import sapi
import viewcvs
sapi.AspServer(Server, Request, Response, Application)
viewcvs.main()
%>

145
windows/README Normal file
View File

@ -0,0 +1,145 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DESCRIPTION
Unlike the previous port of ViewCVS to Windows, this version is full featured.
It supports
- Code markup (colorizing) with enscript
- The Bonsai-like checkin database
- CVS Graph
- Running as a CGI script or as a standalone web server.
- Tarball download
- Regular expression filtering
Another new feature is the ability to run ViewCVS as an ASP page instead of a CGI script. ASP tends to be much faster than CGI because there is less overhead at each page load.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BASIC INSTALLATION
ViewCVS requires a Python interpreter. The best one to use for windows is ActiveState's ActivePython ( http://aspn.activestate.com/ASPN/Python )
Once python is installed you can run the install script with this command
python viewcvs-install
The script will copy the source files into an installation directory that you specify, store some path information, and compile the viewcvs libraries into Python bytecode.
ViewCVS also requires that the RCS tools be installed on your computer. There are numerous ports of RCS to windows. Precompiled binaries are available from
http://ftp.cvshome.org/rcs/
and there is more information about RCS at
http://www.cvshome.org/cyclic/cyclic-pages/rcs.html
The only thing that will work after you've downloaded the RCS tools and run the install script is the python standalone server (standalone.py). Other features must be enabled manually. See the INSTALL file and the section below for information on how to do this.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FEATURES INSTALLATION
This section contains information on how to set up the optional viewcvs features. These features can be set up independently of each other and in any order.
I use "c:\path\to\install" here to denote the ViewCVS installation path (the path where the install script copies files to) and "c:\path\to\python" as the path to the python interpreter.
CGI on IIS
1) Copy viewcvs.cgi and query.cgi from c:\path\to\install to a folder that is accessible through your web server.
2) Start up the IIS "Internet Services Manager" and right click a virtual server or virtual directory that contains the files you just copied. Choose "Properties" from the context menu that appears.
3) On the properties dialog that appears, navigate to [Home | Virtual] Directory -> Application Settings -> Configuration. This will bring up another dialog box called "Application Configuration".
4) On the "App Mappings" tab choose "Add". Fill in the following information
Executable: C:\path\to\python\python.exe "%s"
Extension: cgi
Script Engine: checked
Check that file exists: unchecked
That is all. Assuming you've set up viewcvs.conf to point to your repositories, the CGI pages should run. See the Troubleshooting section below if there are any problems.
ASP on IIS
In order to run viewcvs with ASP, you will need to enable Python ActiveX scripting and to install the included Aspfool ISAPI filter on whatever virtual server is being used to serve the viewcvs.asp page. Step by step instructions are given below. Information and source code for Aspfool can be found in the aspfool/ folder included in this distribution and there is a precompiled version of aspfool.dll in the binaries/ folder.
1) Run c:\path\to\python\win32comext\axscript\client\pyscript.py to register Python as an ASP scripting language. (More documentation on this is at http://www.python.org/windows/win32com/ActiveXScripting.html )
2) Copy the viewcvs.asp and query.asp from c:\path\to\install to a folder that is accessible through your web server.
3) Start up the IIS "Internet Services Manager" and right click on the virtual server that contains the files you just copied. Choose "Properties" from the context menu that appears.
3) On the properties dialog that appears, click the "ISAPI Filters" tab. Click the "add" button and enter the following information:
Filter Name: aspfool
Executable: aspfool.dll
After you've saved these changes, the viewcvs ASP pages should begin to work.
CGI on Apache
Follow the instructions in the INSTALL file.
Enscript Highlighting
To use enscript, just follow the instructions in the INSTALL file. You'll need to have enscript.exe and sed.exe installed on your system. Both of these utilities are available from the GNU-Win32 Project at
http://gnuwin32.sourceforge.net/
The packages to download are enscript, gettext, libiconv, and sed.
Bonsai-like Checkin Database
Follow the instructions in the INSTALL file. You'll need to set up a mysql database server and the Mysql Python Interface.
Mysql is available from http://www.mysql.com/
The Mysql-Python interface package for windows is available at http://www.cs.fhm.edu/~ifw00065/
Both packages have nice GUI installers.
CVS Graph
To use CVS Graph, you can either use the precompiled binary that I provided (cvsgraph.exe) or build the source which is available from http://www.akhphd.au.dk/~bertho/cvsgraph/
To build the source, you will need to have a C compiler like Mingw or Visual C++ installed on your system and these libraries:
gd 1.x - http://www.boutell.com/gd
libpng - http://www.libpng.org/pub/png/
zlib - http://www.gzip.org/zlib/
The latter two libraries are also available from the Mingw package repository (http://mingwrep.sourceforge.net/)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TROUBLESHOOTING
A common cause of server errors for ASP and CGI pages is permissions problems. You need to make sure that the virtual directory containing the CGI or ASP files has script execution enabled. You also need to make sure the that the web server user account (usually called IUSR_machine_name where machine_name is your computer name) has read and execute access to the asp and cgi stub scripts, the ViewCVS lib/ folder, and paths where external tools like rcs, enscript, sed, and cvsgraph live. NTFS auditing makes it very easy to track down permissions problems. Also look for IIS messages in the event log.
In viewcvs, if you can browse directories but see messages like "NOTE: There are 11 files, but none match the current tag" with empty file listings, your RCS utilities might not be set up correctly. One particular problem is that they sometimes do not recognize the extensions on RCS files, treating all files specified on the command line like working copies even if they end in ",v". As a result, when the ViewCVS gives commands like
rlog C:/CVSROOT/myproject/main.cpp,v
rlog replies:
rlog: C:/CVSROOT/myproject/RCS/main.cpp,v: No such file or directory
And the files do not show up in the directory listing because the script does not have any information about them. You can test for this by entering commands like the one above on the command line. You can fix this by including this string in your RCSINIT environment variable:
-x,v
A good way to diagnose this and other problems with the utilities used by the ViewCVS is to open lib/win32popen.py and to set the DEBUG variable to 1. That way you can see the command lines of any utilities opened during the script execution and you can test them yourself in a shell.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KNOWN ISSUES
- The standalone server will not run under cygwin python because it does not support threads. ASP pages can't be run with cygwin python because it does not support ActiveX. To use either of these features you should install ActiveState Python. Activestate and Cygwin coexist nicely, so they can be installed side by side.
- enscript 1.6.2 does not seem to work with the standalone server. When a enscript page is loaded, the enscript process never returns and consumes all CPU cycles until it is killed manually. Enscript does work well under CGI and ASP. And the standalone server does work with other markup utilities like the the PHP highlighter.
- With ASP, changes made to the python scripts in the lib/ folder will not go into effect unless a python reload() directive is given, or the asp application itself is reloaded. To do this, go to the IIS properties dialog for the application directory containing the viewcvs .asp files (in Internet Services Manager). Go to the [Home] | [Virtual] Directory tab and click the "Unload" button under "Application Settings". The application will be reloaded with the new source code changes at the next page load.
To reload an individual file like win32popen.py, put the following lines in your asp page:
import win32popen
reload (win32popen)
- By default, ASP will set session cookies at each page load. ViewCVS does not use these cookies and they can be safely disabled. You can do this by opening the IIS properties dialog for the application directory containing the viewcvs .asp files. Go to the [Home] | [Virtual] Directory tab and click the "Configuration" button under "Application Settings". On the dialog that comes up, uncheck "Enable Session State" under "App Options" -> "Application Configuration".

8
windows/aspfool/Makefile Normal file
View File

@ -0,0 +1,8 @@
aspfool.dll : aspfool.o aspfool.def
g++ -shared -o aspfool.dll aspfool.o --def aspfool.def -Wl,--add-stdcall-alias
distribution.o : aspfool.cpp
g++ -O3 -o aspfool.o -c aspfool.cpp
clean :
rm -f aspfool.o aspfool.dll

18
windows/aspfool/README Normal file
View File

@ -0,0 +1,18 @@
Some script interpreters for IIS (like ASP and PHP) fail when they recieve requests like
/script.asp/extra
/script.php/fake/path
Aspfool is an ISAPI filter dll that intercepts requests with fake paths and maps them to valid local paths that the script interpreters should be able to handle more readily. The extended path information is still available to the actual scripts through the server variables, which are not altered.
Aspfool does not currently distinguish between scripts and other types of files. As a result, requests like
/page.html/blah/blah
/image.jpg/ha ha ha
will return actual files, instead of 404 not found errors.
Aspfool compiles with Visual C++ 6.0, GCC 2.95 (mingw), and Metrowerks Codewarrior 6 for Windows. Makefiles and project files are included.
Russ Yanofsky
rey4@columbia.edu

View File

@ -0,0 +1,59 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <httpfilt.h>
#include <tchar.h>
// Returns 0 if doesn't exist, 1 if it is a file, 2 if it is a directory
int inline file_exists(TCHAR const * filename)
{
WIN32_FIND_DATA fd;
HANDLE fh = FindFirstFile(filename, &fd);
if (fh == INVALID_HANDLE_VALUE)
return 0;
else
{
FindClose(fh);
return fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? 2 : 1;
}
}
BOOL WINAPI GetFilterVersion(HTTP_FILTER_VERSION * pVer)
{
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
pVer->dwFlags = SF_NOTIFY_URL_MAP | SF_NOTIFY_ORDER_DEFAULT;
return TRUE;
}
DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pn)
{
switch(notificationType)
{
case SF_NOTIFY_URL_MAP:
HTTP_FILTER_URL_MAP & um = *((HTTP_FILTER_URL_MAP *)pn);
if (!file_exists(um.pszPhysicalPath))
{
size_t pathlen = _tcslen(um.pszPhysicalPath);
size_t m = pathlen - _tcslen(um.pszURL);
for(size_t i = pathlen - 1; i > m; --i)
{
TCHAR c = um.pszPhysicalPath[i];
if (c == '\\')
{
um.pszPhysicalPath[i] = 0;
int r = file_exists(um.pszPhysicalPath);
if (r == 1)
break;
else
{
um.pszPhysicalPath[i] = c;
if (r == 2) break;
}
}
}
}
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}

View File

@ -0,0 +1,7 @@
LIBRARY "aspfool"
DESCRIPTION 'aspfool'
EXPORTS
; Explicit exports can go here
GetFilterVersion @1
HttpFilterProc @2

110
windows/aspfool/aspfool.dsp Normal file
View File

@ -0,0 +1,110 @@
# Microsoft Developer Studio Project File - Name="aspfool" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=aspfool - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "aspfool.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "aspfool.mak" CFG="aspfool - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "aspfool - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "aspfool - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "aspfool - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CUBMOVE_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CUBMOVE_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "aspfool - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CUBMOVE_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CUBMOVE_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "aspfool - Win32 Release"
# Name "aspfool - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\aspfool.CPP
# End Source File
# Begin Source File
SOURCE=.\aspfool.def
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "aspfool"=".\aspfool.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
windows/aspfool/aspfool.mcp Normal file

Binary file not shown.

BIN
windows/icons/apache_pb.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

BIN
windows/icons/small/dir.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B