greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 16110

Show
Ignore:
Timestamp:
2008-06-23 17:13:17 (4 months ago)
Author:
ak19
Message:

Avoids use of dummy first Part in Multipart POST message by going back to testing ENV{QUERY_STRING} for containing upload-collection-file command, but this time we read only if this test has failed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • greenstone3/trunk/web/WEB-INF/cgi/gsdlCGI4gs3.pm

    r16100 r16110  
    1717    my $self; 
    1818    if ((defined $ENV{'REQUEST_METHOD'}) && ($ENV{'REQUEST_METHOD'} eq "POST")) { 
    19         my $line = <STDIN>; 
    20         # Multipart POST requests' boundaries created by Java's POST method on the client-GLI side  
    21         # start with --. If there are other kinds of languages and boundaries we will be dealing 
    22         # with, we can list those patterns alongside here in the (), separated by |: 
    23         my $multipartPostBoundary = q/^(--)/;  
    24  
    25         # cmd=upload-collection-file is not read into $line from STDIN, only the boundary (a  
    26         # sequence of chars preceeded by --) is encountered. Either we can match on POST requests  
    27         # whose cmds contain "download" OR we can look for $line NOT being boundary, to process $line. 
    28         # Multipart POST messages are processed by the zero-argument CGI constructor. 
    29         if ((defined $line) && ($line ne "") && ($line !~ /$multipartPostBoundary/)) {  
    30             $self = new CGI($line); 
     19 
     20        # 1st check if we're dealing with the upload-coll-file cmd. Because it will be a  
     21        # multipart POST message and must be dealt with by the default CGI() constructor 
     22        if((defined $ENV{'QUERY_STRING'}) && ($ENV{'QUERY_STRING'} =~ /upload-collection-file/)) { 
     23            $self = new CGI();  
    3124        } 
    32         else { 
    33             $self = new CGI(); 
    34         } 
     25  
     26        else { # all other POST commands processed using CGI($line) 
     27            my $line = <STDIN>; 
     28            if ((defined $line) && ($line ne "")) {  
     29                $self = new CGI($line); 
     30            } 
     31        }        
    3532    }     
    36     else { 
     33 
     34    # If one of the conditions above did not hold, then self=new CGI()  
     35    if(!defined $self) { 
    3736        $self = new CGI(); 
    3837    }