[LON-CAPA-cvs] cvs: doc /loncapafiles updatequery.piml

raeburn raeburn@source.lon-capa.org
Thu, 12 Feb 2009 18:22:34 -0000


This is a MIME encoded message

--raeburn1234462954
Content-Type: text/plain

raeburn		Thu Feb 12 18:22:34 2009 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - Additional item in : separated hosts.tab
     - Web Server Protocol (either http or https).
     - used in lontexconvert.pm to set URI for internal TCP/IP request for mimeTeX/mimetex.cgi (gets Vertical-Align parameter for centering of mimeTeX-rendered formulae).
  
  
--raeburn1234462954
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090212182234.txt"

Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.59 doc/loncapafiles/updatequery.piml:1.60
--- doc/loncapafiles/updatequery.piml:1.59	Fri Dec  7 06:01:06 2007
+++ doc/loncapafiles/updatequery.piml	Thu Feb 12 18:22:34 2009
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.59 2007/12/07 06:01:06 raeburn Exp $ -->
+<!-- $Id: updatequery.piml,v 1.60 2009/02/12 18:22:34 raeburn Exp $ -->
 
 <!--
 
@@ -124,6 +124,7 @@
 my $domainDescription;
 my $domainTabExtras;
 my $primaryLibServer;
+my $protocol;
 my @libservers = ();
 unless (-e "<TARGET />") {
   print(&lt;&lt;END);
@@ -474,6 +475,28 @@
   }
 }
 
+while (!$flag) {
+  print(&lt;&lt;END);
+
+****  Web Server Protocol ****
+If you plan to run the Apache server with SSL enabled, 
+the protocol should be: https; otherwise it should be http.
+ENTER WEB SERVER PROTOCOL:
+END
+
+  my $choice=&lt;&gt;;
+  chomp($choice);
+  if ($choice!~/^https?$/) {
+    open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
+    print(OUT 'protocol'."\t".$choice."\n");
+    close(OUT);
+    $protocol=$choice;
+    $flag=1;
+  }
+  else {
+    print "Invalid input (only http or https allowed).\n";
+  }
+}
 
 # update loncapa.conf
 my $confdir = '/etc/httpd/conf/';
@@ -627,7 +650,7 @@
 		    (undef,$domainDescription,$domainTabExtras)=split(/:/,$line,3);
 		    chomp($domainDescription);
 		    chomp($domainTabExtras);
-		    # the remianing field (primary lib server) is handled later
+		    # the remaining field (primary lib server) is handled later
 		    $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
 		    last;
 		}
@@ -637,6 +660,22 @@
 	}
     }
 
+    if (!$protocol) {
+        foreach my $file (@hosts_files) {
+            open(IN,'&lt;'.$file);
+            while(my $line = &lt;IN&gt;) {
+                if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:(https?)/) {
+                    $protocol = $1;
+                    last;
+                }
+            }
+        }
+    }
+
+    if (!$protocol) {
+        $protocol = 'http';
+    }
+
     while(!$primaryLibServ && (@hosts_file || @domain_files)) {
 	my $file = shift(@domain_files);
         open(IN,'&lt;'.$file);
@@ -664,7 +703,7 @@
     }
    
 # implement editing logic below, interactively
-# update loncapa.conf until 12 is entered
+# update loncapa.conf until 13 is entered
 
 $flag=0;
 
@@ -679,12 +718,13 @@
  4) ID of primary library server for domain: $primaryLibServer
  5) Server Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
  6) Support E-mail Address: $perlvar{'lonSupportEMail'}
- 7) Role: $perlvar{'lonRole'}
- 8) Cache Expiration Time: $perlvar{'lonExpire'}
- 9) Server Load: $perlvar{'lonLoadLim'}
-10) User Load: $perlvar{'lonUserLoadLim'}
-11) Allow only secure connections: $securestatus 
-12) Everything is correct up above
+ 7) Web Server Protocol (http or https): $protocol 
+ 8) Role: $perlvar{'lonRole'}
+ 9) Cache Expiration Time: $perlvar{'lonExpire'}
+10) Server Load: $perlvar{'lonLoadLim'}
+11) User Load: $perlvar{'lonUserLoadLim'}
+12) Allow only secure connections: $securestatus 
+13) Everything is correct up above
 END
 
 my @error;
@@ -715,6 +755,10 @@
    push(@error,"Invalid Role");
 }
 
+unless (($protocol eq 'http') || ($protocol eq 'https')) {
+   push(@error,"Invalid Protocol (must be http or https");
+}
+
 if (!defined($primaryLibServer)) {
    if (@libservers > 0) {
        push(@error,"No primary library server ID designated. Choose from: ".join(',',sort(@libservers)));
@@ -740,7 +784,7 @@
 
 if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }
   print(&lt;&lt;END);
-ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12:
+ENTER A CHOICE OF 1-12 TO CHANGE, otherwise ENTER 13:
 END
 my $choice=&lt;&gt;;
 chomp($choice);
@@ -812,7 +856,17 @@
   }
   elsif ($choice==7) {
   print(&lt;&lt;END);
-7) Role: $perlvar{'lonRole'}
+7) Server Protocol (http or https): 
+ENTER NEW VALUE: (this should be either 'http' or 'https'
+                 if in doubt set to 'http'):
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $protocol=$choice2;
+  }
+  elsif ($choice==8) {
+  print(&lt;&lt;END);
+8) Role: $perlvar{'lonRole'}
 ENTER NEW VALUE (this should be either 'access' or 'library' 
                  if in doubt select 'library'):
 END
@@ -820,27 +874,27 @@
     chomp($choice2);
     $perlvar{'lonRole'}=$choice2;
   }
-  elsif ($choice==8) {
+  elsif ($choice==9) {
   print(&lt;&lt;END);
-8) Cache Expiration Time: $perlvar{'lonExpire'}
+9) Cache Expiration Time: $perlvar{'lonExpire'}
 ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
     $perlvar{'lonExpire'}=$choice2;
   }
-  elsif ($choice==9) {
+  elsif ($choice==10) {
   print(&lt;&lt;END);
-9) Server Load: $perlvar{'lonLoadLim'}
+10) Server Load: $perlvar{'lonLoadLim'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
     $perlvar{'lonLoadLim'}=$choice2;
   }
-  elsif ($choice==10) {
+  elsif ($choice==11) {
   print(&lt;&lt;END);
-10) User Load: $perlvar{'lonUserLoadLim'}
+11) User Load: $perlvar{'lonUserLoadLim'}
 Numer of users that can login before machine is 'overloaded'
 ENTER NEW VALUE (integer value, 0 means there is no limit):
 END
@@ -848,9 +902,9 @@
     chomp($choice2);
     $perlvar{'lonUserLoadLim'}=$choice2;
   }
-  elsif ($choice==11) {
+  elsif ($choice==12) {
   print(&lt;&lt;END);
-11) Allow only secure connections: $securestatus 
+12) Allow only secure connections: $securestatus 
 The Lon-CAPA communication daemons lonc and lond can be configured to
 allow only secure connections by default.
 
@@ -877,7 +931,7 @@
     }
     ($securestatus,$securenum)=&securesetting(%perlvar);
   }
-  elsif (($choice==12) && (!$error)) {
+  elsif (($choice==13) && (!$error)) {
     $flag=1;
   }
   else {
@@ -910,7 +964,7 @@
   $lineexistflag=0;
   $hostidexistflag=0;
   $line2insert=&lt;&lt;END;
-$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname
+$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$protocol
 END
   if (!$domainTabExtras) {
 	$domainTabExtras=':::::';
@@ -920,7 +974,7 @@
     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
       die('file generation error');
       print(OUT $line2insert);
-      print OUT ("^$hostname\n");
+      print OUT ("^$hostname:$protocol\n");
     close(OUT);
     open(OUT,'&gt;../'.$lonCluster.'_dns_hosts.tab') or
       die('file generation error');
@@ -964,7 +1018,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+      `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
     }
     elsif ($hostidexistflag and $lineexistflag) {
       print &lt;&lt;END;
@@ -977,7 +1031,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+      `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
     }
     elsif (!$hostidexistflag and !$lineexistflag) {
       print &lt;&lt;END;
@@ -990,7 +1044,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+      `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
     }
   }
   $lineexistflag=0;

--raeburn1234462954--