[interchange-cvs] interchange - jon modified 4 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Jul 25 10:03:44 EDT 2005
User: jon
Date: 2005-07-25 14:03:44 GMT
Modified: dist/src tlink.c tlink.pl vlink.c vlink.pl
Log:
Remove cruft from the end of tlink.pl.
Correct intro comment in vlink.pl.
Make behavior between the scripts as identical as possible.
Even out superficial code variations so a diff shows only the real differences.
Revision Changes Path
2.4 +8 -8 interchange/dist/src/tlink.c
rev 2.4, prev_rev 2.3
Index: tlink.c
===================================================================
RCS file: /var/cvs/interchange/dist/src/tlink.c,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -u -r2.3 -r2.4
--- tlink.c 18 Jun 2003 17:34:43 -0000 2.3
+++ tlink.c 25 Jul 2005 14:03:44 -0000 2.4
@@ -2,8 +2,9 @@
* tlink.c: runs as a CGI program and passes request to Interchange
* server via TCP/IP
*
- * $Id: tlink.c,v 2.3 2003/06/18 17:34:43 jon Exp $
+ * $Id: tlink.c,v 2.4 2005/07/25 14:03:44 jon Exp $
*
+ * Copyright (C) 2005 Interchange Development Group, http://www.icdevgroup.org/
* Copyright (C) 1996-2002 Red Hat, Inc.
* Copyright (C) 1995 by Andrew M. Wilcox <amw at wilcoxsolutions.com>
*
@@ -57,15 +58,14 @@
*/
#define CGIOUT 1
-/* Define as x to enable verbose debugging output.
- */
-
#ifdef HAVE_STRERROR
#define ERRMSG strerror
#else
#define ERRMSG perror
#endif
+
+
/* Return this message to the browser when the server is not running.
*/
void server_not_running()
@@ -227,10 +227,10 @@
close(sock);
sleep(1);
}
-
- /* exits if socket open fails */
- if (s < 0) server_not_running();
-
+ if (s < 0) {
+ server_not_running();
+ exit(1);
+ }
}
/* Close the socket connection.
2.3 +5 -19 interchange/dist/src/tlink.pl
rev 2.3, prev_rev 2.2
Index: tlink.pl
===================================================================
RCS file: /var/cvs/interchange/dist/src/tlink.pl,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -u -r2.2 -r2.3
--- tlink.pl 18 Jun 2003 17:34:43 -0000 2.2
+++ tlink.pl 25 Jul 2005 14:03:44 -0000 2.3
@@ -1,9 +1,11 @@
#!/usr/bin/perl -wT
# tlink.pl: runs as a cgi program and passes request to Interchange server
+# via a TCP socket
#
-# $Id: tlink.pl,v 2.2 2003/06/18 17:34:43 jon Exp $
+# $Id: tlink.pl,v 2.3 2005/07/25 14:03:44 jon Exp $
#
+# Copyright (C) 2005 Interchange Development Group, http://www.icdevgroup.org/
# Copyright (C) 1996-2002 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or
@@ -52,7 +54,7 @@
<HTML><HEAD><TITLE>Interchange server not running</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
-<H3>We're sorry, the Interchange server was not running...</H3>
+<H3>We're sorry, the Interchange server is unavailable...</H3>
<P>
We are out of service or may be experiencing high system demand.
Please try again soon.
@@ -94,14 +96,13 @@
$check = read(STDIN, $Entity, $len);
die_page("Entity wrong length")
- unless $check == $len;
+ unless $check == $len;
$Entity;
}
-
sub send_arguments {
my $count = @ARGV;
@@ -177,21 +178,6 @@
print SOCK send_entity();
print SOCK "end\n";
-
-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;
2.4 +4 -2 interchange/dist/src/vlink.c
rev 2.4, prev_rev 2.3
Index: vlink.c
===================================================================
RCS file: /var/cvs/interchange/dist/src/vlink.c,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -u -r2.3 -r2.4
--- vlink.c 18 Jun 2003 17:34:43 -0000 2.3
+++ vlink.c 25 Jul 2005 14:03:44 -0000 2.4
@@ -1,8 +1,10 @@
/*
- * vlink.c: runs as a cgi program and passes request to Interchange server
+ * vlink.c: runs as a CGI program and passes request to Interchange
+ * server via UNIX socket
*
- * $Id: vlink.c,v 2.3 2003/06/18 17:34:43 jon Exp $
+ * $Id: vlink.c,v 2.4 2005/07/25 14:03:44 jon Exp $
*
+ * Copyright (C) 2005 Interchange Development Group, http://www.icdevgroup.org/
* Copyright (C) 1996-2002 Red Hat, Inc.
* Copyright (C) 1995 by Andrew M. Wilcox <amw at wilcoxsolutions.com>
*
2.3 +11 -7 interchange/dist/src/vlink.pl
rev 2.3, prev_rev 2.2
Index: vlink.pl
===================================================================
RCS file: /var/cvs/interchange/dist/src/vlink.pl,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -u -r2.2 -r2.3
--- vlink.pl 18 Jun 2003 17:34:43 -0000 2.2
+++ vlink.pl 25 Jul 2005 14:03:44 -0000 2.3
@@ -1,10 +1,11 @@
#!/usr/bin/perl -wT
# vlink.pl: runs as a cgi program and passes request to Interchange server
-# via TCP UNIX-domain socket
+# via a UNIX socket
-# $Id: vlink.pl,v 2.2 2003/06/18 17:34:43 jon Exp $
+# $Id: vlink.pl,v 2.3 2005/07/25 14:03:44 jon Exp $
#
+# Copyright (C) 2005 Interchange Development Group, http://www.icdevgroup.org/
# Copyright (C) 1996-2002 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or
@@ -30,6 +31,7 @@
my $LINK_TIMEOUT = 30;
#my $LINK_TIMEOUT = ~_~LINK_TIMEOUT~_~;
my $ERROR_ACTION = "-notify";
+
$ENV{PATH} = "/bin:/usr/bin";
$ENV{IFS} = " ";
@@ -86,10 +88,13 @@
my $check;
+ # Can't hurt, helps Windows people
+ binmode(STDIN);
+
$check = read(STDIN, $Entity, $len);
die_page("Entity wrong length")
- unless $check == $len;
+ unless $check == $len;
$Entity;
@@ -123,7 +128,6 @@
sub send_entity {
return '' unless defined $ENV{CONTENT_LENGTH};
my $len = $ENV{CONTENT_LENGTH};
-
return '' unless $len > 0;
my $val = "entity\n";
@@ -134,7 +138,7 @@
$SIG{PIPE} = sub { die_page("signal"); };
$SIG{ALRM} = sub { server_not_running(); exit 1; };
-alarm $LINK_TIMEOUT;
+eval { alarm $LINK_TIMEOUT; };
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!\n";
@@ -144,8 +148,8 @@
$ok = connect(SOCK, sockaddr_un($LINK_FILE));
} while ( ! defined $ok and $! =~ /interrupt|such file or dir/i);
-my $undef = ! defined $ok;
-die "ok=$ok def: $undef connect: $!\n" if ! $ok;
+my $def = defined $ok;
+die "ok=$ok def: $def connect: $!\n" if ! $ok;
get_entity();
More information about the interchange-cvs
mailing list