[interchange-cvs] interchange - heins modified 3 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sat Mar 6 17:11:54 EST 2004


User:      heins
Date:      2004-03-06 22:11:53 GMT
Modified:  lib/Vend Server.pm Dispatch.pm Util.pm
Log:
* Add Status: and Content-Type: headers if we are the recipient of
  an internal redirect.

* Remove references and tests on $Vend::InternalHTTP and
  $Vend::OnlyInternalHTTP, which are no longer wanted with the
  removal of the internal HTTP server.

Revision  Changes    Path
2.49      +8 -21     interchange/lib/Vend/Server.pm


rev 2.49, prev_rev 2.48
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.48
retrieving revision 2.49
diff -u -r2.48 -r2.49
--- Server.pm	29 Feb 2004 20:41:40 -0000	2.48
+++ Server.pm	6 Mar 2004 22:11:53 -0000	2.49
@@ -1,6 +1,6 @@
 # Vend::Server - Listen for Interchange CGI requests as a background server
 #
-# $Id: Server.pm,v 2.48 2004/02/29 20:41:40 mheins Exp $
+# $Id: Server.pm,v 2.49 2004/03/06 22:11:53 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,7 +26,7 @@
 package Vend::Server;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.48 $, 10);
+$VERSION = substr(q$Revision: 2.49 $, 10);
 
 use POSIX qw(setsid strftime);
 use Vend::Util;
@@ -492,13 +492,15 @@
 				: "200 OK";
 	}
 
+	if($CGI::redirect_status and ! $Vend::StatusLine) {
+		$status = "200 OK";
+		$Vend::StatusLine = "Status: 200 OK\nContent-Type: text/html";
+	}
+
 	$$body =~ s/^\s+//
 		if ! $Vend::ResponseMade and $::Pragma->{strip_white};
 
 	if(! $s and $Vend::StatusLine) {
-		$Vend::StatusLine = "HTTP/1.0 $status\r\n$Vend::StatusLine"
-			if defined $Vend::InternalHTTP
-				and $Vend::StatusLine !~ m{^HTTP/};
 		$Vend::StatusLine .= ($Vend::StatusLine =~ /^Content-Type:/im)
 							? '' : "\r\nContent-Type: text/html\r\n";
 # TRACK
@@ -547,7 +549,7 @@
 		return 1;
 	}
 
-	if (defined $Vend::InternalHTTP or defined $ENV{MOD_PERL} or $CGI::script_name =~ m:/nph-[^/]+$:) {
+	if (defined $ENV{MOD_PERL} or $CGI::script_name =~ m:/nph-[^/]+$:) {
 # TRACK
 		my $save = select $fh;
 		$| = 1;
@@ -843,14 +845,6 @@
 			die "Unrecognized block: $block\n";
         }
     }
-	if($Vend::OnlyInternalHTTP) {
-		my $msg = ::errmsg(
-						"attempt to connect from unauthorized host '%s'",
-						$Vend::OnlyInternalHTTP,
-					);
-		::logGlobal({ level => 'alert' }, $msg);
-		die "$msg\n";
-	}
 	return 1;
 }
 
@@ -1670,7 +1664,6 @@
 			}
 
 			CHECKHOST: {
-				undef $Global::OnlyInternalHTTP;
 				last CHECKHOST if $unix_socket{$p};
 				my $connector;
 				(undef, $ok) = sockaddr_in($ok);
@@ -1680,7 +1673,6 @@
 				(undef, $dns_name) = gethostbyaddr($ok, AF_INET);
 				$dns_name = "UNRESOLVED_NAME" if ! $dns_name;
 				last CHECKHOST if $dns_name =~ /$Global::TcpHost/;
-				$Global::OnlyInternalHTTP = "$dns_name/$connector";
 			}
 			$spawn = 1;
 		}
@@ -1841,7 +1833,6 @@
 				(undef, $dns_name) = gethostbyaddr($ok, AF_INET);
 				$dns_name = $connector if ! $dns_name;
 				last CHECKHOST if $dns_name =~ /$Global::TcpHost/;
-				$Global::OnlyInternalHTTP = "$dns_name/$connector";
 			}
 
 			$handled++;
@@ -1850,8 +1841,6 @@
 			
 			reset_vars();
 
-			$Vend::OnlyInternalHTTP = $Global::OnlyInternalHTTP;
-
 			if ($Vend::Cfg = http_soap(\*MESSAGE, \%env, \$entity)) {
 				$Vend::Cat = $Vend::Cfg->{CatalogName};
 			}
@@ -2240,7 +2229,6 @@
 			}
 
 			CHECKHOST: {
-				undef $Vend::OnlyInternalHTTP;
 				last CHECKHOST if $unix_socket{$p};
 				my $connector;
 				(undef, $ok) = sockaddr_in($ok);
@@ -2250,7 +2238,6 @@
 				(undef, $dns_name) = gethostbyaddr($ok, AF_INET);
 				$dns_name = "UNRESOLVED_NAME" if ! $dns_name;
 				last CHECKHOST if $dns_name =~ /$Global::TcpHost/;
-				$Vend::OnlyInternalHTTP = "$dns_name/$connector";
 			}
 			$spawn = 1 unless $only_ipc;
 		}



1.35      +3 -12     interchange/lib/Vend/Dispatch.pm


rev 1.35, prev_rev 1.34
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- Dispatch.pm	29 Feb 2004 20:41:40 -0000	1.34
+++ Dispatch.pm	6 Mar 2004 22:11:53 -0000	1.35
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.34 2004/02/29 20:41:40 mheins Exp $
+# $Id: Dispatch.pm,v 1.35 2004/03/06 22:11:53 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.34 $, 10);
+$VERSION = substr(q$Revision: 1.35 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -1018,9 +1018,7 @@
 		return;
 	}
 
-	if (defined $Global::SelectorAlias{$CGI::script_name}
-		and ! defined $Vend::InternalHTTP                 )
-	{
+	if (defined $Global::SelectorAlias{$CGI::script_name}) {
 		my $real = $Global::SelectorAlias{$CGI::script_name};
 		unless (	$CGI::secure                                        or
 					$Vend::Cfg->{SecureURL} =~ m{$CGI::script_name$}     and
@@ -1030,13 +1028,6 @@
 			$Vend::Cfg->{VendURL}   =~ s!$real!$CGI::script_name!;
 			$Vend::Cfg->{SecureURL} =~ s!$real!$CGI::script_name!;
 		}
-	}
-	elsif ($Vend::InternalHTTP) {
-		$Vend::Cfg->{VendURL} = "http://" .
-								$CGI::http_host .
-								$CGI::script_path;
-		$Vend::Cfg->{ImageDir} = $Vend::Cfg->{ImageDirInternal}
-			if  $Vend::Cfg->{ImageDirInternal};
 	}
 
 	if($Global::HitCount and ! $cat) {



2.70      +2 -6      interchange/lib/Vend/Util.pm


rev 2.70, prev_rev 2.69
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.69
retrieving revision 2.70
diff -u -r2.69 -r2.70
--- Util.pm	29 Feb 2004 20:18:39 -0000	2.69
+++ Util.pm	6 Mar 2004 22:11:53 -0000	2.70
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.69 2004/02/29 20:18:39 mheins Exp $
+# $Id: Util.pm,v 2.70 2004/03/06 22:11:53 mheins Exp $
 # 
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -87,7 +87,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.69 $, 10);
+$VERSION = substr(q$Revision: 2.70 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -1098,10 +1098,6 @@
 
 		if( defined $level and ! check_security($file, $level, $gate) ){
 			my $realm = $::Variable->{COMPANY} || $Vend::Cat;
-			$Vend::StatusLine = <<EOF if $Vend::InternalHTTP;
-HTTP/1.0 401 Unauthorized
-WWW-Authenticate: Basic realm="$realm"
-EOF
 			if(-f "$try/violation$suffix") {
 				$fn = "$try/violation$suffix";
 			}








More information about the interchange-cvs mailing list