/* * Copyright 1995, 1998 Perforce Software. * * This file is part of WebKeeper, a perforce client apache module. * * License is hereby granted to use this software and distribute it * freely, as long as this copyright notice is retained and modifications * are clearly marked. * * ALL WARRANTIES ARE HEREBY DISCLAIMED. * * $Id: //guest/seiwald/webkeeper/mod_webkeep2.cc#3 $ */ /* * mod_webkeep2.cc -- C++ glue between webkeeper and Perforce Client API * * ClientUserWK sits upon the Perforce ClientApi, and webKeepPrint() * makes use of ClientUserWK. The web server Apache module mod_webkeep.c * interfaces to webKeepPrint() through webkeep.h. */ # include <clientapi.h> extern "C" { # include "mod_webkeep.h" } class ClientUserWK : public ClientUser { public: void OutputInfo( char level, char *data ) { int l = strlen( data ); int isBinary = l > 5 && strcmp( data + l - 5, "text)" ); (*printer->data)( printer, isBinary ); } void OutputError( char *errBuf ) { (*printer->error)( printer, errBuf ); } void OutputText( char *data, int length ) { (*printer->text)( printer, data, length ); } void OutputBinary( char *data, int length ) { (*printer->text)( printer, data, length ); } WebKeepPrinter *printer; } ; extern "C" void webKeepPrint( const char *path, const char *user, const char *passwd, WebKeepPrinter *printer ) { Error e[1]; ClientUserWK ui; ClientApi client( &ui ); WebKeepConnect *p4 = printer->p4; // Plug in API extentions: user's closure parameter and // dispatch table. ui.printer = printer; if( p4->port ) client.SetPort( p4->port ); if( p4->client ) client.SetClient( p4->client ); if( user ) client.SetUser( user ); else if( p4->user ) client.SetUser( p4->user ); if( passwd ) client.SetPassword( passwd ); else if( p4->pass ) client.SetPassword( p4->pass ); // Connect. client.Init( e ); if( !e->Test() ) { client.SetArgv( 1, &(char *)path ); client.Run( "print" ); client.Final( e ); } if( e->Test() ) { StrBuf buf; e->Fmt( &buf ); (*printer->error)( printer, buf.Text() ); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 903 | Perforce staff |
Fix webkeeper's 401 (authentication required) message to include the necessary WWW-Authenticate message, using Steve Vance's invaluable code. This allows the authenticate-via-perforce mechanism to work with less tolerant browsers. |
||
#2 | 525 | Perforce staff |
Upgrade to apache 1.3 (just added ap_ to symbols). Support for passing Basic authentication info through as username/passwd. |
||
#1 | 524 | Perforce staff | Branch for upgrading to webkeeper 1.3. |