Changeset 16109 for greenstone3


Ignore:
Timestamp:
2008-06-23T17:11:02+12:00 (16 years 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/web/WEB-INF/cgi/gsdlCGI.pm

    r16106 r16109  
    1010use Cwd;
    1111
    12 @gsdlCGI::ISA = ( 'CGI' ); #@gsdlCGI::ISA = qw( CGI );
    13 #@ISA = ('CGI'); # syntax error of some kind when using strict
     12@gsdlCGI::ISA = ( 'CGI' );
    1413
    1514sub new {
    1615    my $class = shift @_;
    17 
     16   
    1817    my $self;
    1918   
     
    3029
    3130    if ((defined $ENV{'REQUEST_METHOD'}) && ($ENV{'REQUEST_METHOD'} eq "POST")) {
    32     my $line = <STDIN>;
    33     # Multipart POST requests' boundaries created by Java's POST method on the client-GLI side
    34     # start with --. If there are other kinds of languages and boundaries we will be dealing
    35     # with, we can list those patterns alongside here in the (), separated by |:
    36     my $multipartPostBoundary = q/^(--)/;
    37 
    38     # cmd=upload-collection-file is not read into $line from STDIN, only the boundary (a
    39     # sequence of chars preceeded by --) is encountered. Either we can match on POST requests
    40     # whose cmds contain "download" OR we can look for $line NOT being boundary, to process $line.
    41     # Multipart POST messages are processed by the zero-argument CGI constructor.
    42     if ((defined $line) && ($line ne "") && ($line !~ /$multipartPostBoundary/)) { #&& ($line =~ /download/)) {
    43         $self = new CGI($line);
    44     }
     31
     32    # Check if we're dealing with the upload-coll-file cmd. Because it will be a
     33    # multipart POST message and must be dealt with by the default CGI() constructor
     34    if((defined $ENV{'QUERY_STRING'}) && ($ENV{'QUERY_STRING'} =~ /upload-collection-file/)) {
     35        $self = new CGI();
     36    }
     37
     38    else { # all other POST commands processed using CGI($line)
     39        my $line = <STDIN>;
     40        if ((defined $line) && ($line ne "")) {
     41        $self = new CGI($line);
     42        }
     43    }
     44   
    4545    }   
    46 
    47     # If one of the conditions above did not hold, then self=new CGI.
    48     # This includes multipart post boundaries as are sent for cmd=upload-collection-file,
    49     # which should also be processed by the zero-argument CGI constructor.
     46   
     47    # If one of the conditions above did not hold, then self=new CGI()
    5048    if (!defined $self) {
    5149    $self = new CGI();
Note: See TracChangeset for help on using the changeset viewer.