Changeset 23468

Show
Ignore:
Timestamp:
13.12.2010 22:52:58 (9 years ago)
Author:
davidb
Message:

Printing to STDERR in IIS sends output (be default) to the web page. This modification detects that is is IIS from the environment variable SERVER_SOFTWARE and redirects STDERR to Greenstone's error.txt file.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/cgi-bin/gsdlCGI.pm

    r23403 r23468  
    1212 
    1313@gsdlCGI::ISA = ( 'CGI' );  
     14 
     15our $server_software; 
     16our $server_version; 
     17 
     18sub BEGIN { 
     19    $server_software = $ENV{'SERVER_SOFTWARE'}; 
     20 
     21    if (defined $server_software) { 
     22    if ($server_software =~ m/^Microsoft-IIS\/(.*)$/) { 
     23        $server_version = $1; 
     24    } 
     25    } 
     26} 
     27 
    1428 
    1529sub prenew { 
     
    442456    $ENV{'GSDLOS'} = $gsdlos; 
    443457 
     458    if (defined $server_software) { 
     459    if ($server_software =~ m/^Microsoft-IIS/) { 
     460        # Printing to STDERR, by default, goes to the web page in IIS 
     461        # Send it instead to Greenstone's error.txt 
     462         
     463        my $error_filename = "$gsdlhome/etc/error.txt"; # OK for Windows 
     464        open STDERR, ">> $error_filename" 
     465        or  die "Can't write to $error_filename: $!\n"; 
     466        binmode STDERR; 
     467    } 
     468    } 
    444469 
    445470    my $library_url = $self->get_library_url_suffix(); # best to have GSDLOS set beforehand