[ic] Apache 2.0 & Admin UI

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Wed Aug 7 20:25:02 2002


On Wed, Aug 07, 2002 at 03:24:46PM -0700, Dan Browning wrote:
> Has anybody gotten Apache 2.0 to work with the Admin UI?  The problem that 
> I experience is triggered by a lot of actions.  Particularly any of the 
> buttons in the 'Design' section (but also in the Tables section).
> 
> To reproduce:
>  * Design
>  * Hit the "plus" to create a new area
> 
> Results (returned to browser after hitting the button):
> 
> Undefined catalog: 
> ui_window_name=mainwindow\&mv_todo=return\&mv_nextpage=admin/layout\&ui_filter_class=\&area=4\&mv_click_map=Section_properties\&mv_click_Section_properties=\&mv_click_map=Sort_section_higher\&mv_click_Sort_section_higher=\&mv_click_map=Sort_section_lower\&mv_click_Sort_section_lower=\&mv_click_map=Create_section\&mv_click_Create_section=Create
> 
> I've tried:
> 
>  * [On Red Hat 7.3]
>  * Apache 2.0.39
>  * Interchange 4.8.5 (perhaps 4.9 works?)
>  * tlink & vlink
> 
> Dennis Chen has already reported the problem with no replies:
> 
>         http://interchange.redhat.com/pipermail/interchange-users/2002-June/022670.html
> 
> And a similar problem was reported some time ago by someone using "Roxen" 
> web server, when Jon Jensen proposed that the web server was translating 
> "+" into %20.

Yes.  If anyone wants a tlink.pl that works on roxen, I've appended it.
This version writes a lot of stuff to /tmp; probably useful for
debugging.  This fix works for roxen 1.3; we've used it for years in
production.

The tlink.pl is very very useful for debugging.  :-)

cfm

> 
> While using 2.0.x wont be important to me until it is released as stable, I 
> thought I would notify the rest of the list in case there is a work around 
> or to save someone the time of finding it out for themselves. :-)
> 

-- 

Christopher F. Miller, Publisher                               cfm@maine.com
MaineStreet Communications, Inc           208 Portland Road, Gray, ME  04039
1.207.657.5078                                         http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux



#!/usr/bin/perl -wT
# tlink.pl: runs as a cgi program and passes request to Vend server
#
#   $Id: tlink.pl,v 1.1.1.1 1999/11/15 00:47:09 cfm Exp $
#
# Copyright 1996-1998 by Michael J. Heins <mikeh@minivend.com>
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of the GNU General Public License as
#    published by the Free Software Foundation; either version 2 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

require 5.002;
use strict;
use Socket;
my $LINK_TIMEOUT = 15;
my $LINK_PORT    = 7786;
my $LINK_HOST    = '172.16.0.15';
my $ERROR_ACTION = "-notify";

$ENV{PATH} = "/bin:/usr/bin";
$ENV{IFS} = " ";

# Return this message to the browser when the server is not running.
# Log an error log entry if set to notify

sub server_not_running {

	my $msg;

	if($ERROR_ACTION =~ /not/i) {
		warn "ALERT: MiniVend server not running for $ENV{SCRIPT_NAME}\n";	
	}

	$| = 1;
	print <<EOF;
Content-type: text/html

<HTML><HEAD><TITLE>MiniVend server not running</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<H3>We're sorry, the MiniVend server was not running...</H3>
<P>
We are out of service or may be experiencing high system demand,
please try again soon.

</BODY></HTML>
EOF

}

# Return this message to the browser when a system error occurs.
#
sub die_page {
  printf("Content-type: text/plain\r\n\r\n");
  printf("We are sorry, but the cgi-bin server is unavailable due to a\r\n");
  printf("system error.\r\n\r\n");
  printf("%s: %s (%d)\r\n", $_[0], $!, $?);
  if($ERROR_ACTION =~ /not/i) {
	warn "ALERT: MiniVend $ENV{SCRIPT_NAME} $_[0]: $! ($?)\n";
  }
  exit(1);
}


my $Entity = '';

# Read the entity from stdin if present.

sub get_entity {

  return '' unless defined $ENV{CONTENT_LENGTH};
  my $len = $ENV{CONTENT_LENGTH} || 0;
  return '' unless $len;

  my $check;

  $check = read(STDIN, $Entity, $len);

  die_page("Entity wrong length")
      unless $check == $len;

  $Entity;

}



sub send_arguments {
   @ARGV = (join ' ', @ARGV);  # cfm wondering about this again
	my $count = @ARGV;
	my $val = "arg $count\n";
	for(@ARGV) {
		$val .= length($_);
		$val .= " $_\n";
	}
	return $val;
}

sub send_environment () {
	my (@tmp) = keys %ENV;
	my $count = @tmp;
	my ($str);
	my $val = "env $count\n";
	for(@tmp) {
		$str = "$_=$ENV{$_}";
		$val .= length($str);
		$val .= " $str\n";
	}
	return $val;
}

sub send_entity {
	return '' unless defined $ENV{CONTENT_LENGTH};
	my $len = $ENV{CONTENT_LENGTH};
	return '' unless $len > 0;

	my $val = "entity\n";
	$val .= "$len $Entity\n";
	return $val;
}

$SIG{PIPE} = sub { die_page("signal"); };
$SIG{ALRM} = sub { server_not_running(); exit 1; };

alarm $LINK_TIMEOUT;

my ($remote, $port, $iaddr, $paddr, $proto, $line);

$remote = $LINK_HOST;
$port   = $LINK_PORT;

if ($port =~ /\D/) { $port = getservbyname($port, 'tcp'); }

die_page("no port") unless $port;

$iaddr = inet_aton($remote);
$paddr = sockaddr_in($port,$iaddr);

$proto = getprotobyname('tcp');

socket(SOCK, PF_INET, SOCK_STREAM, $proto)	or die "socket: $!\n";

my $ok;

do {
   $ok = connect(SOCK, $paddr);
} while ( ! defined $ok and $! =~ /interrupt/i);

my $def = defined $ok;
die "ok=$ok def: $def connect: $!\n" if ! $ok;

get_entity();

select SOCK;
$| = 1;
select STDOUT;

open (LOG,">>/tmp/tlink.log");

print SOCK send_arguments();
print LOG send_arguments();
print SOCK send_environment();
print LOG send_environment();
print SOCK send_entity();
print LOG send_entity();
print SOCK "end\n";
print LOG "end\n";
close LOG;

while(<SOCK>) {
	print;
}

close (SOCK)								or die "close: $!\n";
exit;



get_entity();

print SOCK send_arguments();
print SOCK send_environment();
print SOCK send_entity();

while(<SOCK>) {
	print;
}

close (SOCK)								or die "close: $!\n";
exit;